Skip to content
Bill Hails edited this page May 10, 2026 · 4 revisions

Tuples

Tuples are collections of values, they differ from lists in a couple of ways

  1. The length of a tuple is fixed and is part of its type.
  2. individual values in a tuple can have different types.

Tuples are written between round braces with a leading hash, for example

#(1, 'a', "hello")

is a 3-tuple of (int, char, list(char)).

Tuples are useful when a typedef would be overkill, and additionally you can unpack tuples by direct assignment within a let, for example

let
    fn multiValue() {
        #(1, 2, 3)
    }
in {
    let
        #(a, b, c) = multiValue();
    in
       assert(a == 1 and b == 2 and c == 3)
}

Next: Functions.

Clone this wiki locally