encyclopegia.org

LFE (programming language)

Lisp Flavored Erlang (LFE) is a functional, concurrent, garbage collected, general-purpose programming language and Lisp dialect built on Core Erlang and the Erlang virtual machine (BEAM). LFE builds on Erlang to provide a Lisp syntax for writing distributed, fault-tolerant, soft real-time, non-stop applications. LFE also extends Erlang to support metaprogramming with Lisp macros and an improved developer experience with a feature-rich read–eval–print loop (REPL). LFE is actively supported on all recent releases of Erlang; the oldest version of Erlang supported is R14.

Lisp Flavored Erlang (LFE) is a functional, concurrent, garbage collected, general-purpose programming language and Lisp dialect built on Core Erlang and the Erlang virtual machine (BEAM). LFE builds on Erlang to provide a Lisp syntax for writing distributed, fault-tolerant, soft real-time, non-stop applications. LFE also extends Erlang to support metaprogramming with Lisp macros and an improved developer experience with a feature-rich read–eval–print loop (REPL). LFE is actively supported on all recent releases of Erlang; the oldest version of Erlang supported is R14. (* (+ 1 2 3 4 5 6) 2) 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. 1> {Len,Status,Msg} = {8,ok,"Trillian"}. {8,ok,"Trillian"} 2> Msg. "Trillian" LFE: lfe> (set (tuple len status msg) #(8 ok "Trillian")) lfe> ;; or with LFE literal tuple syntax: lfe> (set `#(,len ,status ,msg) #(8 ok "Trillian")) #(8 ok "Trillian") lfe> msg "Trillian" 1> [trunc(math:pow(3,X)) || X LFE: lfe> (list-comp (( Or idiomatic functional style: lfe> (lists:map (lambda (x) (trunc (math:pow 3 x))) '(0 1 2 3)) (1 3 9 27) right_number(X) when X == 42; X == 276709 -> true; right_number(_) -> false. LFE: (defun right-number? ((x) (when (orelse (== x 42) (== x 276709))) 'true) ((_) 'false)) sum(L) -> sum(L,0). sum([], Total) -> Total; sum([H|T], Total) -> sum(T, H+Total). LFE: (defun sum (l) (sum l 0)) (defun sum (('() total) total) (((cons h t) total) (sum t (+ h total)))) or using a ``cons`` literal instead of the constructor form: (defun sum (l) (sum l 0)) (defun sum (('() total) total) ((`(,h . ,t) total) (sum t (+ h total)))) handle_info(ping, #state {remote_pid = undefined} = State) -> gen_server:cast(self(), ping), {noreply, State}; handle_info(ping, State) -> {noreply, State}; LFE: (defun handle_info (('ping (= (match-state remote-pid 'undefined) state)) (gen_server:cast (self) 'ping) `#(noreply ,state)) (('ping state) `#(noreply ,state))) universal_server() -> receive {become, Func} -> Func() end. LFE: (defun universal-server () (receive ((tuple 'become func) (funcall func)))) or: (defun universal-server () (receive (`#(become ,func) (funcall func)))) (io:format "Hello, World!") (defun ackermann ((0 n) (+ n 1)) ((m 0) (ackermann (- m 1) 1)) ((m n) (ackermann (- m 1) (ackermann m (- n 1))))) Composing functions: (defun compose (f g) (lambda (x) (funcall f (funcall g x)))) (defun check () (let* ((sin-asin (compose #'sin/1 #'asin/1)) (expected (sin (asin 0.5))) (compose-result (funcall sin-asin 0.5))) (io:format "Expected answer: ~p~n" (list expected)) (io:format "Answer with compose: ~p~n" (list compose-result)))) (defmodule messenger-back (export (print-result 0) (send-message 2))) (defun print-result () (receive ((tuple pid msg) (io:format "Received message: '~s'~n" (list msg)) (io:format "Sending message to process ~p ...~n" (list pid)) (! pid (tuple msg)) (print-result)))) (defun send-message (calling-pid msg) (let ((spawned-pid (spawn 'messenger-back 'print-result ()))) (! spawned-pid (tuple calling-pid msg)))) Multiple simultaneous HTTP requests: (defun parse-args (flag) "Given one or more command-line arguments, extract the passed values. For example, if the following was passed via the command line: $ erl -my-flag my-value-1 -my-flag my-value-2 One could then extract it in an LFE program by calling this function: (let ((args (parse-args 'my-flag))) ... ) In this example, the value assigned to the arg variable would be a list containing the values my-value-1 and my-value-2." (let ((`#(ok ,data) (init:get_argument flag))) (lists:merge data))) (defun get-pages () "With no argument, assume 'url parameter was passed via command line." (let ((urls (parse-args 'url))) (get-pages urls))) (defun get-pages (urls) "Start inets and make (potentially many) HTTP requests." (inets:start) (plists:map (lambda (x) (get-page x)) urls)) (defun get-page (url) "Make a single HTTP request." (let* ((method 'get) (headers '()) (request-data `#(,url ,headers)) (http-options ()) (request-options '(#(sync false)))) (httpc:request method request-data http-options request-options) (receive (`#(http #(,request-id #(error ,reason))) (io:format "Error: ~p~n" `(,reason))) (`#(http #(,request-id ,result)) (io:format "Result: ~p~n" `(,result))))))

References

  1. Lisp Flavored Erlang · retrieved 2014-01-16 · rev 1368732736
    Cite this reference

    MLA "Lisp Flavored Erlang." Virding, Robert. 2014-01-16. http://www.erlang-factory.com/upload/presentations/61/Robertvirding-LispFlavouredErlang.pdf. Accessed 24 November 2026.

    Chicago "Lisp Flavored Erlang." Virding, Robert. 2014-01-16. http://www.erlang-factory.com/upload/presentations/61/Robertvirding-LispFlavouredErlang.pdf.

    APA Virding, Robert. (2014). Lisp Flavored Erlang. Retrieved November 24, 2026, from http://www.erlang-factory.com/upload/presentations/61/Robertvirding-LispFlavouredErlang.pdf

  2. LFE announcement on Erlang Questions mail list · retrieved 2014-01-16 · rev 1368732736
    Cite this reference

    MLA "LFE announcement on Erlang Questions mail list." 2014-01-16. https://groups.google.com/d/msg/erlang-questions/rf43UofUvvQ/2-L1AecnkUoJ. Accessed 24 November 2026.

    Chicago "LFE announcement on Erlang Questions mail list." 2014-01-16. https://groups.google.com/d/msg/erlang-questions/rf43UofUvvQ/2-L1AecnkUoJ.

    APA encyclopegia.org. (2014). LFE announcement on Erlang Questions mail list. Retrieved November 24, 2026, from https://groups.google.com/d/msg/erlang-questions/rf43UofUvvQ/2-L1AecnkUoJ

  3. Follow-up to LFE announcement on Erlang Questions mail list · retrieved 2014-01-16 · rev 1368732736
    Cite this reference

    MLA "Follow-up to LFE announcement on Erlang Questions mail list." 2014-01-16. https://groups.google.com/d/msg/erlang-questions/rf43UofUvvQ/dthHortHwGoJ. Accessed 24 November 2026.

    Chicago "Follow-up to LFE announcement on Erlang Questions mail list." 2014-01-16. https://groups.google.com/d/msg/erlang-questions/rf43UofUvvQ/dthHortHwGoJ.

    APA encyclopegia.org. (2014). Follow-up to LFE announcement on Erlang Questions mail list. Retrieved November 24, 2026, from https://groups.google.com/d/msg/erlang-questions/rf43UofUvvQ/dthHortHwGoJ

  4. LFE History on the Lisp Flavored Erlang mail list · retrieved 2014-05-27 · rev 1368732736
    Cite this reference

    MLA "LFE History on the Lisp Flavored Erlang mail list." a b c "LFE History on the Lisp Flavored Erlang mail list". 2014-05-27. https://groups.google.com/d/msg/lisp-flavoured-erlang/XA5HeLbQQDk/TUHabZCHXB0J. Accessed 24 November 2026.

    Chicago "LFE History on the Lisp Flavored Erlang mail list." a b c "LFE History on the Lisp Flavored Erlang mail list". 2014-05-27. https://groups.google.com/d/msg/lisp-flavoured-erlang/XA5HeLbQQDk/TUHabZCHXB0J.

    APA a b c "LFE History on the Lisp Flavored Erlang mail list". (2014). LFE History on the Lisp Flavored Erlang mail list. Retrieved November 24, 2026, from https://groups.google.com/d/msg/lisp-flavoured-erlang/XA5HeLbQQDk/TUHabZCHXB0J

  5. Hardware used in the development of Erlang and LFE · retrieved 2014-01-16 · rev 1368732736
    Cite this reference

    MLA "Hardware used in the development of Erlang and LFE." a b Armstrong, Joe; Virding, Robert (2013-12-30). 2014-01-16. http://www.erlang.org/course/history.html. Accessed 24 November 2026.

    Chicago "Hardware used in the development of Erlang and LFE." a b Armstrong, Joe; Virding, Robert (2013-12-30). 2014-01-16. http://www.erlang.org/course/history.html.

    APA a b Armstrong, Joe; Virding, Robert (2013-12-30). (2014). Hardware used in the development of Erlang and LFE. Retrieved November 24, 2026, from http://www.erlang.org/course/history.html

Cite this article

MLA

"LFE (programming language)." encyclopegia.org, 2026, https://encyclopegia.org/wiki/lfe-programming-language. Accessed 24 November 2026.

Chicago

"LFE (programming language)." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/lfe-programming-language.

APA

encyclopegia.org. (2026). LFE (programming language). Retrieved November 24, 2026, from https://encyclopegia.org/wiki/lfe-programming-language

Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON

CC BY-SA 4.0 · share-alike · https://en.wikipedia.org/w/index.php?oldid=1368732736 · 0.5 · snapshot enwiki-001368732736

Cite · JSON · Search

Related services and records

Services

  • Estate — measured countries, lanes and facts
  • Intel — live corroborated events
  • Legal — statutes, cases and citations
  • Encyclopedia — articles with inline sources
  • Space — launches, satellites and orbits
  • Search — federated search and reports
  • Pass — passport account and SSO
  • Corpora — read-only corpus origins
  • e01 — self-hosted corpora and tools

Text and metadata only; each target carries its own sources. Missing data is published as no-data, never estimated.