transcendental-lisp/lisp/random/structure.lisp
Mike Cifelli a21114ac7c Add a GENSYM-EQUAL function for unit testing macros
Some macro definitions were refactored along with their associated
unit tests.
2017-03-13 14:43:31 -04:00

21 lines
529 B
Common Lisp

(load "../lang/dlambda.lisp")
(load "../lang/functions.lisp")
(defmacro keys (&rest fields)
`(let ,(mapcar 'list fields)
(dlambda
(:get (field) (eval field))
(:set (field value) (set field value)))))
(defun process-data (data)
(let ((one (call data :get 'one))
(two (call data :get 'two))
(three (call data :get 'three)))
(list one two three)))
(setq data (keys one two three))
(call data :set 'one "goodbye")
(call data :set 'two "key")
(call data :set 'three "!")
(process-data data)