Saturday, November 17, 2007

Learning Functional Programming

comp.lang.functional recently carried an interesting thread on learning functional programming. Of course it has the usual recommendations in favor (and against as well) of learning Common Lisp, Scheme and Haskell as a starter. However, with Microsoft productizing F#, a variant of OCamL on .NET, the ML family has also been a strong contender these days. From the thread, talking of OCamL ..
It's generally regarded the C++ of the functional world: fast, practical, somewhat ugly. A lot less bloated, of course. It also boasts the OO paradigm (hence, the name) and direct imperative constructs where you see fit (rather than Haskell's insistence on purity via monads)...

OCaml is, above all a practical and pragmatic language. Companies like Jane St Capital (see the article in issue 7 of "The Monad Reader") and XenSource among others are using Ocaml for real world problems.

OCaml encourages you to write pure static single assignment functional code. However, when that is not enough, you can drop back to imperative coding and uses references (ie mutable variables). It even offers OO for situation when OO is needed ..

F# has certainly been been regarded as one of the better modern functional programming languages. Jon Harrop, of OCaml fame, has high regards for it, and he has been working on "porting" his OCaml book in F# ..
As a functional programming language, F# is among the best. It provides modern features like an expressive static type system, pattern matching and OOP as well as being practical. The F# language is also being pushing into the mainstream by Microsoft, who recently announced its productization.

I think the biggest plus in favor of F# is the committment of Microsoft to push it as a mainstream functional language on the .NET platform. Integrating F# as a fully supported language in Visual Studio will definitely add to the momentum in the language being used in mainstream enterprise applications.

Is the functional programming paradigm looking stronger than ever in being pushed to the mainstream development horizon ?


Anonymous said...

Jon Harrop is a troll. I would ignore his comments in relation to other languages than F# or OCaml. Please note that they are fine programming languages to learn though.

Radek said...

Although I am eager Haskeller I would recommend learning F# just because it integrates into .NET frame. Too bad haskell cannot do it so easly.

Flying Frog Consultancy Ltd. said...

Yes! F#'s new status as a mainstream programming language will surely have a knock-on effect for OCaml in the Linux and Mac OS X worlds.

We are interested in diversifying into other functional programming languages (mainly Haskell, Erlang and Scala) but OCaml and F# are far more popular at the moment, following Microsoft's announcement.

For example, the Ubuntu package popularity contest not only lists slightly more installs for OCaml development (ocaml-nox) than all Haskell implementations combined but also shows that the number of OCaml installations is growing faster (500 installs a month!). Finally, the number of run-time installs of OCaml (ocaml-base-nox) is several times larger because OCaml is a favorite functional programming language among open source developers.

So I agree completely that the future looks great for OCaml and F#!

Anonymous said...