News for hackers. Stuff that matters.
Re:Currying in JavaScript by ufo on Monday July 20, 2015 @09:40AM (#9915935)
Its possible to curry a variadic function if there is a way to know when you reached the last argument. For example, in a printf-like function you know the number of inputs once you parse the format string.

This example here is a function that sums a variadic list of non-zero numbers. The zero signals the end of the list.

http://pastebin.com/xQRbRcJe

Its certainly very weird though. I wouldn't recommend doing this in real programs.

There are no comments on this comment yet.