4 ms·
Agreed. I can't understand how something like function(x) {return function(f) {return f(x);};} can be considered easier to comprehend than λx. λf. f
by tmhedberg 14y ago
Agreed. I can't understand how something like
function(x) {return function(f) {return f(x);};}
can be considered easier to comprehend than
λx. λf. f x
- mamcx 14y agoNot everyone is used to read that math notation. Is like say: "Why put it in JS instead of assembler?". JS is probably the most universal language out there (at least in terms of widespread). I prefer this stuff in python. Less syntax, more clear. But then, is the same thing: You imagine your (math) syntax is better, I think is python, somebody will complain why not haskell, but js is more practical. Or, is just the one the OP like. That is probably the only and best reason.
- tmhedberg 14y ago> Not everyone is used to read that math notation. Agreed, but it doesn't take more than a couple of sentences to describe the entire syntax of the λ-calculus. It's not hard to pick it up even if you've never encountered it before. Contrast that with JavaScript, where even as someone who has written my fair share of it, my eyes tend to glaze over when they hit a string of `});}))());};`. Yet people happily write that sort of thing, then turn around and complain about nested parentheses in Lisp!
- mrspeaker 14y agoIn current Firefox nightlies (and soon everywhere (i.e. Firefox AND Chrome)) it's just: x => f => f(x) http://wiki.ecmascript.org/doku.php?id=harmony:arrow_function_syntax http://wiki.ecmascript.org/doku.php?id=harmony:arrow_functio...
- munificent 14y agoThe grouping of expressions is clearer to many readers in the JS example. Unless you've spent a decent amount of time grokking the lambda calculus, the second line could be any of: (λx. (λf. f)) x (λx. (λf. f) x) (λx. (λf. f x)) The lambda calculus notation is weird. Using "." to separate parameter and body is unusual. The scope of the body isn't obvious. JS is painfully verbose, but it's a verbose syntax many people have already put the time in to internalize.
- tome 14y agoPut the brackets in the lambda syntax then. It would be unambiguous and still clearer than the Javascript syntax.