(index ("make-environment" 0) ("environment-copy" 311) ("environment?" 1375) ("interaction-environment?" 1496) ("environment-empty?" 1654) ("environment-extendable?" 1910) ("environment-has-binding?" 2058) ("environment-includes?" 2244) ("environment-mutable?" 2531) ("environment-set-mutable!" 2822) ("environment-ref" 3144) ("environment-set!" 3425) ("environment-extend!" 3818) ("environment-remove!" 4443) ("environment-symbols" 5248) ("environment-for-each" 5395))
(def (sig (procedure "(make-environment [EXTENSIBLE?])" (id make-environment))) (p "Returns a fresh, empty environment. If " (tt "EXTENSIBLE?") " is " (tt "#t") ", then evaluated code can create new bindings inside this environment.") (p (tt "EXTENSIBLE?") " is " (tt "boolean") ". Default is " (tt "#f") "."))
(def (sig (procedure "(environment-copy ENV [EXTENSIBLE? [SYMBOLS [MUTABLE?]]])" (id environment-copy))) (p "Returns a copy of the environment " (tt "ENV") ".") (p (tt "EXTENSIBLE?") " is a " (tt "boolean") ". Default is " (tt "#f") ".") (p (tt "SYMBOLS") " is a " (tt "list") " of " (tt "symbol") ", or " (tt "#f") ". Default is " (tt "#f") ".") (p (tt "MUTABLE?") " is a " (tt "boolean") ". Default is " (tt "EXTENSIBLE?") ".") (p "If " (tt "EXTENSIBLE?") " is " (tt "#t") ", then evaluated code can create new variable bindings inside the environment.") (p "If " (tt "SYMBOLS") " is not " (tt "#f") ", then the environment copy will only contain those symbols from the environment " (tt "ENV") ". Otherwise a full copy is made.") (p "If " (tt "MUTABLE?") " is " (tt "#t") ", then evaluated code can set the copied bindings in the environment. If " (tt "EXTENSIBLE?") " is not supplied then the copied variable's mutable property is used.") (p (i "Note") " that the only way to supply a " (tt "MUTABLE?") " value is to supply an " (tt "EXTENSIBLE?") " value."))
(def (sig (procedure "(environment? X) => boolean" (id environment?))) (p "Is " (tt "X") " an evaluation environment?"))
(def (sig (procedure "(interaction-environment? X) => boolean" (id interaction-environment?))) (p "Is " (tt "X") " the " (tt "interaction-environment") "?"))
(def (sig (procedure "(environment-empty? ENV) => boolean" (id environment-empty?))) (p "Is the environment " (tt "ENV") " sans bindings?") (p "When " (tt "ENV") " is the " (tt "(interaction-environment)") " this procedure always returns " (tt "#f") "."))
(def (sig (procedure "(environment-extendable? ENV) => boolean" (id environment-extendable?))) (p "Is the environment " (tt "ENV") " extensible?"))
(def (sig (procedure "(environment-has-binding? ENV SYMBOL) => boolean" (id environment-has-binding?))) (p "Is the variable " (tt "SYMBOL") " bound in the environment " (tt "ENV") "?"))
(def (sig (procedure "(environment-includes? ENV SYMBOL) => boolean" (id environment-includes?))) (p "Is a variable " (tt "SYMBOL") " in the environment " (tt "ENV") "?") (p "When " (tt "ENV") " is the " (tt "(interaction-environment)") " this procedure always returns " (tt "#t") "."))
(def (sig (procedure "(environment-mutable? ENV SYMBOL) => boolean" (id environment-mutable?))) (p "Is the variable " (tt "SYMBOL") " in environment " (tt "ENV") " mutable?") (p "When " (tt "ENV") " is the " (tt "(interaction-environment)") " this procedure always returns " (tt "#t") "."))
(def (sig (procedure "(environment-set-mutable! ENV SYMBOL MUTABLE?)" (id environment-set-mutable!))) (p "Makes the variable " (tt "SYMBOL") " in environment " (tt "ENV") " mutable, if " (tt "MUTABLE?") " is " (tt "#t") ", immutable otherwise.") (p "No effect when called with the " (tt "(interaction-environment)") "."))
(def (sig (procedure "(environment-ref ENV SYMBOL) => *" (id environment-ref))) (p "Returns the value of the variable " (tt "SYMBOL") " in environment " (tt "ENV") ".") (p "If the environment does not contain the variable, or if the variable is not bound, an error is signaled."))
(def (sig (procedure "(environment-set! ENV SYMBOL VALUE)" (id environment-set!))) (p "Updates the binding " (tt "SYMBOL") " in environment " (tt "ENV") " with " (tt "VALUE") ". A non-existent binding will be created as mutable.") (p "It is an error to attempt to create a new binding in an inextensible environment.") (p "Changing the value of an existing immutable variable will succeed."))
(def (sig (procedure "(environment-extend! ENV SYMBOL [VALUE [MUTABLE?]])" (id environment-extend!))) (p "Adds a new binding " (tt "SYMBOL") " in environment " (tt "ENV") ".") (p "If the optional argument " (tt "MUTABLE?") " is not given or " (tt "#t") ", then the binding is mutable and can be changed by evaluating " (tt "(set! VARIABLE ...)") ".") (p "The variable " (tt "SYMBOL") " is initialized to " (tt "VALUE") ", or is unbound, if " (tt "VALUE") " is not given.") (p "Here the creation of a new variable in an inextensible environment will succeed.") (p "Changing the value of an immutable variable will succeed."))
(def (sig (procedure "(environment-remove! ENV SYMBOLS [SILENT? [INEXTENSIBLE?]])" (id environment-remove!))) (p "Removes bindings " (tt "SYMBOLS") " in environment " (tt "ENV") ".") (p (tt "SYMBOLS") " is a " (tt "list") " of " (tt "symbol") ", or a " (tt "symbol") ".") (p (tt "SILENT?") " is a " (tt "boolean") ". Default is " (tt "#f") ".") (p (tt "INEXTENSIBLE?") " is a " (tt "boolean") ". Default is " (tt "#t") ".") (p "Wiil not remove from an inextensible environment, unless " (tt "INEXTENSIBLE?") " is " (tt "#t") ".") (p "It is an error to attempt to remove an undefined symbol, unless " (tt "SILENT?") " is " (tt "#t") ".") (p "It is an error to attempt to remove from an inextensible environment when " (tt "INEXTENSIBLE?") " is " (tt "#f") ", unless " (tt "SILENT?") " is " (tt "#t") "."))
(def (sig (procedure "(environment-symbols ENV) => list" (id environment-symbols))) (p "Returns a list of the symbols in the given environment."))
(def (sig (procedure "(environment-for-each ENV PROC)" (id environment-for-each))) (p "Calls " (tt "PROC") " with each binding in the given environment.") (p (tt "PROC") " is a " (tt "(procedure (symbol *))") " where the first argument is the variable name and the second is the value."))
