Tuples
A tuple is a collection of values, each of which can be of different type. Typically, each value is paired with an identifier, allowing a tuple to function similarly to a key-value store.
use std::debug::assert_eq;
tuple = (width = 10cm, depth = 10cm, volume = 1l);
assert_eq([tuple.width, 10cm]);
assert_eq([tuple.depth, 10cm]);
assert_eq([tuple.volume, 1l]);
assert_eq([tuple, (width = 10cm, depth = 10cm, volume = 1l)]);
Partially Named Tuples
A tuple may lack identifiers for some or even all of its values. In such cases, these unnamed values within the tuple must all be of different types.
(10cm, 10cm², 1l);
Otherwise, they would be indistinguishable since the values in a tuple do not adhere to a specific order.
Arbitrary Order
The order of values have no consequences for equality.
// these tuples are equal
std::debug::assert_eq([(1l, 10cm, 10cm²), (10cm, 10cm², 1l)]);
Arbitrary Units
Different units of values have no consequences for equality.
// these tuples are equal
std::debug::assert_eq([(1000cm3, 100mm, 0.01m²), (10cm, 100cm², 1l)]);
Ambiguous Elements
Either names or types must be unique in a tuple.
(10cm, 10mm, 1m); // error: ambiguous type Length