| I'm not saying terseness is an inherent virtue, I'm just saying it be like it is. | |
| -- Lua | |
| local counter_once = (function() local x = 41; return function() x = x + 1; return x; end end)()() | |
| // Old JavaScript | |
| var counterOnce = (function () { var x = 41; return (function () { x++; return x; })})()() | |
| ;; Emacs Lisp | |
| (let ((counter-once (funcall (lexical-let ((x 41)) (lambda () (setq x (1+ x)) x)))))) | |
| // C# | |
| var counterOnce = new Func<Func<int>>(() => { var x = 41; return (() => ++x);})()(); | |
| // C++14 | |
| auto counterOnce = []() {auto x = 41; return [&x]() { ++x; return x; };}()(); | |
| ;; Racket Scheme | |
| (let [(counter-once ((let [(x 41)] (lambda () (set! x (+ 1 x)) x))))]) | |
| // Modern Javascript | |
| let counterOnce = (() => { let x = 41; return (() => ++x)})()() | |
| // MichaelScript | |
| let counter_once = fn () { let x = 41; fn() do x += 1 }()() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment