[Openmcl-devel] (function (setf ...))

Paul Krueger plkrueger at comcast.net
Thu Jan 21 12:30:01 PST 2010


I'm doing a new interface project for which I want to cache and later  
funcall user-supplied accessor functions (i.e. both readers and  
writers). The readers are often fairly standard things like nth,  
first, second, etc.

To get those functions I assumed that I could just use (function ...),  
which indeed works just fine for the readers. I was surprised to find  
that (function (setf ...)) fails to locate setf functions for the  
standard readers mentioned above and many others (examples below). It  
works as expected for any accessors that are defined within things  
like class definitions. Clearly you can still do setfs of things like  
#'first or #'nth (I verified that just to make sure I wasn't losing my  
mind), so I presume that setf functions do exist somewhere (unless  
there is compiler magic going on). Is there some other way to get them  
or am I missing some reason why I shouldn't expect to get them or is  
this a bug?

Welcome to Clozure Common Lisp Version 1.5-dev-r13388M-trunk   
(DarwinX8664)!
? (function first)
#<Compiled-function FIRST #x3000000A1F9F>
? (function (setf first))
 > Error: Undefined function: SETF::|COMMON-LISP::FIRST|
 > While executing: CCL::%FUNCTION, in process Listener(6).
 > Type cmd-. to abort, cmd-\ for a list of available restarts.
 > Type :? for other options.
1 >
? (function (setf car))
 > Error: Undefined function: SETF::|COMMON-LISP::CAR|
 > While executing: CCL::%FUNCTION, in process Listener(6).
 > Type cmd-. to abort, cmd-\ for a list of available restarts.
 > Type :? for other options.
1 >
? (function (setf nth))
 > Error: Undefined function: SETF::|COMMON-LISP::NTH|
 > While executing: CCL::%FUNCTION, in process Listener(6).
 > Type cmd-. to abort, cmd-\ for a list of available restarts.
 > Type :? for other options.
1 >
? (defclass test ()
     ((sl :accessor sl)))
#<STANDARD-CLASS TEST>
? #'sl
#<STANDARD-GENERIC-FUNCTION SL #x3020013F0A2F>
? (function (setf sl))
#<STANDARD-GENERIC-FUNCTION (SETF SL) #x3020013EEFBF>
?





More information about the Openmcl-devel mailing list