I'd use a dilambda, I think.
(define my-state-thing
(let ((actual-state 'Maxwell))
(dilambda
(lambda (field)
;; the "getter", so (my-state-thing :foobar) calls this
function
actual-state)
(lambda (field new-value)
;; the "setter", (set! (my-state-thing :foobar) new-value) call
this
(set! actual-state new-value)))))
You could also make my-state-thing a "let":
(define my-state-thing (inlet :foobar 99))
_______________________________________________
Cmdist mailing list
[email protected]
https://cm-mail.stanford.edu/mailman/listinfo/cmdist