and
Theand
filter is a binary infix filter that matches a position only if the filter to its left and the filter its right each match the position.
Thus, if left
and right
are filters, then
left and rightmatches a position exactly when the compound filter
{left right}matches the position. For example:
power A>5 and power a<3Whether to use
and
or a compound filter is a matter of taste. One difference is that the compound filter sometimes returns a value
but the and
filter never does.
Examples
Theand
filter is used for example in modelmate.cql , movedblackpieceecho.cql , and platzwechseln1.cql.
The file movedblackpieceecho.cql uses and
in the line
x==Mover and source:(x&_)This particular expression is true only if the set variable
x
has the same value as Mover
, and the x
intersects
the set of empty squares in the position represented by source
(see the : operator for a description of the meaning
of the :
here).