1.25. Generic Structs and Unions

Felix structs and unions can be generic too. Here is a simple example.
Start felix section to tut/examples/tut_beg135e.flx[1 /1 ]
     1: #line 1243 "./lpsrc/flx_tutorial.pak"
     2: #import <flx.flxh>
     3: union list[T] =
     4:   | Cons of T * list[T]
     5:   | Empty
     6: ;
     7: 
     8: struct pair[T,U] =
     9: {
    10:   fst : T;
    11:   snd : U;
    12: }
    13: 
    14: var x = Cons[int] (1,Empty[int]);
    15: x =  Cons[int] (2,x);
    16: x = Cons[int] (3,x);
    17: 
    18: val y = pair[int,int] (1,2);
    19: print y.fst; print ","; print y.snd; endl;
    20: 
End felix section to tut/examples/tut_beg135e.flx[1]