4 ms·
You can go one step further and make use of automatic function currying (such as in haskell) and just write: adder(x,y) -> x + y If you call adder with one ar
by emef 14y ago
You can go one step further and make use of automatic function currying (such as in haskell) and just write:
adder(x,y) -> x + y
If you call adder with one argument, you get the same behaviour as your makeAdder (returned closure), but if you call it with 2 args you get addition.
- Xcelerate 14y agoHaha yeah. I don't think CoffeeScript has support for that yet, but I believe LiveScript does. *I was mainly trying to point out something that is semantically equivalent but syntactically different.