私のクラス定義では、あるスロットを別のスロットの値に基づいて初期化したいと考えています。これが私がやりたいことのようなものです:
(defclass my-class ()
((slot-1 :accessor my-class-slot-1 :initarg slot-1)
(slot-2 :accessor my-class-slot-2 :initform (list slot-1))))
ただし、これはコンパイルされません:
1 compiler notes:
Unknown location:
warning:
This variable is undefined:
SLOT-1
warning:
undefined variable: SLOT-1
==>
(CONS UC-2::SLOT-1 NIL)
Compilation failed.
これを行う方法はありますか?