|
Metalang99 1.13.5
Full-blown preprocessor metaprogramming
|
Boolean algebra. More...

Go to the source code of this file.
Macros | |
| #define | ML99_true(...) ML99_callUneval(ML99_true, ) |
| Truth. | |
| #define | ML99_false(...) ML99_callUneval(ML99_false, ) |
| Falsehood. | |
| #define | ML99_not(x) ML99_call(ML99_not, x) |
| Logical negation. | |
| #define | ML99_and(x, y) ML99_call(ML99_and, x, y) |
| Logical conjunction. | |
| #define | ML99_or(x, y) ML99_call(ML99_or, x, y) |
| Logical inclusive OR. | |
| #define | ML99_xor(x, y) ML99_call(ML99_xor, x, y) |
| Logical exclusive OR. | |
| #define | ML99_boolEq(x, y) ML99_call(ML99_boolEq, x, y) |
Tests x and y for equality. | |
| #define | ML99_boolMatch(x, matcher) ML99_call(ML99_boolMatch, x, matcher) |
Matches x against the two cases: if it is 0 or 1. | |
| #define | ML99_boolMatchWithArgs(x, matcher, ...) ML99_call(ML99_boolMatchWithArgs, x, matcher, __VA_ARGS__) |
| The same as ML99_boolMatch but provides additional arguments to all branches. | |
| #define | ML99_if(cond, x, y) ML99_call(ML99_if, cond, x, y) |
If cond is true, evaluates to x, otherwise y. | |
| #define | ML99_IF(cond, x, y) ML99_PRIV_UNTUPLE(ML99_PRIV_IF(cond, (x), (y))) |
| The plain version of ML99_if. | |
| #define | ML99_TRUE(...) 1 |
| #define | ML99_FALSE(...) 0 |
| #define | ML99_NOT(x) ML99_PRIV_NOT(x) |
| #define | ML99_AND(x, y) ML99_PRIV_AND(x, y) |
| #define | ML99_OR(x, y) ML99_PRIV_OR(x, y) |
| #define | ML99_XOR(x, y) ML99_PRIV_XOR(x, y) |
| #define | ML99_BOOL_EQ(x, y) ML99_PRIV_BOOL_EQ(x, y) |
Boolean algebra.
| #define ML99_and | ( | x, | |
| y | |||
| ) | ML99_call(ML99_and, x, y) |
Logical conjunction.
| #define ML99_boolEq | ( | x, | |
| y | |||
| ) | ML99_call(ML99_boolEq, x, y) |
| #define ML99_boolMatch | ( | x, | |
| matcher | |||
| ) | ML99_call(ML99_boolMatch, x, matcher) |
Matches x against the two cases: if it is 0 or 1.
f with ML99_call, so no partial application occurs, and so arity specifiers are not needed. | #define ML99_boolMatchWithArgs | ( | x, | |
| matcher, | |||
| ... | |||
| ) | ML99_call(ML99_boolMatchWithArgs, x, matcher, __VA_ARGS__) |
The same as ML99_boolMatch but provides additional arguments to all branches.
| #define ML99_if | ( | cond, | |
| x, | |||
| y | |||
| ) | ML99_call(ML99_if, cond, x, y) |
| #define ML99_IF | ( | cond, | |
| x, | |||
| y | |||
| ) | ML99_PRIV_UNTUPLE(ML99_PRIV_IF(cond, (x), (y))) |
The plain version of ML99_if.
This macro can imitate lazy evaluation: ML99_IF(<cond>, <term>, <another-term>) will expand to one of the two terms, which can be evaluated further; if <cond> is 0, then <term> will not be evaluated, and the same with <another-term>.
x and y can possibly expand to commas. It means that you can supply ML99_TERMS(...) as a branch, for example. | #define ML99_not | ( | x | ) | ML99_call(ML99_not, x) |
| #define ML99_or | ( | x, | |
| y | |||
| ) | ML99_call(ML99_or, x, y) |