Is there a way to check if a variable exists in Scheme? Even doing things like (if variable) or (null? variable) cause errors because the variable is not defined. Is there some function that returns whether or not a variable exists?
This feature is built into Mit-Scheme.
#lang scheme
(define x "hello world")
(environment-bound? (nearest-repl/environment) 'x)
(environment-bound? (nearest-repl/environment) 'not-x)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With