logical and set-theoretic operations
Filters may be combined using standard logical operations: not, and and or:
filter syntax | logical operation | example | description |
---|---|---|---|
{filter_{1} filter_{2}...} | and | {check Ka3 ka1} |
each filter_{i} must match the current position for this filter to match |
not filter | not | not check |
matches only if the argument filter does not match |
filter_{1} or filter_{2} | or | check or attack (A q) |
either filter_{1} or filter_{2} (or both) must match the current position. |
CQL also supports certain set-theoretic operations when all the argument filters are set filters. Each of these filters is a set filter whose associated set is the result of applying the given set-theoretic operation to its arguments:
set filter syntax | set operation | example | description |
---|---|---|---|
not set_filter | complementation | not A |
set of squares not in the set set_filter |
set_filter_{1} on set_filter_{2} | intersection | attack (Q a) on attack (R a) |
intersection of sets set_filter_{1} and set_filter_{2} |
set_filter_{1} or set_filter_{2} | union | attack (Q a) or attack (q A) |
union of sets denoted by set_filter_{1} and set_filter_{2} |
Note that not
and or
are each set filters only if each of their arguments is also a set filter.