bind/list implementation Shiro Kawai (06 Jan 2023 07:55 UTC)
Re: bind/list implementation Shiro Kawai (06 Jan 2023 07:56 UTC)
Re: bind/list implementation Marc Nieper-Wißkirchen (06 Jan 2023 08:14 UTC)
Re: bind/list implementation Shiro Kawai (06 Jan 2023 08:16 UTC)
Re: bind/list implementation Arthur A. Gleckler (06 Jan 2023 14:50 UTC)
Re: bind/list implementation Arthur A. Gleckler (09 Jan 2023 14:59 UTC)
(missing)
(missing)
Re: bind/list implementation Arthur A. Gleckler (17 Jan 2023 04:47 UTC)

Re: bind/list implementation Marc Nieper-Wißkirchen 06 Jan 2023 08:14 UTC

Shiro,

Thank you for this observation. Can you also send a PR with your
correct implementation?

Marc

Am Fr., 6. Jan. 2023 um 08:55 Uhr schrieb Shiro Kawai <xxxxxx@gmail.com>:
>
> bind/list description specifies that the final transducer is tail-called.  However, the sample implementation (both in the srfi text and reference implementation) doesn't seem to do so.
>
>    (define (bind/list lis . transducers)
>       (list-values (fold (lambda (transducer lis)
>                            (list/mv (apply transducer lis)))
>                          lis transducers)))
>
> A possible implementation can be:
>
> (define bind/list
>   (case-lambda
>     [(lis) (list-values lis)]
>     [(lis transducer) (apply transducer lis)]
>     [(lis transducer . transducers)
>      (apply bind/list (list/mv (apply transducer lis)) transducers)]))
>
>