When a variable pattern x
is matched against a value v
,
the variable x
is bound to the value v
.
When a variable pattern x
is matched against a type T
,
it produces the typing context { x
has type T
}.
{- Sum the elements of a pair -} val (x, y) = (3, 4) x + y {- OUTPUT: 7 -}
{- Convert pairs to lists -} ( (3,4) | (2,6) | (1,5) ) >(x,y)> [x,y] {- OUTPUT:PERMUTABLE: [1, 5] [2, 6] [3, 4] -}
Related Reference Topics
Related Tutorial Sections