Re: range->vector Marc Nieper-Wißkirchen 01 Sep 2020 17:37 UTC

PS For the final sample implementation, I would case-lambda-single out
the 0, 1, and 2-range case, for which more efficient (or even trivial)
implementations are possible. Especially the 2-range case will
probably be used much more than the rest.

Am Di., 1. Sept. 2020 um 19:36 Uhr schrieb Marc Nieper-Wißkirchen
<xxxxxx@nieper-wisskirchen.de>:
>
> Be aware that I haven't run it. :)
>
> Am Di., 1. Sept. 2020 um 19:34 Uhr schrieb Wolfgang Corcoran-Mathe
> <xxxxxx@sigwinch.xyz>:
> >
> > On 2020-09-01 19:27 +0200, Marc Nieper-Wißkirchen wrote:
> > > Thanks!
> > >
> > > What is the status of
> > >
> > > (define (range-append . ranges)
> > >   (let ((lens (map range-length ranges)))
> > >     (range (fold + 0 lens)
> > >               (lambda (i)
> > >                 (let f ((i i) (ranges ranges) (lens lens))
> > >                   (if (< i (car lens)) (range-ref (car ranges) i) (f
> > > (- i (car lens)) (cdr ranges) (cdr lens)))))))
> >
> > Nice implementation!  Added in my repository.
> >
> > --
> > Wolfgang Corcoran-Mathe  <xxxxxx@sigwinch.xyz>
> >
> > "The intellectual advancement of man depends on how often he can
> > exchange an old superstition for a new truth." --Robert G. Ingersoll