The UCG tuples modules can be imported like so let t = import "std/tuples.ucg";
and contains a number of useful operations on tuples.
The fields
module retrieves all the field names in a tuple. It has one
parameter.
tpl
which is required and is the tuple to process.let tpl = import "std/tuples.ucg"; tpl.fields{tpl={foo=1, bar=2}} == ["foo", "bar"];
The values
module retrieves all the values in a tuple. It has one parameter.
tpl
which is required and is the tuple to process.let tpl = import "std/tuples.ucg"; tpl.values{tpl={foo=1, bar=2}} == [1, 2];
The iter
module retrieves a list of all the field and value pairs in a tuple.
It has one parameter.
tpl
which is required and is the tuple to process.let tpl = import "std/tuples.ucg"; tpl.enumerate{tpl={foo=1, bar=2}} == [["foo", 1], ["bar", 2]];