Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

enum_type

form an enum type from an array of symbols

Synopsis

enum_type(a: [string]) -> type

Description

The enum_type function returns the enum type whose symbols are the strings in the array a in order, e.g., enum_type(["red","green"]) is <enum(red,green)>.

If a is empty or has a duplicate symbol, an error is returned.

Examples


Form an enum type

# spq
values enum_type(this)
# input
["red","green","blue"]
# expected output
<enum(red,green,blue)>