In addition to tuples and lists, the Orc language has a third native data structure, called a record.
A record expression is a comma-separated sequence of elements of the form
k = E, enclosed by
record braces {. and .}, where each k is an identifier called a key,
and each E is an expression.
Records may have any number of fields, including zero. Each expression is executed
and its first published value is taken; the value of the whole record expression is a
record containing a pairing of each key with its associated value.
Order is irrelevant.
If any of the expressions are silent, then the whole record expression is silent.
Examples
{. zero = 3 - 3, one = 0 + 1 .} publishes {. zero = 0, one = 1 .}.{. .} publishes {. .}, the empty record.
Elements of records are accessed using the dot (.) syntax
described earlier.
The expression r.k publishes the value paired with key k in record r.
If k is not present in r, the expression is silent.
Suppose r = {. x = 0, y = 1 .}
Examples
r.x publishes 0.r.y publishes 1.r.z is silent.
Like tuples and lists, records can also be matched by a pattern. However, unlike other patterns, a record pattern does not need to name all of the keys in the record being matched; it only needs to match a subset.
Suppose r = {. x = 0, y = 1, z = 2 .}
Examples
r >{. y = a, x = b .}> (a,b) publishes (1,0).r >{. y = a, w = b .}> (a,b) is silent.