Next: , Up: linux   [Index]


7.1 Feature–based expansion

Syntax: cond-expand (?feature-requirement ?body0 ?body …) …

Process the given clauses in left–to–right order and expand to the sequence of ?body forms from the first clause for which the ?feature-requirement is satisfied.

This syntax supports all the features defined by cond-expand from SRFI-0 (see Features supported by Vicare), and in addition it supports a feature for each system function exported by (vicare linux); such features use the identifier exported by the library as feature requirement.

As example, if we want to run code whether or not waitid is implemented we write the following:

(import (vicare)
  (prefix (vicare linux) lx.))

(lx.cond-expand
  (lx.waitid
   (do-something))
  (else
   (do-something-else)))