5.3. Tuple Pattern

Each element of a tuple pattern matches the corresponding element of a tuple value.

5.3.1. Syntax

[39]TuplePattern::= ( Pattern , , Pattern ) Tuple Size ≥ 2 ]

5.3.2. Type

When a tuple pattern ( P0 ,, Pn ) is matched against a tuple type ( T0 ,, Tn ), each Pi is matched against the corresponding Ti, producing typing contexts Γi. The typing context produced by the whole match is the union of the contexts Γi.

5.3.3. Examples

Filtering
{- Publish a signal for each tuple with a first value of true -}

((false, true) | (true, false) | (false, false)) >(true, _)> signal

{-
OUTPUT:
signal
-}
Pattern Publication
{- Publish 3, 6, and 9 in arbitrary order -}

(3,6,9)  >(x,y,z)>  ( x | y | z )

{-
OUTPUT:PERMUTABLE
3
6
9
-}

5.3.4. Related Links

Related Reference Topics

Related Tutorial Sections