Skip to content

What & Why Choose F#?

I am becoming more interested in F# lately, learning a little more on what it’s all about and in my travels I have stumbled across a few links and topics on why one should use F# and what it’s all about. I thought I might share. Shamefully, I personally have still been too flat out to use it myself, but hoping that will change very soon!

Before I get started on a list of reasons I came across on why you should use F#, I’ll just give you a quick background on what it is in my own words.

F# (pronounced F Sharp) is a functional programming language initially developed by Don Syme and his team at Microsoft Research Labs, Cambridge and is now been actively developed at Microsoft Developer Division (Don Syme is the guy who brought us our beloved Generics and he’s also an Aussie too!!!!!! Great to hear!). The language to my knowledge has grown so much traction and since it’s availability to the public through Microsoft Research Labs it is now a fully supported language in the .NET Framework and as part of Visual Studio 2010.  More information can be read on this over at Don Syme’s blog.

SO WHAT IS IT AGAIN?

“A functional programming language for the .NET Framework. It combines the succinct, expressive, and compositional style of functional programming with the runtime, libraries, interoperability, and object model of .NET.”
Microsoft F# Developer Center

F# (pronounced F Sharp) is a multi-paradigm programming language, targeting the .NET Framework, that encompasses functional programming as well as imperativeobject-oriented programming disciplines. It is a variant of ML and is largely compatible with the OCaml implementation. F# was initially developed by Don Syme at Microsoft Research but is now being developed at Microsoft Developer Division and will be distributed as a fully supported language in the .NET Framework and Visual Studio ecosystem as part of Visual Studio 2010.
Wikipedia

SO WHAT CAN IT DO FOR ME?

As quoted directly from the Microsoft Research Labs F# page, so probably one of your best references:

F# developed as a research programming language to provide the much sought-after combination of type safety, succinctness, performance, expresivity and scripting, with all the advantages of running on a high-quality, well-supported modern runtime system. This combination has been so successful that the language is now being transitioned towards a fully supported language on the .NET platform. Some of the reasons for this move are that F# gives you:

The only language to provide a combination like this is F# (pronounced FSharp) – a scripted/functional/imperative/object-oriented programming language that is a fantastic basis for many practical programming tasks.  F# was developed as a pragmatically-oriented variant of ML that shares a core language with OCaml. Unlike other scripting languages it executes at or near the speed of C# and C++, making use of the performance that comes through strong typing. Unlike many type-inferred, statically-typed languages it also supports many dynamic language techniques, such as property discovery and reflection where needed. F# includes extensions for working across languages and for object-oriented programming, and it works seamlessly with other .NET programming languages and tools.

SHOW ME SOME OF THAT WEIRD CODE!
See 99 Bottles of Beer written in F#:

let bottleStr bottles =
    match bottles with
    | 0 -> "no more bottles"
    | 1 -> "1 bottle"
    | _ -> bottles.ToString() + " bottles"

let verse n =
    match n with
    | 0 -> "No more bottles of beer on the wall, no more bottles of beer.\n" +
           "Go to the store and buy some more, 99 bottles of beer on the wall.\n"
    | _ -> bottleStr n + " of beer on the wall, " + bottleStr n + " of beer.\n" +
           "Take one down and pass it around, " + bottleStr (n-1) +
           " of beer on the wall.\n"

List.iter (printfn "%s") [for v in [99..-1..0] -> verse v]

TELL ME MORE!
If you are interested, but not sure where to start, or would just like some demonstrations or more information, check out these links:

  1. Quick 5 minute speed-run through working with F# in Visual Studio 2010 Creating Your First F# Program with Visual Studio 2010 (05:09:00)
  2. Don Syme: Introduction to F#, Part 1 (14:26:00)
  3. Don Syme: Introduction to F#, Part 2 (23:07:00)
  4. I’m sure this would provide the best benefit, as it’s a PDC 2008 recording – An Introduction to Microsoft F# (78:37:00)
  1. MSDN F# Developer Center
  2. F# at Microsoft Research
  3. F# Wikipedia Article
  4. Don Syme’s Blog

I WANT SOME BOOKS!

Here are some hand picked books on the topic, all APress books and some by Don Syme the F#’s creator himself:



DOWNLOADS!

Remember, you get F# out of the box as part of Visual Studio 2010 Beta1, or you can get a plug-in through the CTP Update for Visual Studio 2008 or as a standalone compiler ZIP, for Mono / Windows.

VN:F [1.8.3_1051]
Rating: 3.2/5 (7 votes cast)
VN:F [1.8.3_1051]
Rating: +1 (from 1 vote)
What & Why Choose F#?3.257
Bookmark and Share
kick it on DotNetKicks.com
Shout it

NOW, FOR A WORD FROM OUR SPONSORS

4 Comments

  1. Try nemerle. It is much better. And you are not bound to MS

    UN:F [1.8.3_1051]
    Rating: 3.0/5 (2 votes cast)
    UN:F [1.8.3_1051]
    Rating: 0 (from 2 votes)
    Posted on 11-Jun-09 at 9:07 am | Permalink
  2. Graham O'Neale

    Why is it much better?
    From initial glances I would prefer F#, the first code example is pretty much .NET 3.5 substituting def for var. Plus I don’t declare “new”? I don’t like that, even if it’s inferred.
    Although I won’t say much more past that point, the string interpolation and macros look interesting..

    UA:F [1.8.3_1051]
    Rating: 5.0/5 (1 vote cast)
    UA:F [1.8.3_1051]
    Rating: 0 (from 0 votes)
    Posted on 11-Jun-09 at 4:42 pm | Permalink
  3. assd

    Sorry to say, but Nemerle is dead. Guys ( from my university ), who were working on that project find themselves good jobs ( one works in MS on verified c compiler ), and don’t have so much time to work on Nemerle. Soon everyone will forget about that language

    UN:F [1.8.3_1051]
    Rating: 5.0/5 (1 vote cast)
    UN:F [1.8.3_1051]
    Rating: 0 (from 0 votes)
    Posted on 17-Jun-09 at 9:36 am | Permalink
  4. yeah nemerle is dead : http://code.google.com/p/nemerle/source/list

    The main thing compared to F# is it doesn’t have macros as nemerle do. Finally even on VS 2010 F# is second class. Can you write asp.net with F# ? (I mean the CodeDom stuff) I see no IDE support for it.

    UN:F [1.8.3_1051]
    Rating: 0.0/5 (0 votes cast)
    UN:F [1.8.3_1051]
    Rating: 0 (from 0 votes)
    Posted on 26-Jul-09 at 10:29 am | Permalink

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*
My name is Graham O'Neale and I'm a software architect from Gold Coast, Australia. I am an overtime thinker, full time coder and awake part time in the real world. I have a keen interest in software development, particularly in the realm of programming (C#, ASP.NET, ASP.NET MVC, LINQ (2 SQL), Entity Framework, Silverlight, Blend, WCF, WPF) and a keen interest in the cutting edge and innovation. I have a new found love for design patterns, ALT.NET practices and well crafted software architecture. The purpose of this blog is to express any thoughts, findings, tips and gripes along my travels in the wonderful world of coding and technology...