Lisp Scheme Part39
■ このスレッドは過去ログ倉庫に格納されています
0254デフォルトの名無しさん
2014/11/02(日) 09:14:35.48ID:5lL/XLnasetfでアップデートするところでエラーが出るんだ...
誰か助けて
こんな感じに使いたい。
(update-structure player :name "hoge")
(update-structure pos :x 3)
; 以下はコード
(defun update-struct (structure key value)
(let* ((head (type-of structure))
(copy-fn (symbol-function (symb "COPY-" head)))
(copy (funcall copy-fn structure))
(update-fn (symbol-function (symb head "-" key)))
)
; コピーしたstructureをアップデート
(setf (funcall update-fn copy)
value)
copy))
(setq a (make-pos :x 0 :y 0))
(update-struct a :x 3)
■ このスレッドは過去ログ倉庫に格納されています