Plaster
New
List
Login
common-lisp
default
anonymous
2022.07.24 13:51:34
(defun prop (list property) (getf list property)) (defun set-prop (list property new) (setf (getf list property) new) list) (defsetf prop (list property) (new-value) (let ((new (gensym "NEW"))) `(let ((,new (set-prop ,list ,property ,new-value))) (setf ,list ,new) ,new-value))) ;;;; Would like A to become (:B 2 :A 1) (let ((a (list :a 1))) (setf (prop a :b) 2) a) => (:A 1)
Raw
Annotate
Repaste
Edit