Skip to content

Instantly share code, notes, and snippets.

@julianhyde
Last active July 30, 2025 22:59
Show Gist options
  • Save julianhyde/38ab34c171f47a0e1afff9fccb348b91 to your computer and use it in GitHub Desktop.
Save julianhyde/38ab34c171f47a0e1afff9fccb348b91 to your computer and use it in GitHub Desktop.
History of lambda syntax in programming languages

History of lambda syntax in programming languages

Language Syntax Alternate(s)
Lisp 1960 (lambda (x) (+ x 1))
Smalltalk 1972 [ :x | x + 1 ]
ML 1973 fn x => x + 1
Erlang 1987 fun(X) -> X + 1 end
Haskell 1990 \ x -> x + 1 (+ 1)
Python 1993 lambda x: x + 1
Perl 1994 sub { $_[0] + 1 } sub { my $x = shift; $x + 1 }
JavaScript 1995 function(x) { return x + 1; } x => x + 1
Ruby 1995 proc { |x| x + 1 } lambda { | x | x + 1 }
->(x) { x + 1 }
OCaml 1996 fun x -> x + 1 (+) 1
Groovy 2003 { x -> x + 1 }
Scala 2003 x => x + 1 _ + 1
MATLAB 2004 @(x) x + 1
C# 2005 delegate (int x) { return x + 1; } x => x + 1
Clojure 2007 (fn \[x\] (+ x 1)) #(+ % 1) (partial + 1)
Go 2009 func(x int) int { return x + 1 }
Rust 2010 |x| x + 1
Dart 2011 (x) => x + 1
Elixir 2011 fn x -> x + 1 end &(&1 + 1)
Kotlin 2011 { x -> x + 1 }
C++ (11+) 2011 [](int x) { return x + 1; }
Julia 2012 x -> x + 1
Swift 2014 { x in x + 1 } {$0 + 1}
Java (8+) 2014 x -> x + 1

I have omitted languages in the same family with the same syntax, e.g. {Lisp, Scheme, Racket}, {OCaml, F#}, {ML, Standard ML}. The year given is the year of introduction of the main syntax; alternative syntaxes usually came later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment