Hi Iain, Do you really need the "foobar" to be like a keyword? (the : prefix) If not I, guess one would go like
;; foobar of default value 0 ;; you could use define* to denote the defaults and override them (define (make-state) (let ((foobar 0)) (curlet)) and then (define my-state-thing (make-state)) ;; getter (my-state-thing 'foobar) ;;setter (set! (my-state-thing 'foobar) 99) On Wed, 29 Jul 2020 at 21:59, Iain Duncan <[email protected]> wrote: > Hi S7 Schemers, I'm hoping someone can help out, or point me at some > beginner friendly resources as I'm not able to figure this out from the > S7.html page. I am making a state management container for my max apps. I'd > like to make it follow the generic applicable syntax so that one can call > it as if it's a hashtable, allowing code using this to be unaware of > implementation. So I want to implement a setter and getter for my function > to be able to do: > > ;; call my setter > (set! (my-state-thing :foobar) 99) > > ;; call my setter > (my-state-thing :foobar) > > I apologize if this is just basic scheme ignorance! > thanks > iain > > > _______________________________________________ > Cmdist mailing list > [email protected] > https://cm-mail.stanford.edu/mailman/listinfo/cmdist >
_______________________________________________ Cmdist mailing list [email protected] https://cm-mail.stanford.edu/mailman/listinfo/cmdist
