[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setf question (naive).



> I was looking at CLtL2 and on p 116 it says that you should be able to get
> access to the setf function for cadr with (function (setf cadr)).  However,
> this does not appear to work in MCL.
> 
> ? (function (setf cadr))
> > Error: Undefined function: SETF::|COMMON-LISP::CADR|
> > While executing: CCL::%FUNCTION
> > Type Command-. to abort.
> See the Restarts=8A menu item for further choices.
> 1 >
> 
> What am I missing?

Sorry, but Steele picked a really bad example to use.  The referenced X3J13 
proposal (function-names) did not actually say that this would work, and there 
was a later X3J13 proposal (setf-functions-again) that specifically addressed 
this, as a result of Steele's mistake.

The relevant section from the draft ANSI standard (section 5.1.1.2 Setf 
Expansions) says

  For each \term{standardized} accessor function \param{F},
  unless it is explicitly documented otherwise,
  it is \term{implementation-dependent} whether the ability to 
  use an \param{F} \term{form} as a \macref{setf} \term{place}
  is implemented by a \term{setf expander} or a \term{setf function}.
  Also, it follows from this that it is \term{implementation-dependent} 
  whether the name \f{(setf \param{F})} is \term{fbound}.