Hi Alex,

Op di 31 jul. 2018 om 17:34 schreef Alexander Burger <a...@software-lab.de>:

>
> But 'cut' is *not* a destructive function. It does not modify the list in
> any
> way. Only the variable which points to the list is modified.
>

OK. That isn't totally obvious, but of course you are right as shown per
this example:

: (setq X '(1 2 3 4 5 6 7 8))
> -> (1 2 3 4 5 6 7 8)
> : (setq S X)
> -> (1 2 3 4 5 6 7 8)   ; Now S points to same memory location as X
> : (cut 3 'S)
> -> (1 2 3)
> : S
> -> (4 5 6 7 8) ; Now S points to the 4th element of that same memory
> location
> : X
> -> (1 2 3 4 5 6 7 8) ; X still points to the same memory location


Ergo: Alex is totally right :)


> In general, all destructive functions are marked as such in the reference.
>

Good to get some feedback and find out how it *really*  works :)

Thx very much!
   Arie

Reply via email to