1 (***********************************************************************)
5 (* Kim Nguyen, LRI UMR8623 *)
6 (* Université Paris-Sud & CNRS *)
8 (* Copyright 2010-2013 Université Paris-Sud and Centre National de la *)
9 (* Recherche Scientifique. All rights reserved. This file is *)
10 (* distributed under the terms of the GNU Lesser General Public *)
11 (* License, with the special exception on linking described in file *)
14 (***********************************************************************)
17 type node = Naive_tree.node
18 type cell = { node : node;
23 type t = { mutable length : int;
25 mutable last : cell; }
27 let rec nil = { node = Naive_tree.nil;
30 let create () = { length = 0;
36 if c != nil then begin
44 let length l = l.length
45 let is_empty l = l.head == nil
48 let ncell = { node = n;
51 if l.head == nil then begin
58 l.length <- l.length + 1
61 let push_back n l = add n l
63 let ncell = { node = n;
66 if l.head == nil then begin
72 l.length <- l.length + 1;
79 let finished i = i == nil
83 if finished i then l2 else begin
88 loop (create ()) (head l)