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.
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:
- succinct, type-inferred functional programming,
- interactive scripting like Python and other languages,
- the foundations for an interactive data visualization environment,
- the combination of type inference and safety, like that of ML,
- a cross-compiling core shared with the popular OCaml language,
- a performance profile like that of C#,
- easy access to the entire range of powerful .NET libraries and database tools,
- a foundational simplicity with similar roots to Scheme,
- the option of a top-rate Visual Studio integration, which is usable with the freely available Visual Studio 2008 Shell
- the experience of a first-class team of language researchers with a track record of delivering high-quality implementations,
- the speed of native code execution on the concurrent, portable, and distributed .NET Framework.
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:
- 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)
- Don Syme: Introduction to F#, Part 1 (14:26:00)
- Don Syme: Introduction to F#, Part 2 (23:07:00)
- I’m sure this would provide the best benefit, as it’s a PDC 2008 recording – An Introduction to Microsoft F# (78:37:00)
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: