Records

Posted by Beetle B. on Tue 02 August 2016

Example:

val x = {k1=3, k2=false}

Ordering of keys does not matter.

You can nest records.

The type is: {k1:int, k2:bool}.

You use #k1 to access the value.

A tuple is just a record with keys 1, 2, etc. It is just syntactic sugar for a key. The type t1*t2*t3 is just shorthand for {1:t1, 2:t2, 3:t3}.