3 ms·
I feel like it's OK not having rest args if you leave them out in order to support currying, but leaving both out seems really weird for a language that's tryin
by technomancy 11y ago
I feel like it's OK not having rest args if you leave them out in order to support currying, but leaving both out seems really weird for a language that's trying to be functional.
- kazinator 11y agoLeaving out rest args supports the syntactic sugar for currying, not currying itself. (Let's call that sugar OAIPA: omission of arguments is partial application.) Even syntaxes which have OAIPA can (and do) still have optional parentheses to exactly delimit the arguments of a call, and that notation can clearly support variadic args. Outside of explicit delimiting with parens, OAIPA can work on a variadic function up to its required arguments by considering it to be a function of exactly that number of arguments, and no more.
- yurrriq 11y agoWe can have rest args in LFE via something like (defmacro foo args (do 'something (with args))) where (and (>= (length args) 0) (=< (length args) 255)) Note the lack of parentheses around args in the defmacro form. Edit: Oops, Robert mentioned this, too.