|
vector->range issues Wolfgang Corcoran-Mathe (01 Sep 2020 19:21 UTC)
|
|
Re: vector->range issues
Marc Nieper-Wißkirchen
(01 Sep 2020 19:28 UTC)
|
|
Re: vector->range issues
Wolfgang Corcoran-Mathe
(01 Sep 2020 20:52 UTC)
|
|
Re: vector->range issues
Marc Nieper-Wißkirchen
(02 Sep 2020 05:48 UTC)
|
|
Re: vector->range issues
Marc Nieper-Wißkirchen
(02 Sep 2020 07:57 UTC)
|
|
string-range
Marc Nieper-Wißkirchen
(02 Sep 2020 13:14 UTC)
|
|
Re: string-range
Wolfgang Corcoran-Mathe
(02 Sep 2020 14:50 UTC)
|
|
Re: string-range
Marc Nieper-Wißkirchen
(02 Sep 2020 15:01 UTC)
|
|
Re: string-range
Wolfgang Corcoran-Mathe
(02 Sep 2020 15:56 UTC)
|
|
Re: string-range
Marc Nieper-Wißkirchen
(02 Sep 2020 15:58 UTC)
|
|
Re: string-range
John Cowan
(02 Sep 2020 21:12 UTC)
|
|
Re: string-range
Wolfgang Corcoran-Mathe
(02 Sep 2020 21:16 UTC)
|
|
Re: string-range
Wolfgang Corcoran-Mathe
(02 Sep 2020 21:25 UTC)
|
|
Re: vector->range issues
Wolfgang Corcoran-Mathe
(02 Sep 2020 14:46 UTC)
|
I'm thinking that the restriction on vector->range ("it is an error to
mutate <vector>") is actually a bad abstraction leak. Not being able to
mutate a vector after passing it to this procedure is unfortunate, as
mutation is a fundamental operation on vectors. I wonder if this
means that the only real use of vector->range will be as a sort of
shorthand for constructing a discrete range, by passing literal
vectors. If so, perhaps it would be better to *remove* the
restriction on vector->range (i.e. copy the vector argument), and
provide a discrete range constructor (conventionally, this would be
called `range'):
(range* 1 2 3 5 7) == (vector->range #(1 2 3 5 7))
This way, the immutable vector underlying the new range isn't exposed,
and it's still possible to convert an existing vector to a range
(without the onerous restriction).
(Perhaps Marc has already suggested this, and I've just overlooked it.
If so, apologies.)
--
Wolfgang Corcoran-Mathe <xxxxxx@sigwinch.xyz>
"If one is searching for a needle in a haystack, look in the part
of the haystack that contains more needles." --Bird & Wadler