Subject: Re: setf implementation From: Erik Naggum <erik@naggum.no> Date: 2000/01/24 Newsgroups: comp.lang.lisp Message-ID: <3157726372992359@naggum.no> * 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