I see a lot of people talking about how cool functional programming is, how awesome Lisp and Haskell and F# are, etc, but what I don't see is them actually being used. Just about every program on my computer is written in either something in the C family, Delphi, or Python. I see tutorials talking about how easy it is to use functional languages to do complicated math problems, but no one talking about using them to do things most people actually care about using computers for, like business applications and games.

Does anyone have any examples of actual programs that people have heard of and are using, written in a functional language? The only one I can think of off the top of my head is Abuse, from almost 15 years ago. (Things like Emacs, where the core program is written in C with a functional language scripting layer on top, don't count.)

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center.

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3

I think you're confusing functional programming with functional languages. For instance, I've successfully applied a lot of functional programming concepts from Real World Functional Programming using C#. The language now has a lot of functional features.
–
Scott WhitlockNov 28 '10 at 17:12

Some vital parts of the New York Stock Exchange run on Scheme. You may not have "heard of" it, but you probably "used" it!
–
MacneilNov 28 '10 at 18:02

2

if that was really true, pure FP would have taken over the world already on merit alone. The expressiveness of a language is only one part of the productivity equation. A language must also have good libraries and adequate support for I/O, both of which are common criticisms of Lisp specifically, and pure functional languages in general. This makes functional languages good for some problem domains, but not so good for others. By contrast, imperative languages are the "swiss army knife;" getting the job done may not be pretty, but it will get done.
–
Robert HarveyNov 28 '10 at 18:34

12

When did any programming language ever "take over the world on merit alone"? In fact, when did anything take over the world on merit alone? Everything that ever took over the world did this either by accident, by marketing or by sheer luck. Java took over the world because CPU vendors wanted to screw Intel using the JVM, OS vendors wanted to screw Microsoft using the JVM, application vendors wanted to stay out of the OS and CPU fight using the JVM. Nobody actually cared about Java. It just happened to be bundled with the JVM.
–
Jörg W MittagNov 29 '10 at 3:27

5

Closed as a duplicate? What duplicate? I see the F# question noted above, but believe it or not, F# isn't the only functional programming language.
–
mipadiDec 1 '10 at 14:33

12 Answers
12

I don't know of a lot of games or end-user applications written in functional languages, though I'm sure there are some. Games and end-user applications, though an important and visible part of the software market, are only a part of it. Remember, there is huge amounts of software out there that you never see because it is orchestrating processes that don't have end-user application or game interfaces.

For example, F# is popular at Credit Suisse for quantitative analysis:

Erlang is in use at Facebook, Yahoo, and Amazon. It's also running embedded in Ericsson and Nortel ePBX (electronic Public Branch Exchange) telecom switches with ridiculous uptime. CouchDB is written in Erlang, as is ejabberd. There are more now, and more coming every day. Check out Totally Erlang for Erlang jobs to see who's working on what.

5. GOAL rules! Practically all of the run-time code (approximately half a
million lines of source code) was
written in GOAL (Game Object Assembly
Lisp [acronym correct?]), Naughty Dog's own internally
developed language, which was based on
the Lisp programming language. Before
you dismiss us as crazy, consider the
many advantages of having a custom
compiler.

Lisp has a very consistent, small set
of syntactic rules involving the
construction and evaluation of lists.
Lists that represent code are executed
by evaluating the items that are in
the list; if the head of the list is a
function (or some other action), you
could think of the other items in the
list as being the parameters to that
function. This simplicity of the Lisp
syntax makes it trivial to create
powerful macros that would be
difficult or impossible to implement
using C++.

A fascinating and scary comment comes from the last line of the Wikipedia article on GOAL: "GOAL's primary development and maintenance engineer is no longer available to Naughty Dog, and so they are transitioning to a C++ based pipeline for future projects." Which means that they bet their company on one programmer and when he quit they don't know how to deal with the language/framework he wrote.
–
TangurenaNov 28 '10 at 18:02

Very interesting stuff. Apparently you can change out code while the application is running, a feature reminiscent of Erlang.
–
Robert HarveyNov 28 '10 at 18:41

1

@Tangurena Good spot. It seems inconceivable that no-one would have thought to do an ongoing knowledge share/handover.
–
Gary RoweNov 28 '10 at 18:42

1

@Tangurena, nothing wrong in using a talented programmer - just see what John Carmack does - and it also appeared to have worked very well. The glitch here is that Naughty Dog forgot to have the knowledge shared across others. The socalled bus factor.
–
user1249Nov 28 '10 at 18:44

1

Interesting, but from the Wikipedia article it appears that the language is designed for imperative, object-oriented programming with little support for functional style or garbage collection. They basically re-implemented C++ in Lisp. (What would Greenspun say?!?)
–
Mason WheelerNov 28 '10 at 21:24

I was aware of this example, but the actual letter (as opposed to Paul Graham's claims about it) make it apparent that this one falls squarely in the Emacs category.
–
Mason WheelerNov 28 '10 at 17:24

If you say so. I doubt Orbitz would consider their creation a "scripting engine."
–
Robert HarveyNov 28 '10 at 17:28

Yeah, they probably wouldn't. But if it quacks like a duck...
–
Mason WheelerNov 28 '10 at 18:45

@Mason: This whole "Emacs doesn't count" exception is strange and makes the question less constructive. I think it could be improved.
–
MacneilNov 29 '10 at 0:12

4

@Mason Wheeler: the only part of GNU Emacs that is not written in ELisp is the ELisp VM. And that is only because of portability. The original versions of Emacs were written on Lisp Operating Systems which directly understand Lisp code, so they were 100% Lisp.
–
Jörg W MittagNov 29 '10 at 3:22

Functional Programming is not just limited to a particular language, its also a style of coding in my mind.

When I say style of course I'm ignoring the "pure" functional requirement of not including any states..

In that sense, I suspect its used a lot in daily situations.

Just to give you an example, in a recent project I used "functional" style of programming to transform URL's into dynamic Site-maps (tree structure) on the fly. This was done by breaking down the problem into smaller functions which was then composed together to create the final solution : Data In -> Function (F1+F2+Fn) -> Tree

I respect their effort, but to me Xmonad is a niche (a X11 window manager) in a niche (used on operating systems minus Windows/Mac). I am not sure whether mentioning Xmonad is not amplifying the impression that functional programming is a niche.
–
LennyProgrammersNov 30 '10 at 9:14

It's used in the industry by the minority that understand how and have the opportunity to use it. The majority of programmers won't understand recursion or things like first-class functions and that you can treat a function as a value and store it in a list. I'm not trying to sound elitist but the reality is the use of functional languages is limited because the vast majority of programmers can't get it. Sure lot's of people use Javascript but whether they use it in a functional way is another question.

Anyway here's a list of some organizations/people that use/used functional languages:

Paul Graham used Lisp to make a web store that got sold to Yahoo back in the day when Yahoo was king of the net.

Citrix use OCaml for the management tools for Xen.

The Halo team used F# internally

Fairly sure a lot of banks are using F# at the moment.

Ericsson use Erlang

But at the end of the day the language used makes little difference to the outcome of the project. The best programming language in the world won't save you from bad management implementing bad processes that have design and requirements proceeding for months and then expecting the 1000000 lines of documentation converted into working and tested code in 3 months.