Data and Math
venum
A fixed set of possibilities, named plainly.
Released v1.0.0 · 2026-09-28use "stdlib/enum.ven"
Enumerated values that read like the choices they represent: define a named set, look a member up by ordinal and check that an ordinal is valid.
color = enum_define("Color", ["RED", "GREEN", "BLUE"])
print enum_name_of(color, 1)
print enum_is_valid(color, 2)
Reference (3 functions)
API reference
enum_define(name, member_names)
enum_define("Color", ["RED", "GREEN", "BLUE"])enum_name_of(enum_map, ordinal)
Looks up the member name that has the given ordinal in enum_map.
enum_name_of(enum_define("Color", ["RED", "GREEN", "BLUE"]), 1)enum_is_valid(enum_map, ordinal)
Tests whether ordinal belongs to a member of enum_map.
enum_is_valid(enum_define("Color", ["RED", "GREEN", "BLUE"]), 2)