Builtin

exists

exists(a, attr)
exists(a)

Returns true if any of the specified attr for tuples in relation a are true.

If the relation has only one attribute then it is used and no attr need be specified.

can be used instead of exists.

Examples

$P{*, heavy:=WEIGHT>12}
heavyPNOPNAMECOLORWEIGHTCITY
falseP1NutRed12London
falseP5CamBlue12Paris
trueP2BoltGreen17Paris
trueP3ScrewBlue17Rome
trueP4ScrewRed14London
trueP6CogRed19London
None
exists($P{*, heavy:=WEIGHT>12}[PNO="P0"], heavy)
false

Some
exists($P{*, heavy:=WEIGHT>12}, heavy)
true