Implement a new automaton run (non optimized) with cleaner semantics w.r.t. ranked...
[tatoo.git] / src / naive_node_list.ml
diff --git a/src/naive_node_list.ml b/src/naive_node_list.ml
deleted file mode 100644 (file)
index 1b32c47..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-(***********************************************************************)
-(*                                                                     *)
-(*                               TAToo                                 *)
-(*                                                                     *)
-(*                     Kim Nguyen, LRI UMR8623                         *)
-(*                   Université Paris-Sud & CNRS                       *)
-(*                                                                     *)
-(*  Copyright 2010-2013 Université Paris-Sud and Centre National de la *)
-(*  Recherche Scientifique. All rights reserved.  This file is         *)
-(*  distributed under the terms of the GNU Lesser General Public       *)
-(*  License, with the special exception on linking described in file   *)
-(*  ../LICENSE.                                                        *)
-(*                                                                     *)
-(***********************************************************************)
-
-
-type node = Naive_tree.node
-type cell = { node : node;
-              mutable next : cell }
-
-type iterator = cell
-
-type t = { mutable length : int;
-           mutable head : cell;
-           mutable last : cell; }
-
-let rec nil = { node = Naive_tree.nil;
-                next = nil }
-
-let create () = { length = 0;
-                  head = nil;
-                  last = nil }
-
-let iter f l =
-  let rec loop c =
-    if c != nil then begin
-      f c.node;
-      loop c.next
-    end
-  in
-  loop l.head
-
-
-
-
-let length l = l.length
-let is_empty l = l.head == nil
-
-let pop l =
-  if is_empty l then failwith "pop"
-  else
-    let v = l.head.node in
-    let nhead = l.head.next in
-    l.head <- nhead;
-    if nhead == nil then l.last <- nil;
-    v
-
-
-
-let add n l =
-  let ncell = { node = n;
-                next = nil }
-  in
-  if l.head == nil then begin
-    l.head <- ncell;
-    l.last <- ncell;
-    l.length <- 1
-  end else begin
-    l.last.next <- ncell;
-    l.last <- ncell;
-    l.length <- l.length + 1
-  end
-
-let push_back n l = add n l
-let push_front n l =
-  let ncell = { node = n;
-                next = l.head }
-  in
-  if l.head == nil then begin
-    l.head <- ncell;
-    l.last <- ncell;
-    l.length <- 1;
-  end else begin
-    l.head <- ncell;
-    l.length <- l.length + 1;
-  end
-
-let append l1 l2 =
-  let len2 = l2.length in
-  if len2 != 0 then begin
-    l1.length <- l1.length + len2;
-    l1.last.next <- l2.head;
-    l1.last <- l2.last;
-  end;
-  l1
-
-let head l = l.head
-let last l = l.last
-let next i = i.next
-let value i = i.node
-let finished i = i == nil
-
-let copy l =
-  let rec loop l2 i =
-    if finished i then l2 else begin
-      add (value i) l2;
-      loop l2 (next i)
-    end
-  in
-  loop (create ()) (head l)