|
Metalang99 1.13.5
Full-blown preprocessor metaprogramming
|
Sequences: (x)(y)(z). More...

Go to the source code of this file.
Macros | |
| #define | ML99_seqIsEmpty(seq) |
True iff seq contains no elements (which means an empty preprocessing lexeme). | |
| #define | ML99_seqGet(i) |
Expands to a metafunction extracting the i -indexed element of seq. | |
| #define | ML99_seqTail(seq) |
Extracts the tail of seq. | |
| #define | ML99_seqForEach(f, seq) |
Applies f to each element in seq. | |
| #define | ML99_seqForEachI(f, seq) |
Applies f to each element in seq with an index. | |
| #define | ML99_SEQ_IS_EMPTY(seq) |
| #define | ML99_SEQ_GET(i) |
| #define | ML99_SEQ_TAIL(seq) |
Sequences: (x)(y)(z).
A sequence is represented as (...) (...) .... For example, these are sequences:
Sequences can represent syntax like X(...) Y(...) Z(...), where X, Y, and Z expand to a tuple, thereby forming a sequence. A perfect example is Interface99, which allows a user to define a software interface via a number of vfunc(...) macro invocations:
With vfunc being defined as follows (simplified):
| #define ML99_SEQ_GET | ( | i | ) |
| #define ML99_SEQ_IS_EMPTY | ( | seq | ) |
| #define ML99_SEQ_TAIL | ( | seq | ) |
| #define ML99_seqForEach | ( | f, | |
| seq ) |
Applies f to each element in seq.
The result is ML99_appl(f, x1) ... ML99_appl(f, xN).
| #define ML99_seqForEachI | ( | f, | |
| seq ) |
Applies f to each element in seq with an index.
The result is ML99_appl2(f, 0, x1) ... ML99_appl2(f, N - 1, xN).
| #define ML99_seqGet | ( | i | ) |
Expands to a metafunction extracting the i -indexed element of seq.
i can range from 0 to 7, inclusively.
| #define ML99_seqIsEmpty | ( | seq | ) |
True iff seq contains no elements (which means an empty preprocessing lexeme).
| #define ML99_seqTail | ( | seq | ) |
Extracts the tail of seq.
seq must contain at least one element. If seq contains only one element, the result is ML99_empty().