Say I have a generic Proc
, Lambda
or method
which takes an optional second argument:
pow = -> (base, exp: 2) { base
curry
does not work with keyword arguments. A curried function is getting one parameter at a time, which is conceptually incompatible with "any order is fine" keyword arguments.curry
must know the exact arity. If you just call curry
with no arguments, it will ignore any optionals (in case of pow = -> (base, exp=2) { base**exp }
, same as curry(1)
). Use curry(2)
to force both parameters. A curried function can't know an optional parameter is following, and read the future to determine if it should execute or return a curried continuation.