Suppose I have a class called board:
(defclass board ()
((blocker :accessor blocker :initarg :blocker :initform 0))
According to this book I can define a custom setf for blocker by:
(defmethod (setf blocker) (new-blocker (b board))
(setf (slot-value b 'blocker) new-blocker))
However, steel bank common lisp will say function not defined, even though I have evaluated it. Does anyone know what's wrong here?
That looks correct. Note that you are redefining the already existing setf method that you created by specifying :accessor blocker. SBCL will give you a style-warning about that.
Your mistake is somewhere else. Are you in a different package, perhaps? Try to show the steps you have taken in your IDE to compile and load those forms, and to attempt to run that method invocation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With