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.
6
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.
15
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).
12