Eliminate numeric-range over inexact numbers? John Cowan (27 Aug 2020 23:05 UTC)
Re: Eliminate numeric-range over inexact numbers? Wolfgang Corcoran-Mathe (28 Aug 2020 02:12 UTC)
Re: Eliminate numeric-range over inexact numbers? Wolfgang Corcoran-Mathe (28 Aug 2020 03:33 UTC)
Re: Eliminate numeric-range over inexact numbers? Marc Nieper-Wißkirchen (28 Aug 2020 06:31 UTC)
Re: Eliminate numeric-range over inexact numbers? Wolfgang Corcoran-Mathe (28 Aug 2020 16:01 UTC)
Re: Eliminate numeric-range over inexact numbers? Marc Nieper-Wißkirchen (28 Aug 2020 16:28 UTC)
Re: Eliminate numeric-range over inexact numbers? Wolfgang Corcoran-Mathe (28 Aug 2020 16:59 UTC)
Re: Eliminate numeric-range over inexact numbers? Marc Nieper-Wißkirchen (28 Aug 2020 17:03 UTC)
Re: Eliminate numeric-range over inexact numbers? Wolfgang Corcoran-Mathe (28 Aug 2020 18:10 UTC)
Re: Eliminate numeric-range over inexact numbers? Marc Nieper-Wißkirchen (28 Aug 2020 18:54 UTC)
Re: Eliminate numeric-range over inexact numbers? Wolfgang Corcoran-Mathe (29 Aug 2020 17:29 UTC)
Re: Eliminate numeric-range over inexact numbers? Marc Nieper-Wißkirchen (29 Aug 2020 17:44 UTC)
Re: Eliminate numeric-range over inexact numbers? John Cowan (30 Aug 2020 00:12 UTC)
Re: Eliminate numeric-range over inexact numbers? Marc Nieper-Wißkirchen (30 Aug 2020 08:54 UTC)
Re: Eliminate numeric-range over inexact numbers? Wolfgang Corcoran-Mathe (30 Aug 2020 17:02 UTC)
Re: Eliminate numeric-range over inexact numbers? Marc Nieper-Wißkirchen (30 Aug 2020 17:39 UTC)
Re: Eliminate numeric-range over inexact numbers? John Cowan (30 Aug 2020 18:21 UTC)
Re: Eliminate numeric-range over inexact numbers? Wolfgang Corcoran-Mathe (30 Aug 2020 18:46 UTC)
Re: Eliminate numeric-range over inexact numbers? Marc Nieper-Wißkirchen (30 Aug 2020 19:30 UTC)
Re: Eliminate numeric-range over inexact numbers? Wolfgang Corcoran-Mathe (30 Aug 2020 20:40 UTC)
Re: Eliminate numeric-range over inexact numbers? Marc Nieper-Wißkirchen (30 Aug 2020 20:44 UTC)
Re: Eliminate numeric-range over inexact numbers? Wolfgang Corcoran-Mathe (30 Aug 2020 20:56 UTC)
Re: Eliminate numeric-range over inexact numbers? Marc Nieper-Wißkirchen (30 Aug 2020 21:07 UTC)
Re: Eliminate numeric-range over inexact numbers? John Cowan (30 Aug 2020 21:08 UTC)
Re: Eliminate numeric-range over inexact numbers? Wolfgang Corcoran-Mathe (31 Aug 2020 02:40 UTC)
Re: Eliminate numeric-range over inexact numbers? John Cowan (31 Aug 2020 12:50 UTC)
Re: Eliminate numeric-range over inexact numbers? Wolfgang Corcoran-Mathe (31 Aug 2020 16:30 UTC)
Re: Eliminate numeric-range over inexact numbers? Wolfgang Corcoran-Mathe (30 Aug 2020 21:08 UTC)
Re: Eliminate numeric-range over inexact numbers? Marc Nieper-Wißkirchen (30 Aug 2020 21:15 UTC)
Re: Eliminate numeric-range over inexact numbers? Wolfgang Corcoran-Mathe (30 Aug 2020 21:29 UTC)
Re: Eliminate numeric-range over inexact numbers? Wolfgang Corcoran-Mathe (28 Aug 2020 18:13 UTC)
Re: Eliminate numeric-range over inexact numbers? Marc Nieper-Wißkirchen (28 Aug 2020 18:55 UTC)
Re: Eliminate numeric-range over inexact numbers? John Cowan (28 Aug 2020 20:45 UTC)
Re: Eliminate numeric-range over inexact numbers? Marc Nieper-Wißkirchen (28 Aug 2020 21:11 UTC)
Re: Eliminate numeric-range over inexact numbers? John Cowan (29 Aug 2020 00:43 UTC)
Re: Eliminate numeric-range over inexact numbers? Marc Nieper-Wißkirchen (29 Aug 2020 08:21 UTC)

Re: Eliminate numeric-range over inexact numbers? Marc Nieper-Wißkirchen 30 Aug 2020 19:29 UTC

Am So., 30. Aug. 2020 um 20:46 Uhr schrieb Wolfgang Corcoran-Mathe
<xxxxxx@sigwinch.xyz>:
>
> On 2020-08-30 14:21 -0400, John Cowan wrote:
> > On Sun, Aug 30, 2020 at 1:02 PM Wolfgang Corcoran-Mathe <xxxxxx@sigwinch.xyz>
> > wrote:
> >
> > (range-map->vector proc range)
> > > (range-filter->vector pred range)
> > > (range-remove->vector pred range)
> > >
> >
> > Added, along with range-map, range-filter, and range-remove, all of which
> > return "vector-type" ranges.

While range-map->vector has a clear semantics, the best semantics is
not so obvious. When you write "return 'vector-type' ranges", you seem
to mean that

(define (range-map proc range)
  (vector->range (range-map->vector proc range))

The following definition, however, is at least equally sensible:

(define (range-map proc range)
  (range (range-length range)
             (lambda (k) (proc (range-ref range k)))))

Both possibilities have their advantages and disadvantages. The former
has time and space complexity of O(n), the latter of O(1). While the
former calls PROC upon construction, the latter calls PROC at
reference time. This difference is akin to the one between (list-)map
and gmap (of SRFI 158). Due to the way generators work, gmap has the
guarantee (in the absence of call/cc) that PROC is only called once
per index, whereas the second version of range-map has no such
guarantee.

When we view ranges as finite sequences, the first definition of
range-map seems to make more sense. The second definition is more
suited to potentially infinite "ranges" and should be left to a later
SRFI dealing with potentially infinite "ranges".

The description of "range-map" and the other procedures in the SRFI
should exclude the possibility of the second definition.

Marc

PS Speaking of potentially infinite "ranges", I want to suggest a SRFI
"Progression Objects" akin to this SRFI. In the sense that ranges are
compact vectors, progressions are compact generators with random
access as for vectors. Here, the higher-order procedures
("progression-map") would defer the application of the PROC argument.
Compared to ranges, the length information will be more complicated
(exact length, infinite length, length bounded below or above, ... may
all be possible) and the running time guarantees are not as obvious.
If you want, I can propose an API once my pipeline has a bit room.