3 ms·
We cannot call that foo as (foo) either, so we have nothing. We have to do something in foo to make currying work. If (foo 1) is required to return a unary func
by kazinator 10y ago
We cannot call that foo as (foo) either, so we have nothing. We have to do something in foo to make currying work. If (foo 1) is required to return a unary function, of course we support (foo 1 2) which passes 2 to that function.
Here is the problem case:
(defun foo (x)
(unknown x))
Suppose unknown can return a function of any number of arguments. The developer of foo doesn't know how many.
If it returns a five-argument function, you expect the call (foo 1 2 3 4 5 6) to work.
Basically, we can make foo n-ary such that it calls unknown with the first arg, and passes the rest to the function that unknown returns.
A subtlety not mentioned in the thread is that (x) and x are distinct in Lisps. Applying an empty argument list is different from not applying arguments.