in
From the SETL Wiki
| in | |
|---|---|
| Category | relational |
| Syntax | infix |
| Compatibility | |
| CIMS SETL | yes |
| SETL-S | yes |
| SETL2 | yes |
| GNU SETL | yes |
Contents |
Purpose
Check for membership of an element in a set or tuple, or a substring in a string.
Synopsis
x in y
Description
- If y is a set, determines whether x is an element of y. If x is om, returns false (not in SETL-S - see notes.)
- If y is a tuple, determines whether x occurs anywhere in y. If x is om, determines whether there is a "hole" in the tuple, i.e. om followed by a non-om element. (not in SETL-S.)
- If y is a string, x must be a string, and in returns true if x is a substring of y and false otherwise.
Examples
Notes
- in also has an iterator form, as in {2 ** x: x in {0 .. 31}}, but that is not considered to be a use of this primitive.
- SETL-S never permits om to appear on the left of in. If given om as an operand, it raises an error. Thus the in operator cannot be used in SETL-S to test whether a tuple contains a hole. See also differences between SETL implementations

