[Openmcl-devel] (function (setf ...))
munchking at gmail.com
Thu Jan 21 13:43:38 PST 2010
On Thu, 21 Jan 2010, Paul Krueger wrote:
> 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?
See CLHS 188.8.131.52 http://www.lispworks.com/documentation/HyperSpec/Body/05_aab.htm
For each standardized accessor function F, unless it is explicitly
documented otherwise, it is implementation-dependent whether the
ability to use an F form as a setf place is implemented by a setf
expander or a setf function. Also, it follows from this that it is
implementation-dependent whether the name (setf F) is fbound.
You could use (lambda (new-elt x n) (setf (elt x n) new-elt)), etc.
More information about the Openmcl-devel