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

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

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

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