Initial work on LFE began in 2007, when Robert Virding started creating a prototype of Lisp running on Erlang.2 This work was focused primarily on parsing and exploring what an implementation might look like. No version control system was being used at the time, so tracking exact initial dates is somewhat problematic.3
Virding announced the first release of LFE on the Erlang Questions mail list in March 2008.4 This release of LFE was very limited: it did not handle recursive letrecs, binarys, receive, or try; it also did not support a Lisp shell.5
Initial development of LFE was done with version R12B-0 of Erlang6 on a Dell XPS laptop.7
Robert Virding has stated that there were several reasons why he started the LFE programming language:8
Like Lisp, LFE is an expression-oriented language. Unlike non-homoiconic programming languages, Lisps make no or little syntactic distinction between expressions and statements: all code and data are written as expressions. LFE brought homoiconicity to the Erlang VM.
In LFE, the list data type is written with its elements separated by whitespace, and surrounded by parentheses. For example, (list 1 2 'foo) is a list whose elements are the integers 1 and 2, and the atom [[foo|foo]]. These values are implicitly typed: they are respectively two integers and a Lisp-specific data type called a symbolic atom, and need not be declared as such.
As seen in the example above, LFE expressions are written as lists, using prefix notation. The first element in the list is the name of a form, i.e., a function, operator, or macro. The remainder of the list are the arguments.
The LFE-Erlang operators are used in the same way. The expression
evaluates to 42. Unlike functions in Erlang and LFE, arithmetic operators in Lisp are variadic (or n-ary), able to take any number of arguments.
LFE has lambda, just like Common Lisp. It also, however, has lambda-match to account for Erlang's pattern-matching abilities in anonymous function calls.
This section does not represent a complete comparison between Erlang and LFE, but should give a taste.
Erlang:
LFE:
Or idiomatic functional style:
or using a ``cons`` literal instead of the constructor form:
or:
Calls to Erlang functions take the form (<module>:<function> <arg1> ... <argn>):
Using recursion to define the Ackermann function:
Composing functions:
Message-passing with Erlang's light-weight "processes":
Multiple simultaneous HTTP requests:
Virding, Robert. "Lisp Flavored Erlang" (PDF). Erlang Factory. Retrieved 2014-01-17. http://www.erlang-factory.com/upload/presentations/61/Robertvirding-LispFlavouredErlang.pdf ↩
"LFE History on the Lisp Flavored Erlang mail list". Retrieved 2014-05-28. https://groups.google.com/d/msg/lisp-flavoured-erlang/XA5HeLbQQDk/TUHabZCHXB0J ↩
"LFE announcement on Erlang Questions mail list". Retrieved 2014-01-17. https://groups.google.com/d/msg/erlang-questions/rf43UofUvvQ/2-L1AecnkUoJ ↩
Armstrong, Joe; Virding, Robert (2013-12-30). "Hardware used in the development of Erlang and LFE" (Email exchange). Interviewed by Duncan McGreggor. Retrieved 2014-01-17. http://www.erlang.org/course/history.html ↩
"Follow-up to LFE announcement on Erlang Questions mail list". Retrieved 2014-01-17. https://groups.google.com/d/msg/erlang-questions/rf43UofUvvQ/dthHortHwGoJ ↩