Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!uakari.primate.wisc.edu!ames!ai.etl.army.mil!hoey From: hoey@ai.etl.army.mil (Dan Hoey) Newsgroups: comp.lang.lisp Subject: Re: NCONC & Functions Message-ID: <373@ai.etl.army.mil> Date: 30 Nov 89 13:53:36 GMT References: <8911292103.AA21810@kronos.ads.com> Reply-To: hoey@ai.etl.army.mil (Dan Hoey) Organization: USAETL, Fort Belvoir, Virginia Lines: 30 In article <8911292103.AA21810@kronos.ads.com> rar@KRONOS.ADS.COM (Bob Riemenschneider) writes: >One last note: a lot of Lispers think of this behavior [modifying quoted >structure in a function definition] as a feature rather >than a bug. Consider the following program .... I used to think so, too, but the designers of Common Lisp have decided that modifying quoted structure is an error. The rationale is to allow two features that they thought outweighed the utility of this technique: 1. The compiler is free to collapse all EQUAL quoted structures into one, saving some amount of space. I do not know if this is implemented by any compiler. 2. The system is free to put quoted structure into write-protected memory, and thus signal an error if the user accidentally modifies the structure. I am somewhat uncomfortable with this, since it also prevents the user from purposefully modifying the structure, but since some lisp machine manufacturers have implemented this feature, I don't think it's worth debating. The sort of work-around that I believe is approved is (1) for now, use a special variable, and (2) when enough lisps support it, go to DEFUNs with a lexical environment, such as (borrowing Bob's code) + (let ((aux (list 1 1))) (defun fibon (n) (if (or (eq n 0) (eq n 1)) 1 ! (fibonaux n aux)))) Dan