I can't use the clos accessor functions when the class is in a list.
Say I have class a:
(defclass a ()
((a :accessor a
:initarg :a)))
And I make 2 instances:
(defparameter b (make-instance 'a :a 1))
(defparameter c (make-instance 'a :a 2))
and then if I wanted to create a function that would get the a value for each of the instances while in a list i would do
(defun get-a (lst)
(mapcar #'a lst))
and call it with
(get-a '(b c))
but I do that I get an error:
There is no applicable method for the generic function
#<STANDARD-GENERIC-FUNCTION A (1)>
when called with arguments
(B).
[Condition of type SIMPLE-ERROR]
And it also happens if instead of calling the accessor directly with mapcar, I call a function which contains the accessor. Also I've tried using loops and other things instead of mapcar.
Thanks
(get-a (list b c)), not(get-a '(b c)). - Joshua Taylor