[CM] How to make new applicable objects that use generic set/get?

Iain Duncan iainduncanlists at gmail.com
Wed Jul 29 14:01:44 PDT 2020


Thanks Bill and Christos, I'll chew on those and see how I make out!

iain

On Wed, Jul 29, 2020 at 1:43 PM <bil at ccrma.stanford.edu> wrote:

> 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))
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cm-mail.stanford.edu/pipermail/cmdist/attachments/20200729/f7cecf70/attachment.html>


More information about the Cmdist mailing list