1.11. Pattern Matching Tuples

It is also possible to pattern match tuples. Here is an example:
Start C++ section to tut/examples/tut120.flx[1 /1 ]
     1: include "std";
     2: val v = 1,2,(3,4);
     3: match (v) with
     4:   | (?x,_,?z) =>
     5:   {
     6:     print x;
     7:     print ", ";
     8:     match (z) with
     9:       | (?a,?b) =>
    10:       {
    11:         print "(";
    12:         print a;
    13:         print ", ";
    14:         print b;
    15:         print ")";
    16:       }
    17:     endmatch;
    18:   }
    19: endmatch;
    20: endl;
End C++ section to tut/examples/tut120.flx[1]
Notice the use of the special pattern '_', which matches something without naming it. The ?x designation in a pattern introduces a variable.