4 ms·
The footnote was interesting. Instead of (lambda (x) (* x x)), Smalltalk writes [:x | x*x]. Apparently Church's original lambda notation was very close to tha
by thisrod 15y ago
The footnote was interesting. Instead of (lambda (x) (* x x)), Smalltalk writes [:x | x*x]. Apparently Church's original lambda notation was very close to that.
This helps more than you'd think. For example,
(if condition
(lambda () foo)
(lambda () bar))
is too verbose, but
(if condition [foo] [bar])
is fine. Simplifying lambda gives you lazy evaluation, and then you don't need syntax for conditionals.
- waterhouse 15y agoAn alternative solution: if you're willing to allow non-ASCII characters into your source code, then DrRacket provides a keyboard shortcut to insert a λ character. I'll illustrate with anonymous recursion. > (define sum (λ (n) ((λ (f) (f f n 0)) (λ (f n total) (if (zero? n) total (f f (- n 1) (+ n total))))))) > (sum 10) 55
- Jach 15y agoYou can go one step further and start giving things like color meaning. (example: http://www.colorforth.com/ide.html http://www.colorforth.com/ide.html written with colorForth http://www.colorforth.com/cf.htm http://www.colorforth.com/cf.htm ) Of course, alternatives should exist for someone to write on a US-keyboard in any editor. Clojure supports two ways to do anonymous closures, though neither of them use a lambda symbol.
- sneak 15y ago> if you're willing to allow non-ASCII characters into your source code Blasphemy.
- Raphael 15y agoYou could use any letter, really. Perhaps l or f.