[plt-scheme] append!?

From: John Clements (clements at brinckerhoff.org)
Date: Sat Oct 20 17:07:46 EDT 2007

On Oct 20, 2007, at 10:40 AM, jerzy.karczmarczuk at info.unicaen.fr wrote:

> Pierpaolo Bernardi writes:
>> On 10/20/07, Majorinc, Kazimir <kazimir at chem.pmf.hr> wrote:
>>> (append! x y) results in concatenation of the values of x and y.
>>> But, is it guaranteed that result is stored in x? I've read  
>>> something
>>> like that in Help Desk, but I'm still not completely without  
>>> doubt. Do I
>>> need to write (set! x (append! x y))
>> yes | or (append! x y) is always enough? no
> I am sorry, but the question suggests that the asker is not well  
> acquainted
> with the intricacies of destructive procedures, and such a two word  
> answer
> is not very helpful. If Pierpaolo Bernardi didn't want to waste his  
> time,
> he could go further.
> USUALLY, pragmatically, the answer is yes, since if a variable, say:
> (define x '(1 2))
> is processed by (append! x '(3))
> then x becomes, physically, (1 2 3). The last (null) cdr pointer of
> *the value* of x has been replaced by the new list.
> BUT if x=(), then no choice, a constant cannot be modified,  
> otherwise we
> would have a situation similar to some old Fortran systems, where  
> the user,
> exploiting the call-by-reference, *could* change a (stored)  
> constant, say
> make 2 behave as zero...

This (and Matthias' email) suggest to me that (append! null x) should  
signal an error.  Perhaps R6RS is this way? .... No, it appears that  
in fact R6RS has no mention of append! at all.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2223 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20071020/1aeca31e/attachment.p7s>

Posted on the users mailing list.