|
range-reverse missing from spec
Shiro Kawai
(05 Jul 2021 12:48 UTC)
|
||
|
Re: range-reverse missing from spec
Arthur A. Gleckler
(05 Jul 2021 15:35 UTC)
|
||
|
Re: range-reverse missing from spec
Arthur A. Gleckler
(05 Jul 2021 18:08 UTC)
|
||
|
Re: range-reverse missing from spec
John Cowan
(06 Jul 2021 03:40 UTC)
|
||
|
Re: range-reverse missing from spec
Shiro Kawai
(06 Jul 2021 03:49 UTC)
|
||
|
Re: range-reverse missing from spec
John Cowan
(06 Jul 2021 11:08 UTC)
|
||
|
Re: range-reverse missing from spec
Wolfgang Corcoran-Mathe
(06 Jul 2021 16:12 UTC)
|
||
|
(missing)
|
||
|
Re: range-reverse missing from spec Wolfgang Corcoran-Mathe (06 Jul 2021 18:56 UTC)
|
||
|
Re: range-reverse missing from spec
Shiro Kawai
(06 Jul 2021 19:54 UTC)
|
||
|
Re: range-reverse missing from spec
Wolfgang Corcoran-Mathe
(07 Jul 2021 00:40 UTC)
|
||
|
Re: range-reverse missing from spec
Shiro Kawai
(07 Jul 2021 02:10 UTC)
|
||
|
Re: range-reverse missing from spec
Wolfgang Corcoran-Mathe
(07 Jul 2021 03:50 UTC)
|
||
|
Re: range-reverse missing from spec
Wolfgang Corcoran-Mathe
(06 Jul 2021 16:16 UTC)
|
||
|
Re: range-reverse missing from spec
Arthur A. Gleckler
(06 Jul 2021 18:13 UTC)
|
||
On 2021-07-06 14:00 -0400, John Cowan wrote:
> On Tue, Jul 6, 2021 at 12:12 PM Wolfgang Corcoran-Mathe <xxxxxx@sigwinch.xyz>
> wrote:
>
> * range-reverse may return an expanded range.
> >
>
> How's that? Or do you mean that it returns a compact range on a compact
> range and an extended range on an extended range, which is what I would
> expect? (Reverse the start and end values and negate the step in the first
> case, reverse the contents in the second case.)
No, sic. As we discussed back in September[1], many of the range
operations are expected to work via composition of indexer functions,
with the range being expanded only when the number of compositions
reaches a certain threshold. range-reverse was actually the poster
child for this discussion, though, ironically, it was missing from the
spec the whole time; here's the sample implementation:
(define (range-reverse r)
(assume (range? r))
(%range-maybe-vectorize ; expand the range if composition
(raw-range (range-start-index r) ; has reached threshold
(range-length r)
(lambda (n)
((range-indexer r) (- (range-length r) 1 n)))
(+ 1 (range-complexity r))))) ; bump complexity
We could do things differently, of course. In any case, I hope we
don't have to rerun the lengthy discussion of this issue from last
fall.
[1] https://srfi-email.schemers.org/srfi-196/msg/15115132/
--
Wolfgang Corcoran-Mathe <xxxxxx@sigwinch.xyz>
"A LISP programmer knows the value of everything, but the cost
of nothing." --Alan J. Perlis