I'd like to override a Lispworks setf function which accepts multiple
values, but I don't see how to write a defmethod to sef a function
with multiple values.
Specifically (setf capi:pinboard-pane-size) can be given x and y
values.
Mitch
On Jan 10, 12:23 pm, Mitch <········@bermita.com> wrote:
> I'd like to override a Lispworks setf function which accepts
> multiple values, but I don't see how to write a defmethod
> to sef a function with multiple values. Specifically
> (setf capi:pinboard-pane-size) can be given x and y values.
What do you mean by "given"? You can use multiple-value-call if
you're trying to call the function with x and y as args. If you're
trying to create a closure around x and y, then you can use
multiple-value-bind to bind x and y before defining the function.
What do you want to use SETF for?
--Dan
www.prairienet.org/~dsb/
danb <·········@gmail.com> writes:
> On Jan 10, 12:23 pm, Mitch <········@bermita.com> wrote:
>> Specifically (setf capi:pinboard-pane-size) can be given
>> x and y values.
>
> What do you mean by "given"?
LispWorks documents capi:pinboard-pane-size at:
http://www.lispworks.com/documentation/lw445/CAPRM/html/capiref-238.htm
Near the end of the page, there is this sample subform:
(setf (capi:pinboard-pane-size po)
(values new-x new-y))
Two values are being "given".
Mitch <········@bermita.com> writes:
> I'd like to override a Lispworks setf function which accepts multiple
> values, but I don't see how to write a defmethod to sef a function
> with multiple values.
In standard Common Lisp, a setf function cannot take multiple values.
(macroexpand-1 '(setf (capi:pinboard-pane-size p) (values width height)))
should reveal if the setf expander of capi:pinboard-pane-size
redirects the operation to a generic function, to which you could
then add your method. It may be unexported and undocumented though.
To implement a place that takes multiple values, one can use
either the long form of DEFSETF, or DEFINE-SETF-EXPANDER.
The short form of DEFSETF is unable to generate the correct
number of store variables in a setf expansion.