SRFI 232: An advanced currying form Arthur A. Gleckler (08 Jan 2022 02:21 UTC)
Re: SRFI 232: An advanced currying form Dr. Arne Babenhauserheide (08 Jan 2022 17:24 UTC)
Re: SRFI 232: An advanced currying form Marc Nieper-Wißkirchen (08 Jan 2022 18:26 UTC)
Re: SRFI 232: An advanced currying form Wolfgang Corcoran-Mathe (09 Jan 2022 18:45 UTC)
Re: SRFI 232: An advanced currying form Marc Nieper-Wißkirchen (09 Jan 2022 21:56 UTC)
Re: SRFI 232: An advanced currying form Wolfgang Corcoran-Mathe (13 Jan 2022 22:37 UTC)
Re: SRFI 232: An advanced currying form Marc Nieper-Wißkirchen (14 Jan 2022 07:24 UTC)
Re: SRFI 232: An advanced currying form Wolfgang Corcoran-Mathe (18 Jan 2022 19:30 UTC)
Re: SRFI 232: An advanced currying form Marc Nieper-Wißkirchen (19 Jan 2022 00:44 UTC)
Re: SRFI 232: An advanced currying form John Cowan (16 Jan 2022 18:29 UTC)
Re: SRFI 232: An advanced currying form Marc Nieper-Wißkirchen (16 Jan 2022 18:52 UTC)
Re: SRFI 232: An advanced currying form Marc Nieper-Wißkirchen (16 Jan 2022 19:01 UTC)
Re: SRFI 232: An advanced currying form John Cowan (20 Jan 2022 06:21 UTC)
Re: SRFI 232: An advanced currying form Wolfgang Corcoran-Mathe (18 Jan 2022 18:28 UTC)
Re: SRFI 232: An advanced currying form Wolfgang Corcoran-Mathe (18 Jan 2022 18:38 UTC)
Re: SRFI 232: An advanced currying form Marc Nieper-Wißkirchen (18 Jan 2022 19:00 UTC)
Re: SRFI 232: An advanced currying form Wolfgang Corcoran-Mathe (18 Jan 2022 21:22 UTC)
Re: SRFI 232: An advanced currying form Marc Nieper-Wißkirchen (18 Jan 2022 22:18 UTC)
Re: SRFI 232: An advanced currying form Marc Nieper-Wißkirchen (19 Jan 2022 07:47 UTC)
Re: SRFI 232: An advanced currying form Marc Nieper-Wißkirchen (19 Jan 2022 20:55 UTC)
Re: SRFI 232: An advanced currying form Wolfgang Corcoran-Mathe (24 Jan 2022 23:08 UTC)
Re: SRFI 232: An advanced currying form Marc Nieper-Wißkirchen (26 Jan 2022 13:29 UTC)
Re: SRFI 232: An advanced currying form Wolfgang Corcoran-Mathe (31 Jan 2022 21:42 UTC)
Re: SRFI 232: An advanced currying form Dr. Arne Babenhauserheide (09 Jan 2022 01:35 UTC)
Re: SRFI 232: An advanced currying form John Cowan (16 Jan 2022 18:15 UTC)
Re: SRFI 232: An advanced currying form Wolfgang Corcoran-Mathe (09 Jan 2022 18:47 UTC)

Re: SRFI 232: An advanced currying form Marc Nieper-Wißkirchen 08 Jan 2022 18:26 UTC

Guile's lambda* seems to come from SRFI 89's lambda*. I agree with
Arne that a different name should be chosen for SRFI 232.

That said, I am far from being convinced that SRFI 232 is a good idea:

(1) Do we really need to make this type of currying easier in Scheme?
The rationale cites ML and Haskell. These two languages are, however,
languages where procedures only take single arguments. In Scheme, this
is not the case. I would like to see a real-world use case where the
proposed form actually makes the resulting code easier to understand
(and to write). The SRFI also cites the cut form from SRFI 26, but
that's not about currying but fixing various arguments. Only if the
argument to be fixed comes first, SRFI 26 can be emulated with
currying; moreover, SRFI 26 can deal with arbitrary procedures and not
only procedures defined through lambda*. So I don't really think that
SRFI 26 and SRFI 232 are related much and that the existence of SRFI
26 is not really an argument in favor of SRFI 232.

(2) My biggest complaint about the lambda* form is that the behavior
is irregular. If I apply as many arguments as there are formals, it
would make as much sense to return a thunk. The arbitrariness at such
limit points is a source for future programming errors. Another
discontinuity is at the border between returning a value and applying
the excess arguments to the resulting values. While it looks elegant,
the lambda* form confounds three things.

(3) We need benchmarks on whether replacing lambda by lambda* affects
runtime (much) and whether calling the procedures resulting from
partially applying lambda* are as fast as hand-written procedures (or
those returned by SRFI 26).

Note that (2) doesn't apply to Haskell because there every procedure
takes exactly one argument.

Marc

Am Sa., 8. Jan. 2022 um 18:24 Uhr schrieb Dr. Arne Babenhauserheide
<xxxxxx@web.de>:
>
>
> "Arthur A. Gleckler" <xxxxxx@speechcode.com> writes:
> >  Scheme lacks a flexible way to create and apply curried procedures. This SRFI describes lambda*, a variant of lambda that creates true curried procedures which also behave just like ordinary Scheme procedures. They can be
> >  applied to their arguments one-by-one, all at once, or anywhere in between, without any novel syntax. lambda* also supports nullary and variadic procedures, and procedures created with it have predictable behavior when
> >  applied to surplus arguments.
>
> The examples look really good!
>
> However lambda* is already defined in Guile as a lambda, that can take
> keyword arguments.
>
> ((lambda* (a b #:optional c #:key d)
>    (list a b c d)) 1 2 #:d 'd)
>
> Best wishes,
> Arne
> --
> Unpolitisch sein
> heißt politisch sein,
> ohne es zu merken.
> http://draketo.de