This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: bug in append!


Ivan Toshkov <ivant@intransco.com> wrote:
>> On Mon, Oct 18, 1999 at 01:39:28PM +0200, Roland Orre wrote:
>...
>> in the list. To be safe you have to
>> (set! a (append! a '(b)))
Ivan:
> maybe you mean (set! a (append a '(b))) ?
> yes, that works and that's the way I rewrote it..

No, I mean 
(set! a (append! a '(b)))
The essential thing with append! is that it does not copy the lists,
it destructively changes all last pairs of all lists being appended
except the last one.

When you use append! it is normally of performance reasons. It uses
no extra memory and is thus also faster.
(set! a (append! a '(b)))
When you develop things it is always a good rule to use e.g
(set! a (append a '(b)))
and when everything works you can change some of the append to append!
to possibly speed up things.

	Best regards
	Roland

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]