sequence.cd 436 Bytes
Newer Older
1 2
(* Sequence are just defined with pairs and the atom `nil;
   the following notation are equivalent: *)
3 4 5
let l1 = (1,2,3,`nil)
let l2 = (1,(2,(3,`nil)))
let l3 = [ 1 2 3 ]
6 7

(* The [...] notation allow to specify a tail after a semi-colon : *)
8 9
let l4 = (10,20,l1)
let l5 = [ 10 20 ; l1 ]
10 11

(* Concatenation @ *)
12
let l6 = [ 1 2 3 ] @ [ 4 5 6 ]
13 14

(* Inside [...], it is possible to escape a subsequence with a ! *)
15
let l7 = [ 1 2 !l6 !l1 5 ]