$ Enumerate¶
x$y $[x;y]
Where
xis a symbol containing the name of a global variableddis a listyis a listd~distinct d- items of
yare all items ofd
returns y as an enumeration of d, using x as the name of the enumeration domain.
Using built-in Enumerate:
Values are stored as indices and so need less space.
Changing one lookup value (in d) has the same effect as changing those values in the enumeration, while the indices backing e are unchanged.
To get x and y from e:
Ensure all items of y are in d
When creating an enumeration using $, the domain of the enumeration must be in d, otherwise a cast error is signalled. In this example `c is not in the domain:
To expand the domain, use ? (Enum Extend) instead of $.
Errors¶
| error | cause |
|---|---|
| cast | item/s of y not in d |
Enum Extend,
Enumeration,
$ dollar
Q for Mortals §7.5 Enumerations , §8.5 Foreign Keys and Virtual Columns