Records and Tuples
A Record groups Values by name, like a row of a table. A Tuple groups them by position.
Records
Section titled “Records”(name: "Ada", born: 1815) // {(born: 1815, name: "Ada")}The order of the fields does not matter, and the REPL lists them alphabetically. Read a field with .:
(name: "Ada", born: 1815).name // {"Ada"}A Record needs a Value in every field. With an empty Bag in a field, there is no Record:
(name: "Ada", born: num:{}) // an empty BagTuples
Section titled “Tuples”[3, 4].1 // {4}Positions start at 0.
A Map key -> value pairs two Values:
"pen" -> 12 // {"pen" -> 12}A Map is a Record with the fields k and v, and the REPL shows it that way: (k: "pen", v: 12).
("pen" -> 12).v // {12}A Bag of Records is a table
Section titled “A Bag of Records is a table”Reading a field of a Bag of Records reads it from every Record:
{ (name: "Ada", born: 1815) (name: "Alan", born: 1912)}.name // {"Ada", "Alan"}Next, describe which Values a Bag may hold.