【入門】Common Lisp その7【質問よろず】
■ このスレッドは過去ログ倉庫に格納されています
0450デフォルトの名無しさん
2010/11/04(木) 11:09:01classの方でやればできるな。
(defun x-to-y (a)
"Dummy implementation"
(1+ a))
(defclass hoge ()
((x :accessor my-hoge-x :initarg :x :initform 0)
(y :accessor hoge-y :initarg :y :initform 0)))
(defun hoge-x-setter (h new-x)
"Exposed writer for the slot X of HOGE"
(setf (my-hoge-x h) new-x)
(setf (hoge-y h) (x-to-y new-x)))
(defsetf hoge-x hoge-x-setter)
(defun hoge-x (h)
"Exposed reader for the slot X of HOGE"
(my-hoge-x h))
■ このスレッドは過去ログ倉庫に格納されています