Pattern matching: on tuples
Means of decomposing compound values
Reuse constructor syntax to take values apart
val x = (false,17);
val (a,b) = x;
val a = false : bool;
val b = 17 : int;
val (false,c) = x;
val c = 17 : int;
val (true,w) = x;
exception: nonexhaustive binding failure
Previous slide
Next slide
Back to first slide
View graphic version