Jeremy Wall 2134d79f0d DOCS: Formatting and organization changes.
Additionally:

* Added an overview
* Expanded the docs for the NULL type.
2019-02-25 19:02:23 -06:00

979 B

+++ title = "Tuple Operations" weight = 2 sort_by = "weight" in_search_index = true +++

The UCG tuples modules can be imported like so let t = import "std/tuples.ucg"; and contains a number of useful operations on tuples.

fields

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"];

values

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];

iter

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]];