is_map
From the SETL Wiki
| is_map | |
|---|---|
| Category | predicate |
| Syntax | prefix |
| Compatibility | |
| CIMS SETL | yes |
| SETL-S | yes |
| SETL2 | yes |
| GNU SETL | yes |
Contents |
Purpose
Determine whether the specified value is a map
Synopsis
is_map x
Description
Returns true if:
- x is a set and
- every element of x is a pair, i.e. a tuple of length 2 whose first element is not om.
SETL2 also allows a tuple of length 1 in a map, representing a key that is mapped to om.
Examples
-
is_map {['a', 1], ['b', 2]}Result: true
-
is_map {}Result: true
-
is_map {42}Result: false
-
is_map {['a', 1], 42}Result: false
-
is_map {['a', 1], [om, 2]}Result: false
-
is_map({['a', 1], ['b']})Result: true in SETL2, false in all other implementations. Note that SETL2 requires the parentheses around the operand.

