set/element-of
Membership inclusion test (element in set)
Usage
R:=set/element-of(x, S)R:=x∈S
Description
Determines whether an element x is a member of set S.
This function returns a boolean value indicating whether x exists within the set.
It wraps Rust's IndexSet membership check, returning true if the element is found.
Input
Arguments:
x : T — the element being tested for membership.
S : set of T — the set to test against.
Element type constraints:
Tmust be hashable and comparable for equality (Eq+Hashin Rust).Common scalar kinds: integers, strings, symbols, booleans.
Output
Result:
R : boolean — true if
xis an element ofS, otherwise false.
Examples
True — element is in the set
False — element not in the set
Symbols or strings
Details
Set semantics:
The set treats elements as unique based on hash and equality.
Duplicates are ignored in the set.
Relation logic:
Returns true if the element exists in the set.
Symbolic shorthand:
x ∈ Sis equivalent toset/element-of(x, S).
Performance:
Average O(1) time per lookup using hashing.
Determinism:
Results are deterministic across runs and platforms.
Errors
Incorrect number of arguments (expects two).
Unsupported element type (not hashable or comparable).
Type mismatch between
xand elements ofS.