Next: , Previous: , Up: srfi eager-comp   [Index]


2.22.4 Specification

A comprehensions is a hygienic referentially transparent macro in the sense of R5RS Section 4.3. The macros extend the <expression>–syntax defined in R5RS Section 7.1.3. The main syntactic pattern used for defining a comprehension is <qualifier>, representing a generator or a filter. It is defined in Section “Qualifiers”.

The most important instances of <qualifier> are generators. These are defined in Section “Generators”. Generators come in three flavors, as typed generators (:list, :range, etc.), as the dispatching generator : (pronounced as “run through”), and as combined and modified generators (:parallel, :while, :until). Most generators in this SRFI also support an optional index variable counting the values being generated.

Finally, it is explained how to add a new application–specific comprehension, how to add a new application–specific typed generator, and how to add a new application–specific dispatching generator. As this concerns code unknown at the time this is being written, the explanation should not be taken as a specification in the literal sense. It rather suggests a convention to follow in order to ensure new comprehensions and generators blend seamlessly with the ones defined in this SRFI.