cond-expand -- r7rs Definition syntax;
cond-expand (from vonuvoli);scheme:base -- (scheme base);scheme -- (scheme);(cond-expand <ce-clause_1> <ce-clause_2> ...)Syntax: The
cond-expandexpression type provides a way to statically expand different expressions depending on the implementation. A<ce-clause>takes the following form:(<feature-requirement> <expression> ...)The last clause can be an "else clause", which has the form:
(else <expression> ...)A
<feature-requirement>takes one of the following forms:
<feature-identifier>(library <library-name>)(and <feature-requirement> ...)(or <feature-requirement> ...)(not <feature-requirement>)Semantics: Each implementation maintains a list of feature identifiers which are present, as well as a list of libraries which can be imported. The value of a
<feature-requirement>is determined by replacing each<feature-identifier>and(library <library-name>)on the implementation's lists with#t, and all other feature identifiers and library names with#f, then evaluating the resulting expression as a Scheme boolean expression under the normal interpretation ofand,or, andnot.A
cond-expandis then expanded by evaluating the<feature-requirement>s of successive<ce-clause>s in order until one of them returns#t. When a true clause is found, the corresponding<expression>s are expanded to abegin, and the remaining clauses are ignored. If none of the<feature-requirement>s evaluate to#t, then if there is an else clause, its<expression>s are included. Otherwise, the behavior of thecond-expandis unspecified. Unlikecond,cond-expanddoes not depend on the value of any variables.The exact features provided are implementation-defined, but for portability a core set of features is given in appendix on standard feature identifiers.
The text herein was sourced and adapted as described in the "R7RS attribution of various text snippets" appendix.