Commit 99e197b8 authored by POGODALLA Sylvain's avatar POGODALLA Sylvain
Browse files

Comments in the mli added

parent cbd504b4
......@@ -14,6 +14,8 @@ sig
| Infix
| Binder
(** The two types of abstraction *)
type abstraction =
| Linear
| Non_linear
......
......@@ -9,10 +9,7 @@ module type TABLE =
exception Not_found
exception Conflict
type 'a t
type key = int
(* val create : unit -> 'a t
val insert : int -> 'a -> 'a t -> 'a t
val lookup : int -> 'a t -> 'a *)
type key
val empty : 'a t
val add : ?override:bool -> key -> 'a -> 'a t -> 'a t
val find : key -> 'a t -> 'a
......@@ -25,8 +22,6 @@ module Make_table (Base : BASE)=
exception Not_found
exception Conflict
(* type 'a option = None | Some of 'a *)
type 'a t =
Nil
| T of ('a option * 'a t) array
......
module type BASE =
sig
val b : int
end
(** This module implements a functor returning an {e non-funtional}
lookup table when provided with a given size *)
(** The signature module for modules providing size *)
module type BASE =
sig
(** The size value *)
val b : int
end
(** The signature module for tables *)
module type TABLE =
sig
exception Not_found
exception Conflict
type 'a t
type key = int
(* val create : unit -> 'a t
val insert : int -> 'a -> 'a t -> 'a t
val lookup : int -> 'a t -> 'a *)
val empty : 'a t
(** the optional value override is set to false by default. When set
to [true], the [add] function does not raise [Conflict] if some value
was already associated to the key *)
val add : ?override:bool -> key -> 'a -> 'a t -> 'a t
sig
(** Exceptions raised by functions *)
exception Not_found
exception Conflict
(** The type of the tables *)
type 'a t
(** The type of the key *)
type key
(** [empty] returns the empty table *)
val empty : 'a t
(** [add k v t] modifies the table [t] to add the element [v] at key
[k]. The optional value [override] is set to false by
default. When set to false, the [add] function raises
{!Table.TABLE.Conflict} when the key [k] was already associated
with some value. When set to [true], the [add] function does not
raise [!Table.TABLE.Conflict] if some value was already
associated to the key *)
val add : ?override:bool -> key -> 'a -> 'a t -> 'a t
(** [find k t] returns the element associated with the key [k] in
[t]. Raises {!Table.TABLE.Not_found} if no such element exists
*)
val find : key -> 'a t -> 'a
(** [fold f a t] returns [f kn vn (f kn-1 vn-1 (...(f k1 v1 a)
...))] where the [ki] and [vi] are the associated values in
[t]. The elements are listed in order wrt. to the key *)
val fold : (key -> 'a -> 'b -> 'b) -> 'b -> 'a t -> 'b
end
module Make_table (Base : BASE) : TABLE
(** This modules provides the functor *)
module Make_table (Base : BASE) : TABLE with type key=int
module Tries :
sig
exception Not_found
exception Conflict
type 'a t
type key=string
val empty : 'a t
val add : ?override:bool -> key -> 'a -> 'a t -> 'a t
val find : key -> 'a t -> 'a
val fold : (key -> 'a -> 'b -> 'b) -> 'b -> 'a t -> 'b
end
(** This modules implements the tries *)
module Tries : Table.TABLE with type key=string
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment