From ... From: Erik Naggum Subject: Re: setf implementation Date: 2000/01/24 Message-ID: <3157726372992359@naggum.no>#1/1 X-Deja-AN: 577002782 References: <86i2o6$o2t$1@monet.op.net> mail-copies-to: never Content-Type: text/plain; charset=us-ascii X-Complaints-To: newsmaster@eunet.no X-Trace: oslo-nntp.eunet.no 948737811 20273 195.0.192.66 (24 Jan 2000 18:16:51 GMT) Organization: Naggum Software; +47 8800 8879 or +1 510 435 8604; fax: +47 2210 9077; http://www.naggum.no User-Agent: Gnus/5.0802 (Gnus v5.8.2) Emacs/20.5 Mime-Version: 1.0 NNTP-Posting-Date: 24 Jan 2000 18:16:51 GMT Newsgroups: comp.lang.lisp * mjd@op.net (Mark-Jason Dominus) | I was surprised by this, because I had picked up a different idea from | somewhere. it's a notion from C's pointer concept. as such, it's pretty bogus. | When you evaluate (cdr ...), you get back a pointer to the cdr, and | then the enclosing function receives this pointer as an argument. that's precisely what you don't do in Common Lisp. you don't get a pointer to the CDR, you get the value of the CDR, which may or may not be a pointer, depending on its type. in any case, you're not getting a pointer to something settable. consider this schematic (yikes, I'm having to resort to graphics!): +-------+-------+ X: | CAR | CDR |--> ZOT +-------+-------+ | V FOO when you evaluate (CDR X), you get ZOT back. if you wish the CDR of X to point to something else, you would do (setf (cdr x) 'bar), but if you have already obtained ZOT, you don't know where to store BAR. therefore, in C terminology, what SETF gives you is the address of the slot you wish to change, but that is not at all similar to a pointer to the value _in_ that slot. therefore, your approach won't work, since it misses out on the crucial level of indirection. #:Erik