3 ms·
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 numb
by ufo 11y ago
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 http://pastebin.com/xQRbRcJe
Its certainly very weird though. I wouldn't recommend doing this in real programs.