As an Electronic Engineer, my programming experience started with Assembly and continue with PL/M, C, C++, Delphi, Java, C# among others (imperative programming is in my blood).

I'm interested in add to my previous knowledge, skills about functional programming, but all I've seen until now seems very obfuscated and esoteric.

Can you please answer me these questions?

1) What is the mainstream functional programming language today (I don't want to get lost myself studying a plethora of FP languages, just because language X has the feature Y)?

2) What was the first FP language (the Fortran of functional programming if you want)?

3) Finally, when talking about pure vs. non pure FP what are the mainstream languages of each category?

Thank you in advance


Tongue slightly in cheek, I'd answer: Lisp, Lisp, and Lisp.

For question number one, this is probably a controversial answer. People who are comfortable with the Microsoft development stack would, of course, consider F# to be more mainstream - after all, it's right there in your developer's tool chain, ready to be installed (or already there) on millions upon millions of PCs. The academic community is more excited about Haskell, but here also real-world usage is less than they would like to achieve. Telecom engineers swear by Erlang instead. But when taking all dialects together - Scheme for teaching and extension languages, Common Lisp for enterprise-size applications, Emacs lisp for the one true editor, Clojure for the cool young Java kids... they might just be the most-used predominantly functional language out there. (Note that programming language market share is an intensely politicized topic, and any answer you receive will be ripped to shreds by other opinions.)

Question two is easy. Unless you want to count the purely mathematical lambda calculus, Lisp was first - although it, too, was initially intended just as a mathematical modelling tool, it turned out to be easily implementable, and the rest is history. That was in the 1950s.

Question three: Common Lisp is decidedly non-pure, while Scheme more closely resembles pure axiomatic systems like Haskell, which rigorously separate side effects from computation. Again, questions about market share are always controversial, and Scheme is certainly not the purest FP language, just (I guess) the most used - even if much of this is due to cohorts of computer science freshmen. And Common Lisp is not the least-pure language either - I think all of the the various "Lisp on the JVM" tools are less pure, since leveraging the huge Java library ecosystem is one of their reasons for existence. If I were forced to guess, I'd say one of them will probably the next big winner in functional programming.

  • 4
    Why haven't you mentioned Ocaml and Scala? I think that both have extensive support for FP. – Giorgio Sep 30 '12 at 9:56
  • 1
    +1 for pointing out this: "programming language market share is an intensely politicized topic" – Giorgio Sep 30 '12 at 9:57
  • Scala markets itself explicitly as "multi-paradigm", i.e. it wants to be "OO" and "Imperative" and even "Scripting" just as much as "FP", so I didn't name it, but it's of course one of the "List on JVM" bunch. Ocaml is a bit of blind spot for me, sorry - I know it exists, but not much more. – Kilian Foth Sep 30 '12 at 10:03
  • 1
    I am learning Scala and, even though it is multi-paradigm, it offers full FP programming features (currying, tail-call optimization, etc) unlike languages like C# and C++ that only add some FP concept to the basic OOP model. Furthermore, AFAIK, F# is also an imperative (object-oriented?)-functional hybrid and Ocaml is object-oriented / functional: they encourage FP but you can fall back to imperative style when you need to optimize your code. I took a quick look at Ocaml and it seems a very mature language, it is used among other things in the financial sector. – Giorgio Sep 30 '12 at 10:10
  • F# is pretty much "OCaml.NET", but missing just enough features to annoy veteran OCaml programmers. :] As for purity (in the "no side effects" sense), I've seen a lot of material coming from Clojure folks that encourages roughly the same philosophy that Haskell enforces--despite running on the JVM, it seems more inclined to keep Java at arm's length rather than embracing it as Scala does. – C. A. McCann Oct 1 '12 at 15:58

1) What is the mainstream functional programming language today (I don't want to get lost myself studying a plethora of FP languages, just because language X has the feature Y)?

I'd be very hesitant to name a single one here. FP itself isn't really mainstream at all, so calling any FP language "mainstream" would be silly.

There are a few FP programming languages that seek contact with mainstream programming, e.g. Scala, F#, and Clojure, by piggy-backing on a mainstream platform (e.g. JVM or .NET), and there are a few mainstream programming languages with at least some degree of FP support (JavaScript being the most popular).

Within the realm of FP, Lisp (Common Lisp and Scheme being the most prominent dialects, with Clojure as a relative newcomer) is probably leading the pack in terms of number-of-users, as well as library and platform support. Unless of course you count JavaScript, which is surprisingly similar to Scheme in many ways (if you can look past the syntax).

2) What was the first FP language (the Fortran of functional programming if you want)?

Definitely Lisp. No doubt about that.

3) Finally, when talking about pure vs. non pure FP what are the mainstream languages of each category?

If you want really pure, there is actually very little choice - Haskell makes a point of being completely pure (the language itself: the runtime can and usually does execute impure actions), and there are a few experimental languages that follow a similar philosophy but differ from Haskell in various ways. AFAIK, the other ones all allow impure constructs in one way or another, some being more academic about it than others.

  • Clean (wiki.clean.cs.ru.nl/Clean) and Miranda (miranda.org.uk) are also pure but they are not as known as Haskell. – Giorgio Sep 30 '12 at 12:07
  • @Giorgio: That's why I didn't include them. There's an entire zoo of programming languages far off the mainstream, and I doubt any of these would make for a good dive-into-functional-programming choice. – tdammers Sep 30 '12 at 12:59
  • 2
    I never understood why they call Common Lisp functional language. – permeakra Sep 30 '12 at 15:48
  • @permeakra: We'd have to come up with a better definition of "functional language" than "language that allows a functional programming style" then. Common Lisp has what it takes to comfortably program in a functional idiom, which is more than you could say about C# or Python, for example. – tdammers Sep 30 '12 at 18:20
  • Hm. Well, I'd say that FPL must provide higher order functions, anonymous functions, partial application and tail-call optimization guarantees. The latter is necessary as many advanced FP techniques won't work without it, and CL lacks it. Scala, being built on top of JVM also has problems with it. Some lisp dialects does guarantee TCO, and may be considered proper FPL from this point of view – permeakra Sep 30 '12 at 18:59

1) There is none. Possible choices are F# (that comes from MS and integrates with Net framework), GHC Haskell (compiles to native code on several most popular platforms, bindings to many C and C++ libraries are available), scala (jvm choice, though it has limitations). For dynamic typing look onto Erlang (crossplatform, makes emphasis on concurrency, parallelism and network communications) and lisp descendants: clojure (for JVM platform), racket scheme (native code).

2)lambda calculus. It is only math model, though. The first implemented FP language was Lisp and later SASL.

3)For pure FPL it is currently haskell - the only widespread pure lazy FPL (though GHC dialect has impure features). For impure there is no clear leader. SML family is dying except F#, so I'd probably stick with F# (They say it has problems with Mono) or some Racket dialect.

In addition to Pure/Impure holywar beware of Static/Dynamic typing holywar. I clearly stay on Static side, but I'm well aware that many prefer Dynamics (lisp dialects, Erlang and so on).

  • Is Ocaml dying? – Giorgio Sep 30 '12 at 15:51
  • @Giorgio I think so. Well, it still does have quite a community, so it is not dead yet, but I doubt it has future. – permeakra Sep 30 '12 at 15:57
  • What do you mean "feature"? Or you wanted to say "future"? Anyway, it sounds like bad news. I took a look at it and I am planning to learn more because it seems interesting to me. Also, they claim it is very fast. – Giorgio Sep 30 '12 at 15:58
  • @Giorgio fixed. I'm not native speaker. – permeakra Sep 30 '12 at 15:59
  • Neither am I, therefore I thought it was some idiom I do not know of. :-) – Giorgio Sep 30 '12 at 16:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.