Oddbean new post about | logout
 Question for #scheme ☯️  kings & queens 👑 ! Are there an alternative to clojure's alter-var-root https://clojuredocs.org/clojure.core/with-redefs in scheme?

Imagine I have a module `(X)` with `(define a 1) (define-public (f x) (+ x a))` and module `(Y)` that has `#:use-module (X)`. In `(Y)` want to alter a from `(X)` in a way that would also affect `f`. Example: (being in module `(Y)`): `(alter! a 2) (equal? (f 3) 5) => #t`

CC nostr:npub1cwwjvpgyj5fy8tdkw4d62zsym74eaqs4y7wt0c6nzt5a7lll9x2qvpny8k nostr:npub1f3srhzp5z8qwchfdyy6kceysfg9jzxr937ttracqrxuxuncc25mqgmjzfc nostr:npub1gcht7nxyny85r6ezenuyp3f8ey73l773d0glpgeacudx6r5evh2szu00vs