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)]))
>
>