allong.es
allong.es copied to clipboard
uncurry
Would this just be:
uncurry = (fn) -> return -> fn.apply @, arguments...
Something like that. If we have a very simple curry that works with functions taking two arguments:
curry = (fn) -> (x) -> (y) -> fn(x, y)
uncurry reverses the operation:
uncurry = (fn) -> (x, y) -> fn(x)(y)
Most of the currying in allong.es is self-uncurrying in that you can call things like map or getWith using either map(list)(fn) or map(list, fn). But I could add a variadic uncurry that can handle any number of arguments.