<div dir="ltr">Thanks Bill and Christos, I'll chew on those and see how I make out!<div><br></div><div>iain</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jul 29, 2020 at 1:43 PM <<a href="mailto:bil@ccrma.stanford.edu">bil@ccrma.stanford.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I'd use a dilambda, I think.<br>
<br>
(define my-state-thing<br>
(let ((actual-state 'Maxwell))<br>
(dilambda<br>
(lambda (field)<br>
;; the "getter", so (my-state-thing :foobar) calls this <br>
function<br>
actual-state)<br>
(lambda (field new-value)<br>
;; the "setter", (set! (my-state-thing :foobar) new-value) call <br>
this<br>
(set! actual-state new-value)))))<br>
<br>
You could also make my-state-thing a "let":<br>
(define my-state-thing (inlet :foobar 99))<br>
<br>
</blockquote></div>