Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!zodiac!doug From: doug@zodiac.ADS.COM (Doug Morgan) Newsgroups: comp.lang.lisp Subject: Re: NCONC & Functions Message-ID: Date: 30 Nov 89 00:37:22 GMT References: <464@ntcsd1.UUCP> Sender: news@zodiac.ADS.COM Distribution: na Organization: Advanced Decision Systems Lines: 26 In-reply-to: mps@ntcsd1.UUCP's message of 28 Nov 89 22:19:26 GMT When the lisp reader sees: (DEFUN foo1 () '(a b c)) it turns the text (a b c) into an internal representation as a list of conses pointing to symbols. At run time the ' (actually (quote ...)) returns THAT PARTICULAR internal representation. A later NCONC munches that representation and you get exactly what you saw. In the case of (DEFUN foo2 () (LIST 'a 'b 'c)), the reader creates a different internal representation. This one is 4 conses with the first pointing to the symbol named LIST. At run time, the evaluation of this representation causes a 3 cons list pointing to a b and c to be generated. Since these lists are generated upon each evaluation of (LIST ...), NCONC can't affect later ones. Again exactly as you saw. Any lisp that treats FOO2 like FOO1 is in error, no ifs ands or buts. I use destructive operations pretty much at will on lists that are created from nil and the operations are in the lexical scope of the point of creation (I get to look at everything that could be building pointers to such lists). Never (well, hardly ever) trust a list that's passed in from "outside." doug