I have this function:
(defun call-generic-function (gf &rest args)
(let* ((applicable-methods (compute-applicable-methods gf args))
(most-specific-method (select-next-method-to-call
applicable-methods)))
(print "applicable methods")
(print (length applicable-methods))
(print args)
(print (values-list args))
(funcall (method-function most-specific-method)
(values-list args)
(remove most-specific-method applicable-methods))))
I expect values-list
to give me all the elements of the list args
(these are two objects to be passed as two out of the three expected arguments to the called method by funcall) but it only gives the first element and I get an error that I am only supplying 2 arguments instead of the expected 3 arguments. This can be confirmed by the fact that (print args)
prints a list of 2 objects but (print (values-list args))
prints out just the first of these objects. How can I correct this?
results (print args):
(#S(OBJECT
:CLASS #S(CLASS
:DIRECT-SUPERCLASS #S(CLASS
:DIRECT-SUPERCLASS #S(CLASS
:DIRECT-SUPERCLASS NIL
:DIRECT-SLOTS NIL)
:DIRECT-SLOTS (NAME ADDRESS))
:DIRECT-SLOTS (EMPLOYER))
:SLOTS #<HASH-TABLE :TEST EQL :COUNT 3 {1003932403}>)
#S(OBJECT
:CLASS #S(CLASS
:DIRECT-SUPERCLASS #S(CLASS
:DIRECT-SUPERCLASS NIL
:DIRECT-SLOTS NIL)
:DIRECT-SLOTS (SPORTS))
:SLOTS #<HASH-TABLE :TEST EQL :COUNT 1 {1003932853}>))
result (print (values-list args))
#S(OBJECT
:CLASS #S(CLASS
:DIRECT-SUPERCLASS #S(CLASS
:DIRECT-SUPERCLASS #S(CLASS
:DIRECT-SUPERCLASS NIL
:DIRECT-SLOTS NIL)
:DIRECT-SLOTS (NAME ADDRESS))
:DIRECT-SLOTS (EMPLOYER))
:SLOTS #<HASH-TABLE :TEST EQL :COUNT 3 {1003932403}>)
As you can see, values-list gets just the first object and makes my function which expects both objects fail.
values-list
to do? – melpomene+
does anything special with multiple-values. – melpomeneapply
, notfuncall
. – melpomene