[CM] something like let-set! for undefined vars?
iainduncanlists at gmail.com
Sat Feb 6 17:06:01 PST 2021
Hi folks, I've been digging into S7s environment support and loving it. I
have implemented a really convenient pseudo-inheritance-through-delegation
setup for my process objects, and one thing I'm using is the let-set!
function to allow updating internal variables from outside if desired. My
little method looks like this (in side of a let inside a function)
(define (set sym val)
;; TODO this doesn't allow setting values that are not yet set
;; need to check if symbol is in let and then set it
(let-set! proc-env sym val))
However, this of course errors if I try to use if and sym is not defined. I
tried mucking about with the defined? predicate, but got confused by the
docs. If anyone can tell me how I can easily add to the above the
following, that would be lovely:
- if sym not defined in proc-env, define sym to val
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Cmdist