Which Functional Language To Learn

I know I've asked this question before, but I'm still not sure. Which of the FunctionalProgrammingLanguages would you suggest learning? Right now I'm vacillating between Scheme [SchemeLanguage] (it's widely used), Haskell [HaskellLanguage] (it has LazyEvaluation), or ObjectiveCaml (it's fast and not so obscure as scheme). Anyone have any suggestions on this account? Perhaps I'm overlooking certain other possibilities? -- ChristophePoucet?

The three languages you list above differ with respect to their goals, semantics, and idioms: Scheme is StrictEvaluation, impure, DynamicallyTyped. Haskell is LazyEvaluation, pure, StaticallyTyped. ObjectiveCaml is strict, impure, statically typed. Neither is widely used in industry. So if you really have to ask, all I can say is that you will learn a lot from each of these languages.

(I'd like to add ErlangLanguage to the list of good candidates. It has StrictEvaluation and is impure in a very interesting way. It tends to arrange problems differently from most functional languages, encouraging a highly concurrent object-ish way of programming. And is very pragmatic.)

What do you mean by "impure"? See http://citeseer.nj.nec.com/sabry98what.html and http://www.google.com/search?q=impure+functional+language Hmm, as for being widely used in the industry, neither is Ruby [RubyLanguage]. But I have learned it recently and found good use for it (writing automated test scripts to test a 3-tier system). I guess it's because I'd like to learn something new (FunctionalProgramming) but not get stuck with some very nice looking study-system that can't accomplish a single thing in the RealWorld. I guess the standard questions hold... Hmm... how wide is their following, libraries? How about performance, which do you personally prefer and why? As for feel, I've taken a look at each of them and ObjectiveCaml and HaskellLanguage look pretty similar (except for one being lazy the other not ... tradeoffs here?). As for Scheme, the reason I'm considering it is because it's widely used and wellknown...but UGH the syntax.

All three languages have been successfully applied to RealWorld problems (see FunctionalProgrammingInTheRealWorld); the width of its following is probably not the best criterion to chose a language; performance is really a property of the implementation of a language and not of the language itself. However, reading the above I guess I'd start with ObjectiveCaml, which is fast, (moderately) widely applied, and comes with a growing number of libraries and bindings.

I personally find Haskell to be the most interesting language of the three you listed (it has the most interesting type system), but it really is more academically than practically oriented, and quite deliberately so.

I like Scheme for RapidPrototyping (HygienicMacros are nice!), it is clean and easily extensible. And I like the syntax. (I really enjoy editing source code on the level of expressions instead of individual lines. Of course you have to use a paren-aware editor. See EditingLispCode.) While the language itself is deliberately minimalistic, some of its implementations are rather complete with respect to libraries.

You really should learn all three languages, if only to educate yourself, to expand your computational horizon, and to enrich your personal intellectual tool chest.

Thank you very much for this info. And I know, you're right about expanding horizons. It's just that I've been trying to expand in so many different directions that it's getting a bit much (learned Ruby[RubyLanguage], took a look at Python [PythonLanguage], tried a hand at Smalltalk[SmalltalkLanguage] (SqueakSmalltalk), tried some Scheme (DrScheme)) for the last few weeks. Also considering the fact that I work, I don't have as many hours I'd wish to spend on learning.

While it's true that the more the merrier, sometimes more is just that... more. Some languages are just not as innovative as others and sometimes a set of languages are just too close to be worth the time of learning both. Take Ruby and Python for example, to me they are quite similar. I personally chose for Ruby because I found it cleaner, though I do miss the breadth of libraries that exist for Python. However having learned Ruby, I did not take the time to learn Python as well as there are many other things to be learned :). -- ChristophePoucet?

In that case, I'd recommend HaskellLanguage, which I consider the most 'functional' of the FunctionalProgrammingLanguages --ShaeErisson

Although it's true that HaskellLanguage is more 'functional' what bothers me with it w.r.t ObjectiveCaml is that you have to explicitly define the types of the methods. I know HaskellLanguage uses static typing, but so does ObjectiveCaml, but the second is able to figure out what types you're using -at- compile time thereby sparing you from having to define it yourself. Perhaps I'm wrong, but looking through the intro at www.haskell.org it seemed that you had to define the types of all functions. -- ChristophePoucet?

No, you don't have to define the types of all functions in Haskell, but it is considered good style for released code. Both ObjectiveCaml and Haskell use extended variants of the classic HindleyMilnerTypeInference algorithm. Explicitly declaring the types of Haskell functions is equivalent to writing .mli files in ObjectiveCaml -- neither is necessary, but they both aid in reading source code. Also, most programmers that I know write the functions without type declarations first, and when they're done, they use the compiler to figure out how to declare it.


I'm using JayScheme right now for a test harness. It uses the native Scheme facilities (quasiquotes, functions) to build SXML based on test data, converts that to XML, and uses the Java networking libraries to call an HTTP server. The responses (will) get parsed and run through a pattern matching library for verification. JayScheme can call any Java object, so there are many, many libraries available for it

I'm very interested in your test harness, as I'm doing essentially the same thing. Do you have source code I can look at? --NoelWelsh


I'd recommend Haskell. Lazy evaluation allows for some very interesting abstractions, mostly related to infinite data structures. Being pure, Haskell programs can be handled like mathematical equations. This makes it actually possible to prove properties of the program. Even if you never attempt a formal proof this regularity makes reasoning about programs a lot easier. All this is about as far as possible from your typical run-of-the-mill imperative language. All the while it is still possible to embed imperative, impure code in Haskell.

Of course all the abstraction comes at a cost. Haskell programs usually run slower than equivalent programs in say C or OCaml, by a factor of 2 to 10 I'd estimate. They also need more memory. But nowadays it is possible to interface Haskell to foreign libraries, so critical parts can always be coded in a different language, if performance really matters that much.

See also FunctoidsInCpp which has an implementation of a lot of the Haskell Prelude in CeePlusPlus.


If interests include the DotNet platform, there's MS's experimental EffSharp language, or NemerleLanguage (but Nemerle is more of "lets get some functional advantages into CeeSharp").

See also contrary opinion at WhyFunctionalProgrammingLanguagesArentMainstream


CategoryFunctionalProgramming CategoryProgrammingLanguageComparisons IwannaLearn


EditText of this page (last edited January 3, 2010) or FindPage with title or text search