3 ms·
Yes, although there is one subtlety here: should `flip` return a curried function, or an uncurried function? This isn't an issue in Haskell since it only has un
by ionfish 14y ago
Yes, although there is one subtlety here: should `flip` return a curried function, or an uncurried function? This isn't an issue in Haskell since it only has unary functions.
- Peaker 14y agoHaskell has tuples, so it could use an: (a, b) -> c representation. If the uniform/canonical way to use functions is defined to be curried, then flip can simply return them curried.
- masklinn 14y ago> Haskell has tuples, so it could use an: Which it does: curry :: ((a, b) -> c) -> a -> b -> c uncurry :: (a -> b -> c) -> (a, b) -> c
- walrus 14y agoHow about both? Udon.flip = function(f) { return function(x) { if(arguments.length > 1) { return f(arguments[1])(x); } return function(y) { return f(y)(x); }; }; };