[CM] How to make new applicable objects that use generic set/get?
bil at ccrma.Stanford.EDU
bil at ccrma.Stanford.EDU
Wed Jul 29 13:43:12 PDT 2020
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))
More information about the Cmdist
mailing list