Re: Multiple ranges for range-fold, range-for-each, ...
Wolfgang Corcoran-Mathe 01 Sep 2020 23:50 UTC
On 2020-09-01 18:56 -0400, John Cowan wrote:
> On Mon, Aug 31, 2020 at 2:43 PM Wolfgang Corcoran-Mathe <xxxxxx@sigwinch.xyz>
> wrote:
>
> > And what about "range-filter-map"? (See SRFI 1).
> >
> > It's probably a good idea, since it's likely to be much more efficient
> > than the composition of range-map and range-filter.
> >
>
> But that isn't what SRFI 1 filter-map does. It invokes the mapper function
> and then discards all #f results.
I was referring to:
(range-filter values (range-map foo r))
which is equivalent to (range-filter-map foo r), but obviously less
efficient.
> In any case, this is fine for a list, but not so fine for a vector-like
> object, as the output would have to be accumulated in a list and then
> converted to a vector.
Agreed. I've added range-filter-map and range-filter-map->list, and
dropped range-filter-map->vector. On the same grounds, let's get rid
of range-{filter, remove}->vector.
--
Wolfgang Corcoran-Mathe <xxxxxx@sigwinch.xyz>
"There is no first attack in karate." --Inscription on a monument
to Gichin Funakoshi in Kamakura