Tuesday, May 01, 2007

F#... Hot or Not?

Eber and I recently decided we wanted to play around with a new language. We looked into a few of the current popular ones like Ruby or Python (Since we can use them in VS, IronRuby / IronPython), but they are all 'fairly' similar. (I put in IronRuby instead of Ruby in Steel because one is $199 and the other is not, and hey... free is good ;)  ) So we decided to go somewhere new, a language that is quite a bit different, F#. F# is an experimental language from Microsoft that shares the same syntax style as OCAML (Object CAML). It's a functional language which made it different enough for us.

So if you wanna play along here's what you're gonna need:

1-Visual Studio 2005 (does not currently work on Orcas)
2-F# (download the newest version (1.9.1) here, the F# home page currently doesn't have the newest release listed)
3-Some patience since there is not a whole lot of stuff out there about F#. But there is quite a bit of stuff out there for OCAML (Which is where I've been getting most of my info since most of it will work in F#)
One other things that led us to F# was the amount of influence it has had on C#. What you say? Well yes there are many things from F# that have made their way into C# from this experimental language. One of the newest things are Lambdas, as of C# 3.0, which make the new LINQ possible (where they are used everywhere!). So if all of this hasn't gotten you the least bit excited it's also a type safe language, you can do scripting, or objects, and since it's a .NET supported language you can access your F# DLL's from your C# projects, and vice-versa. Since it is a .NET supported language and it isn't widely used you will find lots of examples out there that use quite a bit of the .NET librarys.

ex. You may see quite of bit of this

Console.WriteLine("Hello");; // Looks familiar if you use C#

instead of this

print_string("Hello");; // This is the F# stuff (which is also the same in OCAML)

print_newling();;

So one thing you may notice right of the bat is the double ';' at the end of the lines. This is one of the first things that had stumped me, and I was hard pressed to find anything on the F# website. So I started looking around the OCAML pages and found this nice explanation of when to use no ';' when to use a single ';' and when to use double ';' (scroll down a little over half way down the page until you find 'Using and omitting ;; and ;')

So far I give F# a potential 'HOT' vote, since I haven't done a lot with it as of yet. It's a different way of thinking, since it is a functional language, and it's also a pretty flexible language. Eber and I plan on doing more with F# so expect more blogs from the both of us in the future, if you're interested in F# if not keep checking our blogs for other fun stuff :)

3 comments:

Robert Pickering said...

I would definetly give F# a "hot" vote since I've just finished writing a book about it! "Foundations of F#" finishes its first printing run today, 25th May. I know there's not a _huge_ amount of info out there, but I think the book will improve this. There are a couple other good sites you should take a look at "the hub" a community site and Flying Frog's F# section:
http://cs.hubfs.net/
http://www.ffconsultancy.com/dotnet/fsharp/index.html

Cours it would be great if you bought the book too:
http://www.amazon.com/Foundations-F-Robert-Pickering/dp/1590597575/ref=pd_bbs_sr_1/103-9488157-7397438?ie=UTF8&s=books&qid=1179940274&sr=8-1

Justin Wilson said...

Hey thanks for the extra links and book info, every little bit helps in my quest :)
It's hard to find a good solid resource for F# so I might just be adding to my library here shortly ;)

Anonymous said...

Great insights to new and upcoming technologies... That's hot!