Re: Multiple ranges for range-fold, range-for-each, ...
Marc Nieper-WiÃkirchen 31 Aug 2020 17:53 UTC
Am Mo., 31. Aug. 2020 um 18:35 Uhr schrieb Wolfgang Corcoran-Mathe
<xxxxxx@sigwinch.xyz>:
>
> On 2020-08-31 10:49 +0200, Marc Nieper-Wißkirchen wrote:
> > I just noticed that "range-for-each", "range-fold", ... only take a
> > single range argument. (*)
> >
> > [snip]
> >
> > For consistency and to increase the applicability of ranges, I,
> > therefore, suggest allowing all these procedures to take more than one
> > range argument.
>
> Agreed, this is definitely conventional, and preferable. Here are
> the procedures I've found that should take one or more range
> arguments:
>
> * range-for-each
> * range-map
> * range-fold
> * range-fold-right
>
> Let me know if I missed any. The range-FUNC->{list, vector} functions
> could presumably take multiple ranges as well.
* range-count
* range-any
* range-every
* range-index
* range-index-right
And what about "range-filter-map"? (See SRFI 1).
> > Speaking of this, wouldn't range=? be a plausible addition as well?
>
> Yes, if an extensional notion of range equality (i.e. converting all
> range arguments to lists or vectors and comparing those) is acceptable.
In my proposal, range=? receives a =? predicate to compare the values.
> range-append is also plausible, now.
+1 and quite useful.
As in
(range-append (numeric-range 0 10) (numeric-range 10 100 10))
-- Marc