Linear update, etc. Wolfgang Corcoran-Mathe (08 Oct 2020 15:44 UTC)
Re: Linear update, etc. Adam Nelson (08 Oct 2020 17:27 UTC)
Re: Linear update, etc. Wolfgang Corcoran-Mathe (08 Oct 2020 18:52 UTC)
Re: Linear update, etc. John Cowan (08 Oct 2020 19:13 UTC)
Re: Linear update, etc. Marc Nieper-Wißkirchen (08 Oct 2020 19:28 UTC)
Re: Linear update, etc. Wolfgang Corcoran-Mathe (08 Oct 2020 19:45 UTC)
Re: Linear update, etc. Marc Nieper-Wißkirchen (08 Oct 2020 19:52 UTC)
Re: Linear update, etc. Wolfgang Corcoran-Mathe (08 Oct 2020 19:59 UTC)
Re: Linear update, etc. Marc Nieper-Wißkirchen (08 Oct 2020 20:06 UTC)
Re: Linear update, etc. Wolfgang Corcoran-Mathe (08 Oct 2020 20:29 UTC)
Re: Linear update, etc. Marc Nieper-Wißkirchen (08 Oct 2020 20:37 UTC)
Re: Linear update, etc. Adam Nelson (05 Feb 2021 05:26 UTC)

Re: Linear update, etc. Marc Nieper-Wißkirchen 08 Oct 2020 20:06 UTC

Am Do., 8. Okt. 2020 um 21:59 Uhr schrieb Wolfgang Corcoran-Mathe
<xxxxxx@sigwinch.xyz>:

> On 2020-10-08 21:52 +0200, Marc Nieper-Wißkirchen wrote:
> > Am Do., 8. Okt. 2020 um 21:45 Uhr schrieb Wolfgang Corcoran-Mathe
> > <xxxxxx@sigwinch.xyz>:
> >
> > > Yes.  This is one reason why I'm rather sad that vector-set! can't be
> > > linear update--there are plenty of immutable implementations of vectors
> > > which can guarantee O(log n) access.
> >
> > What do you mean by linear-update here?
> >
> > Do you mean a non-destructive update instead?
>
> Yes, of course.  I meant "linear update" in the sense of SRFI 1's
> use of the term:
>
> > A "linear update" procedure is allowed -- but not required -- to
> > side-effect its arguments in order to construct its result.

But Scheme's vector-set! is already linear-update in this sense, more
precisely, the following procedure is:

(define (vector-amend! vec i obj)
  (vector-set! vec i obj)
  vec)

But if you want a pure update procedure, why are you sad about the
current state of affairs? As Scheme allows O(log n) access time for
vectors (much, much better than the O(n) for lists), you can have a
Scheme that basically supports immutable vectors and pure updates.

Or do you complain about the existence of vector-set!, which means
that Scheme vectors cannot be truly immutable?