From ... Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!colt.net!newsfeed.esat.net!nslave.kpnqwest.net!nloc.kpnqwest.net!nmaster.kpnqwest.net!nreader1.kpnqwest.net.POSTED!not-for-mail Newsgroups: comp.lang.lisp Subject: Re: weird function behavior References: Mail-Copies-To: never From: Erik Naggum Message-ID: <3230400393774701@naggum.net> Organization: Naggum Software, Oslo, Norway Lines: 35 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 14 May 2002 21:26:34 GMT X-Complaints-To: newsmaster@KPNQwest.no X-Trace: nreader1.kpnqwest.net 1021411594 193.71.199.50 (Tue, 14 May 2002 23:26:34 MET DST) NNTP-Posting-Date: Tue, 14 May 2002 23:26:34 MET DST Xref: archiver1.google.com comp.lang.lisp:33308 * Jacques Wainer | (defun prob() | (let ((x '(nil))) | (push 1 (elt x 0)))) Where did you get the idea that you should use a quoted constant in your code to begin with? I am actually seriously curious about this, because it is such an odd and counterintuitive thing to want to do that I am looking for some textbook author to blame or something. If you thought it up on yourself, why did you think that a constant was a better choice than a freshly created list? It is not the "don't modify a constant" that I wonder why people do not understand, it is their initial desire to use a constant in the first place that puzzles me. What core concept do you have to have missed in order to believe that a constant is a suitable thing to specify when you know you are going to modify some part of it? A very weak conjecture on my part goes like this: People are used to programs that load fresh into a pristine environment where they can wreak havoc with constants and terminate wihout causing observable problems. There is no corrector to the abuse of these constants and because most programming languages make it easier to write constants than freshly created objects, the idea that using a constant could be an error does not arise consciously. So when using a constant does not work, the _last_ thing they would think about is that the constant that is being modified actually _survives_ between what they are certain are fresh instantiations in a pristine environment. If my weak conjecture has merit, the solution to this problem is not to ask people to stop modifying constants, it is to teach people more about the execution models of computers, operating systems, and languages. -- In a fight against something, the fight has value, victory has none. In a fight for something, the fight is a loss, victory merely relief. 70 percent of American adults do not understand the scientific process.