Skip to content


For a long list containing few distinct values, an enumeration can reduce storage requirements. The ‘manual’ way to create an enum (for understanding, not recommended):

q)show e:"i"$x?y;
0 1 2 1 0 1 2 2 2 2 2 2 2i  /these values are what we store instead of y.
q)x e                       /get back the symbols any time from x and e.
q)`x!e / same result as `x$y 

Create, extend and resolve enumerations using these operators:

operator name semantics
$ Enumerate create an enumeration
? Enum Extend extend an enumeration
! Enumeration resolve values from an enumeration

Q for Mortals §7.5 Enumerations