Vocabularyalien.syntaxSyntaxENUM: type words... ;
ENUM: type < base-type words...
Inputs and outputs| type | a name to typedef to int or f |
| words | a sequence of word names |
Word descriptionCreates a c-type that boxes and unboxes integer values to symbols. A symbol is defined for each member word. The base c-type can optionally be specified and defaults to
int. A constructor word
<type> is defined for converting from integers to singletons. The generic word
enum>number converts from singletons to integers. Enum-typed values are automatically prettyprinted as their singleton words. Unrecognizing enum numbers are kept as numbers.
ExamplesHere is an example enumeration definition:
ENUM: color_t red { green 3 } blue ;
The following expression returns true:
3 <color_t> [ green = ] [ enum>number 3 = ] bi and
See alsodefine-enum,
enum>number,
number>enumDefinition