diff --git a/Item.mli b/Item.mli deleted file mode 100644 index 27a1f08..0000000 --- a/Item.mli +++ /dev/null @@ -1,6 +0,0 @@ -module type S = - sig - type t - val compare : t -> t -> int - val to_string : t -> string - end diff --git a/Partition.mli b/Partition.mli index cc6aa2d..657b3c0 100644 --- a/Partition.mli +++ b/Partition.mli @@ -1,11 +1,11 @@ (** This module offers the abstract data type of a partition of classes of equivalent items (Union & Find). *) -(** The items are of type [PrintOrdType.t], that is, they have to obey +(** The items are of type [Item.t], that is, they have to obey a total order, but also they must be printable to ease - debugging. The signature [PrintOrdType] is the input signature of + debugging. The signature [Item] is the input signature of the functor {!Partition.Make}. *) -module type PrintOrdType = +module type Item = sig (** Type of items *) type t @@ -61,4 +61,4 @@ module type S = val is_equiv : item -> item -> partition -> bool end -module Make (Ord : PrintOrdType) : S with type item = Ord.t +module Make (Ord : Item) : S with type item = Ord.t diff --git a/Partition0.ml b/Partition0.ml index 691c400..968bb8d 100644 --- a/Partition0.ml +++ b/Partition0.ml @@ -1,6 +1,6 @@ (* Naive persistent implementation of Union/Find: O(n^2) worst case *) -module Make (Item: Item.S) = +module Make (Item: Partition.Item) = struct type item = Item.t diff --git a/Partition1.ml b/Partition1.ml index c9eea51..764d98d 100644 --- a/Partition1.ml +++ b/Partition1.ml @@ -6,7 +6,7 @@ height of [i] (_not_ [j]). *) -module Make (Item: Item.S) = +module Make (Item: Partition.Item) = struct type item = Item.t diff --git a/Partition2.ml b/Partition2.ml index ae61466..e1372b2 100644 --- a/Partition2.ml +++ b/Partition2.ml @@ -1,7 +1,7 @@ (** Persistent implementation of the Union/Find algorithm with height-balanced forests and without path compression. *) -module Make (Item: Item.S) = +module Make (Item: Partition.Item) = struct type item = Item.t diff --git a/Partition3.ml b/Partition3.ml index 1d90536..d6e2cb4 100644 --- a/Partition3.ml +++ b/Partition3.ml @@ -1,7 +1,7 @@ (* Destructive implementation of union/find with height-balanced forests but without path compression: O(n*log(n)). *) -module Make (Item: Item.S) = +module Make (Item: Partition.Item) = struct type item = Item.t diff --git a/build.sh b/build.sh index dbc9804..8453429 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,5 @@ #!/bin/sh set -x -ocamlfind ocamlc -strict-sequence -w +A-48-4 -c Item.mli ocamlfind ocamlc -strict-sequence -w +A-48-4 -c Partition.mli ocamlfind ocamlopt -strict-sequence -w +A-48-4 -c Partition0.ml ocamlfind ocamlopt -strict-sequence -w +A-48-4 -c Partition2.ml