Skip to content

Instantly share code, notes, and snippets.

@Hirurg103
Last active August 29, 2015 14:17
Show Gist options
  • Save Hirurg103/8ce270d406765db2ad18 to your computer and use it in GitHub Desktop.
Save Hirurg103/8ce270d406765db2ad18 to your computer and use it in GitHub Desktop.
curryN = (f, n) ->
if n <=1
f
else
(firstArg) ->
curryN(
->
f.apply null, [firstArg].concat Array.prototype.slice.call(arguments),
n-1
)
curry = (f)->
curryN(f, f.length)
f = (a, b, c, d, e) -> a.toString() + " + " + b.toString() + " + " + c.toString() + " + " + d.toString() + " + " + e.toString()
curryF = curry f
alert curryF(1)(1)(2)(10)(12)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment