Re: New draft (#4) of SRFI 232: An advanced currying form
Wolfgang Corcoran-Mathe 24 Mar 2022 16:40 UTC
On 2022-03-23 20:23 +0100, Marc Nieper-Wißkirchen wrote:
> Wolfgang, can we check with each other whether the current behavior of
> (curried () ...) is regular before this is finalized? Shouldn't
> (curried () ...) return the evaluation of its body?
I'm not sure I understand. You're suggesting that (curried () 4)
should evaluate to 4?
By the current specification, 'curried' with an empty formals list
evaluates to a procedure which behaves like a vanilla thunk, but which
can also be applied to one or more objects; in this case, the body
is evaluated to a procedure which is invoked on the arguments. Hemann
comments: "We believe this is a natural extension of the behavior of
[curried] for functions of other arities, and maintains the behavior
of Scheme's λ when provided no arguments."
Your comment led me to something in the implementation which I don't
understand and which may be a bug. Lines 34–36 of srfi-232.scm:
((curried-1 () exp)
(lambda args
(if (null? args) exp (apply (exp) args))))
The invocation of the procedure body before applying it to the args
makes no sense to me, and contradicts the current semantics. These
lines are identical modulo naming to the paper's version, but I can't
find any explanation of this extra application. I *think* it's a
mistake and the SRFI semantics are right, but I'll investigate further.
--
Wolfgang Corcoran-Mathe <xxxxxx@sigwinch.xyz>