Just a little survey of what code to create an anonymous function and immediately call it looks like in a handful of high-level languages. All of these expressions should evaluate to 10.
| Language | Code |
|---|---|
| Python | (lambda x: x+1)(9) |
| Ruby | (lambda {|x| x+1}).call(9) |
| Lua | (function(x) return x+1 end)(9) |
| Erlang | (fun(X) -> X+1 end)(9) |
| Haskell | (\x -> x+1)(9) |
| Scheme | ((lambda (x) (+ x 1)) 9) |
| Perl | (sub { @_[0]+1 })->(9) |
| Julia | (x -> x+1)(9) |
| ES5 JavaScript | (function(x) { return x+1 })(9) |
| ES6 JavaScript | (x => x+1)(9) |