InExpression ::= Expression IN Expression
The IN operator takes two operands, and checks whether the first is one of the elements of the second (which must be a list, otherwise the script aborts).
For instance, given lists aList and anotherList
initialized as:
aList := {"Darius", 12, 20, VOID, 10};
anotherList :=
{"Darius", 12, 20, VOID, {1,2,3,FALSE, 10}};
the assertion:
ASSERT 10 IN aList
will succeed, while
ASSERT 10 IN anotherList
will fail, since 10 is not one of the anotherList's element.
To check whether 10 is an element of one of
anotherList's elements, one must write:
ASSERT THERE_IS IN (anotherList | SYS.IsList(X)) :- 10 IN X;
One must first filter anotherList to retain only those
of its elements that are lists, since applying the IN operator
on a value which is not a list would result in a typing error
and the script's brutal termination.