I would like to be able to test whether a variable is defined, prior to accessing it.
I like to have a global that specifies a \"debug level\". If debug level is 0, no
To back up a bit, the problem with a defined?
function is that if you write
(defined? debug-level)
Scheme will attempt to evaluate debug-level
, which of course is an error since it is not defined. Such a form would have to be implemented internally by the compiler/interpreter as a special case.
Such a special form is not part of the R5RS standard (unless I missed it, please double-check). So with regard to R5RS schemes you are out of luck unless you find a Scheme that implements this as a non-standard extension.