[plt-scheme] append!?

From: Majorinc, Kazimir (kazimir at chem.pmf.hr)
Date: Sun Oct 21 05:31:55 EDT 2007

To use it sanely for changing a list, you should make sure that you
> always pass in a non-empty list, and to use it as a kind of an
> optimization you should always use the
>   (set! l (append! l ...))
> thing.  But these kind of games can get very dangerous, you should be
> very careful if you want to use that.

OK, I think I understood it. I'll use append instead of append! for all 
occasions except if the last list is significantly bigger than other 
lists that should be appended. In that particular case, use of the 
append instead of append! would be a sin. Is it sound policy?

Somehow I think that the problem is in simple initial Lisp design 
mistake, i.e. linked lists that start with cell (cons) instead of 
pointer to cons (that could be nil for empty list) are good only if one 
does not need empty list at all. Of course, empty lists are too useful 
to be left and "special" empty list as we have it now is obviously 
acceptable, but not perfect patch on that design.

Thanks to all who responded.

Kazimir Majorinc

Posted on the users mailing list.