Re: Eliminate numeric-range over inexact numbers?
Wolfgang Corcoran-Mathe 29 Aug 2020 17:29 UTC
On 2020-08-28 20:54 +0200, Marc Nieper-Wißkirchen wrote:
> Am Fr., 28. Aug. 2020 um 20:10 Uhr schrieb Wolfgang Corcoran-Mathe
> <xxxxxx@sigwinch.xyz>:
> >
> > On 2020-08-28 19:03 +0200, Marc Nieper-Wißkirchen wrote:
> > > And what do you think of my vector->range proposal? I find it rather obvious.
> >
> > While I'm not sure I see much utility in vector->range (SRFI 133
> > provides many ways of iterating over vectors) I think we may want this
>
> list->range is less obvious than vector->range and would have to be
> implemented as (vector->range (list->vector LIS)) because of the O(1)
> guarantees. The same would hold for generator->range. Therefore, we
> don't need more than this single converter.
>
> So it is just about this single procedure.
I think that's well-argued. If vector->range alone effectively gives
us efficient ->range conversions for anything that can be converted to
a vector, then I think it's worth adding. Does John concur?
> Have you also thought about potentially infinite ranges?
Yes. An obvious extension is to accept #f as the <end> argument of
numeric-range (or to make <end> optional and reverse the argument
order), but this would require revision of range-length, range-end,
and the other procedures which expect ranges to have finite length.
(numeric-range 1 2 0) is currently not an error, and so should be
infinite unless this changes.
--
Wolfgang Corcoran-Mathe <xxxxxx@sigwinch.xyz>
"It from bit." --John Wheeler