I want to recur through a list of slot names of classes, the same slot names for two classes ((current-trial *exp*)
& (previous *exp*)
refer to instances of the same class). On each recursion, I want to evaluate the slot name so that the value of that slot of that instance may be got and set. The code below meets that expectation, but I worry about relying upon eval because it's slow and doesn't allow for lexical context (Graham, 1996). What would be alternative formulations that would be efficient and allow for lexical context?
(dolist (a '(letter number font color height))
(eval
`(when (eq (,a (current-trial *exp*))
(,a (previous *exp*)))
(setf (,a (current-trial *exp*))
(random-not-item
(,a (current-trial *exp*))
(,a *exp*))))))
Since these are slot names, you can use
slot-value
: