::=a symbol which is the name or alias of a SRFI
cond-expandform tests for the existence of features at macro-expansion time. It either expands into the body of one of its clauses or signals an error during syntactic processing.
cond-expandexpands into the body of the first clause whose feature requirement is currently satisfied; the
elseclause, if present, is selected if none of the previous clauses is selected.
A feature requirement has an obvious interpretation as a logical formula, where the
feature-identifiervariables have meaning true if the feature corresponding to the feature identifier, as specified in the SRFI registry, is in effect at the location of the
cond-expandform, and false otherwise. A feature requirement is satisfied if its formula is true under this interpretation.
Examples:(cond-expand ((and srfi-1 srfi-10) (write 1)) ((or srfi-1 srfi-10) (write 2)) (else))(cond-expand (command-line (define (program-name) (car (argv)))))
The second example assumes that
command-lineis an alias for some feature which gives access to command line arguments. Note that an error will be signaled at macro-expansion time if this feature is not present.
You can use
java-6to check for Java 6 or Java 7, respectively, at compile-time.
You can use
class-exists:to check if
exists at compile-time.
Returns a list of feature identifiers which
cond-expandtreats as true. This not a complete list - for example
class-exists:feature identifiers are not included. It is an error to modify this list. Here is example of what
featuresmight return:(features) ⇒ (complex exact-complex full-unicode java-6 kawa ratios srfi-0 srfi-4 srfi-6 srfi-8 srfi-9 srfi-11 srfi-16 srfi-17 srfi-23 srfi-25 srfi-26 srfi-28 srfi-30 srfi-39 string-normalize-unicode threads)
Read the contents of the file at
pathas a sequence of forms, and treat the result as if the resulting forms were the forms of a
include, except that the
pathis relative to the path of the source-file containing the