From cde776f4ac0b636b21af8c5977956d85e96d4b33 Mon Sep 17 00:00:00 2001 From: nathan moreau Date: Sun, 21 Jan 2018 20:29:51 +0100 Subject: [PATCH] Small typos --- src/data/CCBV.mli | 40 +++++++-------- src/data/CCBitField.mli | 18 +++---- src/data/CCCache.mli | 12 ++--- src/data/CCDeque.mli | 56 ++++++++++----------- src/data/CCFQueue.mli | 44 ++++++++--------- src/data/CCGraph.mli | 62 +++++++++++------------ src/data/CCHashSet.mli | 44 ++++++++--------- src/data/CCHashTrie.mli | 37 +++++++------- src/data/CCHet.mli | 6 +-- src/data/CCImmutArray.mli | 8 +-- src/data/CCIntMap.mli | 12 ++--- src/data/CCMixmap.mli | 26 +++++----- src/data/CCMixset.mli | 6 +-- src/data/CCMixtbl.mli | 24 ++++----- src/data/CCMultiMap.ml | 25 +--------- src/data/CCMultiMap.mli | 85 ++++++++++++-------------------- src/data/CCMultiSet.mli | 26 +++++----- src/data/CCPersistentArray.mli | 22 ++++----- src/data/CCPersistentHashtbl.mli | 28 +++++------ src/data/CCRAL.mli | 62 +++++++++++------------ src/data/CCRingBuffer.mli | 36 +++++++------- src/data/CCSimple_queue.mli | 22 ++++----- src/data/CCTrie.mli | 24 ++++----- src/data/CCWBTree.mli | 25 +++++----- src/data/CCZipper.mli | 28 +++++------ src/threads/CCBlockingQueue.mli | 20 ++++---- src/threads/CCLock.mli | 32 ++++++------ src/threads/CCPool.mli | 40 +++++++-------- src/threads/CCSemaphore.mli | 14 +++--- src/threads/CCThread.mli | 18 +++---- src/threads/CCTimer.mli | 12 ++--- 31 files changed, 434 insertions(+), 480 deletions(-) diff --git a/src/data/CCBV.mli b/src/data/CCBV.mli index cfb7a65f..be0b3053 100644 --- a/src/data/CCBV.mli +++ b/src/data/CCBV.mli @@ -16,13 +16,13 @@ type t (** A resizable bitvector *) val empty : unit -> t -(** Empty bitvector *) +(** Empty bitvector. *) val create : size:int -> bool -> t -(** Create a bitvector of given size, with given default value *) +(** Create a bitvector of given size, with given default value. *) val copy : t -> t -(** Copy of bitvector *) +(** Copy of bitvector. *) val cardinal : t -> int (** Number of bits set to one, seen as a set of bits. *) @@ -51,7 +51,7 @@ val set : t -> int -> unit (** Set i-th bit, extending the bitvector if needed. *) val get : t -> int -> bool -(** Is the i-th bit true? Returns false if the index is too high*) +(** Is the i-th bit true? Returns false if the index is too high. *) val reset : t -> int -> unit (** Set i-th bit to 0, extending the bitvector if needed. *) @@ -60,20 +60,20 @@ val flip : t -> int -> unit (** Flip i-th bit, extending the bitvector if needed. *) val clear : t -> unit -(** Set every bit to 0 *) +(** Set every bit to 0. *) val iter : t -> (int -> bool -> unit) -> unit -(** Iterate on all bits *) +(** Iterate on all bits. *) val iter_true : t -> (int -> unit) -> unit -(** Iterate on bits set to 1 *) +(** Iterate on bits set to 1. *) val to_list : t -> int list -(** List of indexes that are true *) +(** List of indexes that are true. *) val to_sorted_list : t -> int list (** Same as {!to_list}, but also guarantees the list is sorted in - increasing order *) + increasing order. *) val of_list : int list -> t (** From a list of true bits. @@ -87,12 +87,12 @@ val first : t -> int option val first_exn : t -> int (** First set bit, or - @raise Not_found if all bits are 0 + @raise Not_found if all bits are 0. @since 1.2 *) val filter : t -> (int -> bool) -> unit (** [filter bv p] only keeps the true bits of [bv] whose [index] - satisfies [p index] *) + satisfies [p index]. *) val negate_self : t -> unit (** [negate_self t] flips all of the bits in [t]. @@ -103,28 +103,26 @@ val negate : t -> t (** [negate t] returns a copy of [t] with all of the bits flipped. *) val union_into : into:t -> t -> unit -(** [union ~into bv] sets [into] to the union of itself and [bv]. - +(** [union_into ~into bv] sets [into] to the union of itself and [bv]. Also updates the length of [into] to be at least [length bv]. *) val inter_into : into:t -> t -> unit -(** [inter ~into bv] sets [into] to the intersection of itself and [bv] - +(** [inter_into ~into bv] sets [into] to the intersection of itself and [bv]. Also updates the length of [into] to be at most [length bv]. *) val union : t -> t -> t -(** [union bv1 bv2] returns the union of the two sets *) +(** [union bv1 bv2] returns the union of the two sets. *) val inter : t -> t -> t -(** [inter bv1 bv2] returns the intersection of the two sets *) +(** [inter bv1 bv2] returns the intersection of the two sets. *) val diff_into : into:t -> t -> unit -(** [diff ~into t] Modify [into] with only the bits set but not in [t]. +(** [diff_into ~into t] modifies [into] with only the bits set but not in [t]. @since 1.2 *) val diff : t -> t -> t -(** [diff t1 t2] Return those bits found [t1] but not in [t2]. +(** [diff t1 t2] returns those bits found in [t1] but not in [t2]. @since 1.2 *) @@ -135,7 +133,7 @@ val select : t -> 'a array -> 'a list selected. *) val selecti : t -> 'a array -> ('a * int) list -(** Same as {!select}, but selected elements are paired with their index *) +(** Same as {!select}, but selected elements are paired with their indexes. *) type 'a sequence = ('a -> unit) -> unit @@ -143,5 +141,5 @@ val to_seq : t -> int sequence val of_seq : int sequence -> t val pp : Format.formatter -> t -> unit -(** Print the bitvector as a string of bits +(** Print the bitvector as a string of bits. @since 0.13 *) diff --git a/src/data/CCBitField.mli b/src/data/CCBitField.mli index 6821855e..9607e6f4 100644 --- a/src/data/CCBitField.mli +++ b/src/data/CCBitField.mli @@ -25,13 +25,13 @@ *) exception TooManyFields -(** Raised when too many fields are packed into one bitfield *) +(** Raised when too many fields are packed into one bitfield. *) exception Frozen -(** Raised when a frozen bitfield is modified *) +(** Raised when a frozen bitfield is modified. *) val max_width : int -(** System-dependent maximum width for a bitfield, typically 30 or 62 *) +(** System-dependent maximum width for a bitfield, typically 30 or 62. *) (** {2 Bitfield Signature} *) module type S = sig @@ -40,25 +40,25 @@ module type S = sig should create a new, incompatible type *) val empty : t - (** Empty bitfields (all bits 0) *) + (** Empty bitfields (all bits 0). *) type field val get : field -> t -> bool - (** Get the value of this field *) + (** Get the value of this field. *) val set : field -> bool -> t -> t - (** Set the value of this field *) + (** Set the value of this field. *) val mk_field : unit -> field - (** Make a new field *) + (** Make a new field. *) val freeze : unit -> unit (** Prevent new fields from being added. From now on, creating - a field will raise Frozen *) + a field will raise Frozen. *) val total_width : unit -> int - (** Current width of the bitfield *) + (** Current width of the bitfield. *) end (** Create a new bitfield type *) diff --git a/src/data/CCCache.mli b/src/data/CCCache.mli index 4d1121b5..b2e7b590 100644 --- a/src/data/CCCache.mli +++ b/src/data/CCCache.mli @@ -29,7 +29,7 @@ type 'a hash = 'a -> int type ('a, 'b) t val clear : (_,_) t -> unit -(** Clear the content of the cache *) +(** Clear the content of the cache. *) type ('a, 'b) callback = in_cache:bool -> 'a -> 'b -> unit (** Type of the callback that is called once a cached value is found @@ -44,7 +44,7 @@ val with_cache : ?cb:('a, 'b) callback -> ('a, 'b) t -> ('a -> 'b) -> 'a -> 'b cache [c]. It always returns the same value as [f x], if [f x] returns, or raise the same exception. However, [f] may not be called if [x] is in the cache. - @param cb called after the value is generated or retrieved *) + @param cb called after the value is generated or retrieved. *) val with_cache_rec : ?cb:('a, 'b) callback -> ('a,'b) t -> (('a -> 'b) -> 'a -> 'b) -> 'a -> 'b (** [with_cache_rec c f] is a function that first, applies [f] to @@ -61,7 +61,7 @@ val with_cache_rec : ?cb:('a, 'b) callback -> ('a,'b) t -> (('a -> 'b) -> 'a -> fib 70;; ]} - @param cb called after the value is generated or retrieved + @param cb called after the value is generated or retrieved. *) val size : (_,_) t -> int @@ -72,18 +72,18 @@ val iter : ('a,'b) t -> ('a -> 'b -> unit) -> unit (** Iterate on cached values. Should yield [size cache] pairs. *) val add : ('a, 'b) t -> 'a -> 'b -> bool -(** Manually add a cached value. Returns [true] if the value has succesfully +(** Manually add a cached value. Returns [true] if the value has successfully been added, and [false] if the value was already bound. @since 1.5 *) val dummy : ('a,'b) t -(** Dummy cache, never stores any value *) +(** Dummy cache, never stores any value. *) val linear : eq:'a equal -> int -> ('a, 'b) t (** Linear cache with the given size. It stores key/value pairs in an array and does linear search at every call, so it should only be used with small size. - @param eq optional equality predicate for keys *) + @param eq optional equality predicate for keys. *) val replacing : eq:'a equal -> ?hash:'a hash -> int -> ('a,'b) t diff --git a/src/data/CCDeque.mli b/src/data/CCDeque.mli index a615cad6..c0b6b8c3 100644 --- a/src/data/CCDeque.mli +++ b/src/data/CCDeque.mli @@ -4,7 +4,7 @@ (** {1 Imperative deque} This structure provides fast access to its front and back elements, - with O(1) operations*) + with O(1) operations *) type 'a t (** Contains 'a elements, queue in both ways *) @@ -12,10 +12,10 @@ type 'a t exception Empty val create : unit -> 'a t -(** New deque *) +(** New deque. *) val clear : _ t -> unit -(** Remove all elements +(** Remove all elements. @since 0.13 *) val is_empty : 'a t -> bool @@ -24,52 +24,52 @@ val is_empty : 'a t -> bool val equal : eq:('a -> 'a -> bool) -> 'a t -> 'a t -> bool (** [equal a b] checks whether [a] and [b] contain the same sequence of elements. - @param eq comparison function for elements + @param eq comparison function for elements. @since 0.13 *) val compare : cmp:('a -> 'a -> int) -> 'a t -> 'a t -> int (** [compare a b] compares lexicographically [a] and [b] - @param cmp comparison function for elements + @param cmp comparison function for elements. @since 0.13 *) val length : 'a t -> int -(** Number of elements - used to be linear time, now constant time *) +(** Number of elements. + Used to be linear time, now constant time. *) val push_front : 'a t -> 'a -> unit -(** Push value at the front *) +(** Push value at the front. *) val push_back : 'a t -> 'a -> unit -(** Push value at the back *) +(** Push value at the back. *) val peek_front : 'a t -> 'a -(** First value, or @raise Empty if empty *) +(** First value, or @raise Empty if empty. *) val peek_back : 'a t -> 'a -(** Last value, or @raise Empty if empty *) +(** Last value, or @raise Empty if empty. *) val take_back : 'a t -> 'a -(** Take last value, or @raise Empty if empty *) +(** Take last value, or @raise Empty if empty. *) val take_front : 'a t -> 'a -(** Take first value, or @raise Empty if empty *) +(** Take first value, or @raise Empty if empty. *) val append_front : into:'a t -> 'a t -> unit (** [append_front ~into q] adds all elements of [q] at the front - of [into] - O(length q) in time + of [into]. + [O(length q)] in time. @since 0.13 *) val append_back : into:'a t -> 'a t -> unit (** [append_back ~into q] adds all elements of [q] at the back of [into]. - O(length q) in time + [O(length q)] in time. @since 0.13 *) val iter : ('a -> unit) -> 'a t -> unit -(** Iterate on elements *) +(** Iterate on elements. *) val fold : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b -(** Fold on elements +(** Fold on elements. @since 0.13 *) (** {2 Conversions} *) @@ -80,36 +80,36 @@ type 'a sequence = ('a -> unit) -> unit val of_seq : 'a sequence -> 'a t (** Create a deque from the sequence. @since 0.13 optional argument [deque] disappears, use - {!add_seq_back} instead *) + {!add_seq_back} instead. *) val to_seq : 'a t -> 'a sequence -(** iterate on the elements *) +(** Iterate on the elements. *) val of_gen : 'a gen -> 'a t -(** [of_gen g] makes a deque containing the elements of [g] +(** [of_gen g] makes a deque containing the elements of [g]. @since 0.13 *) val to_gen : 'a t -> 'a gen -(** Iterates on elements of the deque +(** Iterate on elements of the deque. @since 0.13 *) val add_seq_front : 'a t -> 'a sequence -> unit (** [add_seq_front q seq] adds elements of [seq] into the front of [q], in reverse order. - O(n) in time, where [n] is the number of elements to add. + [O(n)] in time, where [n] is the number of elements to add. @since 0.13 *) val add_seq_back : 'a t -> 'a sequence -> unit (** [add_seq_back q seq] adds elements of [seq] into the back of [q], in order. - O(n) in time, where [n] is the number of elements to add. + [O(n)] in time, where [n] is the number of elements to add. @since 0.13 *) val copy : 'a t -> 'a t -(** Fresh copy, O(n) in time *) +(** Fresh copy, [O(n)] in time. *) val of_list : 'a list -> 'a t -(** Conversion from list, in order +(** Conversion from list, in order. @since 0.13 *) val to_list : 'a t -> 'a list @@ -117,7 +117,7 @@ val to_list : 'a t -> 'a list @since 0.13 *) val to_rev_list : 'a t -> 'a list -(** Efficient conversion to list, in reverse order +(** Efficient conversion to list, in reverse order. @since 0.13 *) (** {2 print} *) @@ -125,5 +125,5 @@ val to_rev_list : 'a t -> 'a list type 'a printer = Format.formatter -> 'a -> unit val pp : 'a printer -> 'a t printer -(** Print the elements +(** Print the elements. @since 0.13 *) diff --git a/src/data/CCFQueue.mli b/src/data/CCFQueue.mli index 9f87978b..4fce8b7d 100644 --- a/src/data/CCFQueue.mli +++ b/src/data/CCFQueue.mli @@ -24,67 +24,67 @@ val doubleton : 'a -> 'a -> 'a t exception Empty val cons : 'a -> 'a t -> 'a t -(** Push element at the front of the queue *) +(** Push element at the front of the queue. *) val snoc : 'a t -> 'a -> 'a t -(** Push element at the end of the queue *) +(** Push element at the end of the queue. *) val take_front : 'a t -> ('a * 'a t) option -(** Get and remove the first element *) +(** Get and remove the first element. *) val take_front_exn : 'a t -> ('a * 'a t) (** Same as {!take_front}, but fails on empty queues. - @raise Empty if the queue is empty *) + @raise Empty if the queue is empty. *) val take_front_l : int -> 'a t -> 'a list * 'a t (** [take_front_l n q] takes at most [n] elements from the front - of [q], and returns them wrapped in a list - @raise Invalid_argument if n<0 *) + of [q], and returns them wrapped in a list. + @raise Invalid_argument if n<0. *) val take_front_while : ('a -> bool) -> 'a t -> 'a list * 'a t val take_back : 'a t -> ('a t * 'a) option -(** Take last element *) +(** Take last element. *) val take_back_exn : 'a t -> ('a t * 'a) (** Same as {!take_back}, but fails on empty queues. - @raise Empty if the queue is empty *) + @raise Empty if the queue is empty. *) val take_back_l : int -> 'a t -> 'a t * 'a list (** [take_back_l n q] removes and returns the last [n] elements of [q]. The elements are in the order of the queue, that is, the head of the returned list is the first element to appear via {!take_front}. - [take_back_l 2 (of_list [1;2;3;4]) = of_list [1;2], [3;4]] - @raise Invalid_argument if n<0 *) + [take_back_l 2 (of_list [1;2;3;4]) = of_list [1;2], [3;4]]. + @raise Invalid_argument if n<0. *) val take_back_while : ('a -> bool) -> 'a t -> 'a t * 'a list (** {2 Individual extraction} *) val first : 'a t -> 'a option -(** First element of the queue *) +(** First element of the queue. *) val last : 'a t -> 'a option -(** Last element of the queue *) +(** Last element of the queue. *) val first_exn : 'a t -> 'a (** Same as {!first} but - @raise Empty if the queue is empty *) + @raise Empty if the queue is empty. *) val last_exn : 'a t -> 'a val nth : int -> 'a t -> 'a option -(** Return the [i]-th element of the queue in logarithmic time *) +(** Return the [i]-th element of the queue in logarithmic time. *) val nth_exn : int -> 'a t -> 'a -(** Unsafe version of {!nth} - @raise Not_found if the index is wrong *) +(** Unsafe version of {!nth}. + @raise Not_found if the index is wrong. *) val tail : 'a t -> 'a t -(** Queue deprived of its first element. Does nothing on empty queues *) +(** Queue deprived of its first element. Does nothing on empty queues. *) val init : 'a t -> 'a t -(** Queue deprived of its last element. Does nothing on empty queues *) +(** Queue deprived of its last element. Does nothing on empty queues. *) (** {2 Global Operations} *) @@ -94,17 +94,17 @@ val append : 'a t -> 'a t -> 'a t Linear in the size of the second queue. *) val rev : 'a t -> 'a t -(** Reverse the queue, O(n) complexity +(** Reverse the queue, [O(n)] complexity. @since 0.10 *) val map : ('a -> 'b) -> 'a t -> 'b t -(** Map values *) +(** Map values. *) val (>|=) : 'a t -> ('a -> 'b) -> 'b t -(** Synonym to {!map} *) +(** Synonym to {!map}. *) val size : 'a t -> int -(** Number of elements in the queue (constant time) *) +(** Number of elements in the queue (constant time). *) val fold : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b diff --git a/src/data/CCGraph.mli b/src/data/CCGraph.mli index 18a34bc6..95f6a9d6 100644 --- a/src/data/CCGraph.mli +++ b/src/data/CCGraph.mli @@ -32,7 +32,7 @@ type 'a sequence_once = 'a sequence (** Sequence that should be used only once *) exception Sequence_once -(** Raised when a sequence meant to be used once is used several times *) +(** Raised when a sequence meant to be used once is used several times. *) module Seq : sig type 'a t = 'a sequence @@ -55,7 +55,7 @@ type ('v, 'e) t = ('v -> ('e * 'v) sequence) type ('v, 'e) graph = ('v, 'e) t val make : ('v -> ('e * 'v) sequence) -> ('v, 'e) t -(** Make a graph by providing the children function *) +(** Make a graph by providing the children function. *) (** {2 Tags} @@ -78,10 +78,10 @@ type ('k, 'a) table = { type 'a set = ('a, unit) table val mk_table: eq:('k -> 'k -> bool) -> ?hash:('k -> int) -> int -> ('k, 'a) table -(** Default implementation for {!table}: a {!Hashtbl.t} *) +(** Default implementation for {!table}: a {!Hashtbl.t}. *) val mk_map: cmp:('k -> 'k -> int) -> unit -> ('k, 'a) table -(** Use a {!Map.S} underneath *) +(** Use a {!Map.S} underneath. *) (** {2 Bags of vertices} *) @@ -97,7 +97,7 @@ val mk_stack: unit -> 'a bag val mk_heap: leq:('a -> 'a -> bool) -> 'a bag (** [mk_heap ~leq] makes a priority queue where [leq x y = true] means that - [x] is smaller than [y] and should be prioritary *) + [x] is smaller than [y] and should be prioritary. *) (** {2 Traversals} *) @@ -149,7 +149,7 @@ module Traverse : sig Yields each vertex paired with its distance to the set of initial vertices (the smallest distance needed to reach the node from the initial vertices) @param dist distance from origin of the edge to destination, - must be strictly positive. Default is 1 for every edge *) + must be strictly positive. Default is 1 for every edge. *) val dijkstra_tag : ?dist:('e -> int) -> tags:'v tag_set -> @@ -180,15 +180,15 @@ module Traverse : sig 'v sequence -> ('v,'e) t sequence_once (** Full version of DFS. - @param eq equality predicate on vertices *) + @param eq equality predicate on vertices. *) val dfs_tag: eq:('v -> 'v -> bool) -> tags:'v tag_set -> graph:('v, 'e) graph -> 'v sequence -> ('v,'e) t sequence_once - (** Full version of DFS using integer tags - @param eq equality predicate on vertices *) + (** Full version of DFS using integer tags. + @param eq equality predicate on vertices. *) end end @@ -218,12 +218,12 @@ val topo_sort : eq:('v -> 'v -> bool) -> element of [l] is reachable from [seq]. The list is sorted in a way such that if [v -> v'] in the graph, then [v] comes before [v'] in the list (i.e. has a smaller index). - Basically [v -> v'] means that [v] is smaller than [v'] - see {{: https://en.wikipedia.org/wiki/Topological_sorting} wikipedia} - @param eq equality predicate on vertices (default [(=)]) + Basically [v -> v'] means that [v] is smaller than [v']. + See {{: https://en.wikipedia.org/wiki/Topological_sorting} wikipedia}. + @param eq equality predicate on vertices (default [(=)]). @param rev if true, the dependency relation is inverted ([v -> v'] means - [v'] occurs before [v]) - @raise Has_cycle if the graph is not a DAG *) + [v'] occurs before [v]). + @raise Has_cycle if the graph is not a DAG. *) val topo_sort_tag : eq:('v -> 'v -> bool) -> ?rev:bool -> @@ -231,7 +231,7 @@ val topo_sort_tag : eq:('v -> 'v -> bool) -> graph:('v, 'e) t -> 'v sequence -> 'v list -(** Same as {!topo_sort} but uses an explicit tag set *) +(** Same as {!topo_sort} but uses an explicit tag set. *) (** {2 Lazy Spanning Tree} *) @@ -251,7 +251,7 @@ val spanning_tree : tbl:'v set -> 'v -> ('v, 'e) Lazy_tree.t (** [spanning_tree ~graph v] computes a lazy spanning tree that has [v] - as a root. The table [tbl] is used for the memoization part *) + as a root. The table [tbl] is used for the memoization part. *) val spanning_tree_tag : tags:'v tag_set -> graph:('v, 'e) t -> @@ -261,7 +261,7 @@ val spanning_tree_tag : tags:'v tag_set -> (** {2 Strongly Connected Components} *) type 'v scc_state -(** Hidden state for {!scc} *) +(** Hidden state for {!scc}. *) val scc : tbl:('v, 'v scc_state) table -> graph:('v, 'e) t -> @@ -272,8 +272,8 @@ val scc : tbl:('v, 'v scc_state) table -> in the graph. The components are explored in a topological order (if C1 and C2 are components, and C1 points to C2, then C2 will be yielded before C1). - Uses {{: https://en.wikipedia.org/wiki/Tarjan's_strongly_connected_components_algorithm} Tarjan's algorithm} - @param tbl table used to map nodes to some hidden state + Uses {{: https://en.wikipedia.org/wiki/Tarjan's_strongly_connected_components_algorithm} Tarjan's algorithm}. + @param tbl table used to map nodes to some hidden state. @raise Sequence_once if the result is iterated on more than once. *) @@ -314,10 +314,10 @@ module Dot : sig Format.formatter -> 'v -> unit - (** Print the graph, starting from given vertex, on the formatter - @param attrs_v attributes for vertices - @param attrs_e attributes for edges - @param name name of the graph *) + (** Print the graph, starting from given vertex, on the formatter. + @param attrs_v attributes for vertices. + @param attrs_e attributes for edges. + @param name name of the graph. *) val pp_seq : tbl:('v,vertex_state) table -> eq:('v -> 'v -> bool) -> @@ -330,7 +330,7 @@ module Dot : sig unit val with_out : string -> (Format.formatter -> 'a) -> 'a - (** Shortcut to open a file and write to it *) + (** Shortcut to open a file and write to it. *) end (** {2 Mutable Graph} *) @@ -345,7 +345,7 @@ val mk_mut_tbl : eq:('v -> 'v -> bool) -> ?hash:('v -> int) -> int -> ('v, 'a) mut_graph -(** Make a new mutable graph from a Hashtbl. Edges are labelled with type ['a] *) +(** Make a new mutable graph from a Hashtbl. Edges are labelled with type ['a]. *) (** {2 Immutable Graph} @@ -359,7 +359,7 @@ module type MAP = sig type 'a t val as_graph : 'a t -> (vertex, 'a) graph - (** Graph view of the map *) + (** Graph view of the map. *) val empty : 'a t @@ -368,12 +368,12 @@ module type MAP = sig val remove_edge : vertex -> vertex -> 'a t -> 'a t val add : vertex -> 'a t -> 'a t - (** Add a vertex, possibly with no outgoing edge *) + (** Add a vertex, possibly with no outgoing edge. *) val remove : vertex -> 'a t -> 'a t (** Remove the vertex and all its outgoing edges. Edges that point to the vertex are {b NOT} removed, they must be - manually removed with {!remove_edge} *) + manually removed with {!remove_edge}. *) val union : 'a t -> 'a t -> 'a t @@ -401,15 +401,15 @@ module Map(O : Map.OrderedType) : MAP with type vertex = O.t val of_list : eq:('v -> 'v -> bool) -> ('v * 'v) list -> ('v, unit) t (** [of_list l] makes a graph from a list of pairs of vertices. Each pair [(a,b)] is an edge from [a] to [b]. - @param eq equality used to compare vertices *) + @param eq equality used to compare vertices. *) val of_hashtbl : ('v, 'v list) Hashtbl.t -> ('v, unit) t (** [of_hashtbl tbl] makes a graph from a hashtable that maps vertices - to lists of children *) + to lists of children. *) val of_fun : ('v -> 'v list) -> ('v, unit) t (** [of_fun f] makes a graph out of a function that maps a vertex to the list of its children. The function is assumed to be deterministic. *) val divisors_graph : (int, unit) t -(** [n] points to all its strict divisors *) +(** [n] points to all its strict divisors. *) diff --git a/src/data/CCHashSet.mli b/src/data/CCHashSet.mli index c689c7bd..d009ea04 100644 --- a/src/data/CCHashSet.mli +++ b/src/data/CCHashSet.mli @@ -14,72 +14,72 @@ module type S = sig type elt val create : int -> t - (** [create n] makes a new set with the given capacity [n] *) + (** [create n] makes a new set with the given capacity [n]. *) val singleton : elt -> t - (** [singleton x] is the singleton [{x}] *) + (** [singleton x] is the singleton [{x}]. *) val clear : t -> unit - (** [clear s] removes all elements from [s] *) + (** [clear s] removes all elements from [s]. *) val copy : t -> t - (** Fresh copy *) + (** Fresh copy. *) val copy_into : into:t -> t -> unit - (** [copy_into ~into s] copies all elements of [s] into [into] *) + (** [copy_into ~into s] copies all elements of [s] into [into]. *) val insert : t -> elt -> unit - (** [insert s x] adds [x] into [s] *) + (** [insert s x] adds [x] into [s]. *) val remove : t -> elt -> unit - (** Remove the element, if it were in there *) + (** Remove the element, if it were in there. *) val cardinal : t -> int - (** [cardinal s] returns the number of elements in [s] *) + (** [cardinal s] returns the number of elements in [s]. *) val mem : t -> elt -> bool - (** [mem s x] returns [true] iff [x] is in [s] *) + (** [mem s x] returns [true] iff [x] is in [s]. *) val find_exn : t -> elt -> elt (** [find_exn s x] returns [y] if [x] and [y] are equal, and [mem s y]. - @raise Not_found if [x] not in [s] *) + @raise Not_found if [x] not in [s]. *) val find : t -> elt -> elt option - (** Safe version of {!find_exn} *) + (** Safe version of {!find_exn}. *) val inter : t -> t -> t - (** [inter a b] returns [a ∩ b] *) + (** [inter a b] returns [a ∩ b]. *) val inter_mut : into:t -> t -> unit - (** [inter_mut ~into a] changes [into] into [a ∩ into] *) + (** [inter_mut ~into a] changes [into] into [a ∩ into]. *) val union : t -> t -> t - (** [union a b] returns [a ∪ b] *) + (** [union a b] returns [a ∪ b]. *) val union_mut : into:t -> t -> unit - (** [union_mut ~into a] changes [into] into [a ∪ into] *) + (** [union_mut ~into a] changes [into] into [a ∪ into]. *) val diff : t -> t -> t - (** [diff a b] returns [a - b] *) + (** [diff a b] returns [a - b]. *) val subset : t -> t -> bool - (** [subset a b] returns [true] if all elements of [a] are in [b] *) + (** [subset a b] returns [true] if all elements of [a] are in [b]. *) val equal : t -> t -> bool - (** [equal a b] is extensional equality ([a] and [b] have the same elements) *) + (** [equal a b] is extensional equality ([a] and [b] have the same elements). *) val for_all : (elt -> bool) -> t -> bool val exists : (elt -> bool) -> t -> bool val iter : (elt -> unit) -> t -> unit - (** Iterate on values *) + (** Iterate on values. *) val fold : ('a -> elt -> 'a) -> 'a -> t -> 'a - (** Fold on values *) + (** Fold on values. *) val elements : t -> elt list - (** List of elements *) + (** List of elements. *) val of_list : elt list -> t @@ -91,7 +91,7 @@ module type S = sig val pp : ?sep:string -> elt printer -> t printer (** [pp pp_elt] returns a set printer, given a printer for - individual elements *) + individual elements. *) end module type ELEMENT = sig diff --git a/src/data/CCHashTrie.mli b/src/data/CCHashTrie.mli index 16e99060..662af8ec 100644 --- a/src/data/CCHashTrie.mli +++ b/src/data/CCHashTrie.mli @@ -28,28 +28,28 @@ module Transient : sig is called, [r] cannot be used to modify the structure again. *) val create : unit -> t - (** Create a new, active ID *) + (** Create a new, active ID. *) val equal : t -> t -> bool - (** Equality between IDs *) + (** Equality between IDs. *) val frozen : t -> bool (** [frozen i] returns [true] if [freeze i] was called before. In this case, the ID cannot be used for modifications again. *) val active : t -> bool - (** [active i] is [not (frozen i)] *) + (** [active i] is [not (frozen i)]. *) val freeze : t -> unit (** [freeze i] makes [i] unusable for new modifications. The values created with [i] will now be immutable. *) val with_ : (t -> 'a) -> 'a - (** [Transient.with_ f] creates a transient ID [i], calls [f i], + (** [with_ f] creates a transient ID [i], calls [f i], freezes the ID [i] and returns the result of [f i]. *) exception Frozen - (** Raised when a frozen ID is used *) + (** Raised when a frozen ID is used. *) end (** {2 Signature} *) @@ -71,7 +71,7 @@ module type S = sig val get : key -> 'a t -> 'a option val get_exn : key -> 'a t -> 'a - (** @raise Not_found if key not present *) + (** @raise Not_found if key not present. *) val remove : key -> 'a t -> 'a t (** Remove the key, if present. *) @@ -79,29 +79,29 @@ module type S = sig val update : key -> f:('a option -> 'a option) -> 'a t -> 'a t (** [update k ~f m] calls [f (Some v)] if [get k m = Some v], [f None] otherwise. Then, if [f] returns [Some v'] it binds [k] to [v'], - if [f] returns [None] it removes [k] *) + if [f] returns [None] it removes [k]. *) val add_mut : id:Transient.t -> key -> 'a -> 'a t -> 'a t (** [add_mut ~id k v m] behaves like [add k v m], except it will mutate in place whenever possible. Changes done with an [id] might affect all versions of the structure obtained with the same [id] (but not other versions). - @raise Transient.Frozen if [id] is frozen *) + @raise Transient.Frozen if [id] is frozen. *) val remove_mut : id:Transient.t -> key -> 'a t -> 'a t - (** Same as {!remove}, but modifies in place whenever possible - @raise Transient.Frozen if [id] is frozen *) + (** Same as {!remove}, but modifies in place whenever possible. + @raise Transient.Frozen if [id] is frozen. *) val update_mut : id:Transient.t -> key -> f:('a option -> 'a option) -> 'a t -> 'a t - (** Same as {!update} but with mutability - @raise Transient.Frozen if [id] is frozen *) + (** Same as {!update} but with mutability. + @raise Transient.Frozen if [id] is frozen. *) val cardinal : _ t -> int val choose : 'a t -> (key * 'a) option val choose_exn : 'a t -> key * 'a - (** @raise Not_found if not pair was found *) + (** @raise Not_found if not pair was found. *) val iter : f:(key -> 'a -> unit) -> 'a t -> unit @@ -114,14 +114,14 @@ module type S = sig val add_list : 'a t -> (key * 'a) list -> 'a t val add_list_mut : id:Transient.t -> 'a t -> (key * 'a) list -> 'a t - (** @raise Frozen if the ID is frozen *) + (** @raise Frozen if the ID is frozen. *) val of_list : (key * 'a) list -> 'a t val add_seq : 'a t -> (key * 'a) sequence -> 'a t val add_seq_mut : id:Transient.t -> 'a t -> (key * 'a) sequence -> 'a t - (** @raise Frozen if the ID is frozen *) + (** @raise Frozen if the ID is frozen. *) val of_seq : (key * 'a) sequence -> 'a t @@ -130,7 +130,7 @@ module type S = sig val add_gen : 'a t -> (key * 'a) gen -> 'a t val add_gen_mut : id:Transient.t -> 'a t -> (key * 'a) gen -> 'a t - (** @raise Frozen if the ID is frozen *) + (** @raise Frozen if the ID is frozen. *) val of_gen : (key * 'a) gen -> 'a t @@ -139,12 +139,13 @@ module type S = sig (** {6 IO} *) val pp : key printer -> 'a printer -> 'a t printer - (** Renamed from [val print] @since NEXT_RELEASE *) + (** Renamed from [val print]. + @since NEXT_RELEASE *) val as_tree : 'a t -> [`L of int * (key * 'a) list | `N ] ktree (** For debugging purpose: explore the structure of the tree, with [`L (h,l)] being a leaf (with shared hash [h]) - and [`N] an inner node *) + and [`N] an inner node. *) end (** {2 Type for keys} *) diff --git a/src/data/CCHet.mli b/src/data/CCHet.mli index 51ea0fe9..2bb400c1 100644 --- a/src/data/CCHet.mli +++ b/src/data/CCHet.mli @@ -17,7 +17,7 @@ module Key : sig val create : unit -> 'a t val equal : 'a t -> 'a t -> bool - (** Compare two keys that have compatible types *) + (** Compare two keys that have compatible types. *) end type pair = @@ -38,7 +38,7 @@ module Tbl : sig val find : t -> 'a Key.t -> 'a option val find_exn : t -> 'a Key.t -> 'a - (** @raise Not_found if the key is not in the table *) + (** @raise Not_found if the key is not in the table. *) val iter : (pair -> unit) -> t -> unit @@ -72,7 +72,7 @@ module Map : sig val find : 'a Key.t -> t -> 'a option val find_exn : 'a Key.t -> t -> 'a - (** @raise Not_found if the key is not in the table *) + (** @raise Not_found if the key is not in the table. *) val iter : (pair -> unit) -> t -> unit diff --git a/src/data/CCImmutArray.mli b/src/data/CCImmutArray.mli index 7b06b23e..0383cfa0 100644 --- a/src/data/CCImmutArray.mli +++ b/src/data/CCImmutArray.mli @@ -24,17 +24,17 @@ val singleton : 'a -> 'a t val doubleton : 'a -> 'a -> 'a t val make : int -> 'a -> 'a t -(** [make n x] makes an array of [n] times [x] *) +(** [make n x] makes an array of [n] times [x]. *) val init : int -> (int -> 'a) -> 'a t (** [init n f] makes the array [[| f 0; f 1; ... ; f (n-1) |]]. - @raise Invalid_argument if [n < 0] *) + @raise Invalid_argument if [n < 0]. *) val get : 'a t -> int -> 'a -(** Access the element *) +(** Access the element. *) val set : 'a t -> int -> 'a -> 'a t -(** Copy the array and modify its copy *) +(** Copy the array and modify its copy. *) val sub : 'a t -> int -> int -> 'a t (** [sub a start len] returns a fresh array of length len, containing the elements diff --git a/src/data/CCIntMap.mli b/src/data/CCIntMap.mli index 731759eb..2036ddb9 100644 --- a/src/data/CCIntMap.mli +++ b/src/data/CCIntMap.mli @@ -19,8 +19,8 @@ val mem : int -> _ t -> bool val find : int -> 'a t -> 'a option val find_exn : int -> 'a t -> 'a -(** Same as {!find} but unsafe - @raise Not_found if key not present *) +(** Same as {!find} but unsafe. + @raise Not_found if key is not present. *) val add : int -> 'a -> 'a t -> 'a t @@ -28,17 +28,17 @@ val remove : int -> 'a t -> 'a t val equal : eq:('a -> 'a -> bool) -> 'a t -> 'a t -> bool (** [equal ~eq a b] checks whether [a] and [b] have the same set of pairs - (key, value), comparing values with [eq] + (key, value), comparing values with [eq]. @since 0.13 *) val compare : cmp:('a -> 'a -> int) -> 'a t -> 'a t -> int -(** Total order between maps; the precise order is unspecified . +(** Total order between maps; the precise order is unspecified. @since 0.13 *) val update : int -> ('a option -> 'a option) -> 'a t -> 'a t val cardinal : _ t -> int -(** Number of bindings in the map. Linear time *) +(** Number of bindings in the map. Linear time. *) val iter : (int -> 'a -> unit) -> 'a t -> unit @@ -53,7 +53,7 @@ val map : ('a -> 'b) -> 'a t -> 'b t val choose : 'a t -> (int * 'a) option val choose_exn : 'a t -> int * 'a -(** @raise Not_found if not pair was found *) +(** @raise Not_found if not pair was found. *) val union : (int -> 'a -> 'a -> 'a) -> 'a t -> 'a t -> 'a t diff --git a/src/data/CCMixmap.mli b/src/data/CCMixmap.mli index dbb0a44c..829330f9 100644 --- a/src/data/CCMixmap.mli +++ b/src/data/CCMixmap.mli @@ -37,9 +37,9 @@ type 'a injection val create_inj : unit -> 'a injection (** Return a value that works for a given type of values. This function is - normally called once for each type of value. Several keys may be + normally called once for each type of value. Several keys may be created for the same type, but a value set with a given setter can only be - retrieved with the matching getter. The same key can be reused + retrieved with the matching getter. The same key can be reused across multiple maps (although not in a thread-safe way). *) module type S = sig @@ -49,50 +49,50 @@ module type S = sig (** A map containing values of different types, indexed by {!key}. *) val empty : t - (** Empty map *) + (** Empty map. *) val get : inj:'a injection -> key -> t -> 'a option (** Get the value corresponding to this key, if it exists and - belongs to the same key *) + belongs to the same key. *) val add : inj:'a injection -> key -> 'a -> t -> t - (** Bind the key to the value, using [inj] *) + (** Bind the key to the value, using [inj]. *) val find : inj:'a injection -> key -> t -> 'a (** Find the value for the given key, which must be of the right type. @raise Not_found if either the key is not found, or if its value - doesn't belong to the right type *) + doesn't belong to the right type. *) val cardinal : t -> int - (** Number of bindings *) + (** Number of bindings. *) val remove : key -> t -> t - (** Remove the binding for this key *) + (** Remove the binding for this key. *) val mem : inj:_ injection-> key -> t -> bool (** Is the given key in the map, with the right type? *) val iter_keys : f:(key -> unit) -> t -> unit - (** Iterate on the keys of this map *) + (** Iterate on the keys of this map. *) val fold_keys : f:('a -> key -> 'a) -> x:'a -> t -> 'a - (** Fold over the keys *) + (** Fold over the keys. *) (** {2 Iterators} *) type 'a sequence = ('a -> unit) -> unit val keys_seq : t -> key sequence - (** All the keys *) + (** All the keys. *) val bindings_of : inj:'a injection -> t -> (key * 'a) sequence - (** All the bindings that come from the corresponding injection *) + (** All the bindings that come from the corresponding injection. *) type value = | Value : ('a injection -> 'a option) -> value val bindings : t -> (key * value) sequence - (** Iterate on all bindings *) + (** Iterate on all bindings. *) end module type ORD = sig diff --git a/src/data/CCMixset.mli b/src/data/CCMixset.mli index 7f7f2619..e51eee5c 100644 --- a/src/data/CCMixset.mli +++ b/src/data/CCMixset.mli @@ -45,8 +45,8 @@ val get : key:'a key -> t -> 'a option (** [get ~key set] obtains the value for [key] in [set], if any. *) val get_exn : key:'a key -> t -> 'a -(** Same as {!get}, but can fail - @raise Not_found if the key is not present *) +(** Same as {!get}, but can fail. + @raise Not_found if the key is not present. *) val cardinal : t -> int -(** Number of mappings *) +(** Number of mappings. *) diff --git a/src/data/CCMixtbl.mli b/src/data/CCMixtbl.mli index c35fa810..099d3090 100644 --- a/src/data/CCMixtbl.mli +++ b/src/data/CCMixtbl.mli @@ -53,49 +53,49 @@ val create_inj : unit -> 'b injection val get : inj:'b injection -> 'a t -> 'a -> 'b option (** Get the value corresponding to this key, if it exists and - belongs to the same key *) + belongs to the same key. *) val set : inj:'b injection -> 'a t -> 'a -> 'b -> unit -(** Bind the key to the value, using [inj] *) +(** Bind the key to the value, using [inj]. *) val find : inj:'b injection -> 'a t -> 'a -> 'b (** Find the value for the given key, which must be of the right type. @raise Not_found if either the key is not found, or if its value - doesn't belong to the right type *) + doesn't belong to the right type. *) val length : 'a t -> int -(** Number of bindings *) +(** Number of bindings. *) val clear : 'a t -> unit -(** Clear content of the hashtable *) +(** Clear content of the hashtable. *) val remove : 'a t -> 'a -> unit -(** Remove the binding for this key *) +(** Remove the binding for this key. *) val copy : 'a t -> 'a t -(** Copy of the table *) +(** Copy of the table. *) val mem : inj:_ injection-> 'a t -> 'a -> bool (** Is the given key in the table, with the right type? *) val iter_keys : 'a t -> ('a -> unit) -> unit -(** Iterate on the keys of this table *) +(** Iterate on the keys of this table. *) val fold_keys : 'a t -> 'b -> ('b -> 'a -> 'b) -> 'b -(** Fold over the keys *) +(** Fold over the keys. *) (** {2 Iterators} *) type 'a sequence = ('a -> unit) -> unit val keys_seq : 'a t -> 'a sequence -(** All the keys *) +(** All the keys. *) val bindings_of : inj:'b injection -> 'a t -> ('a * 'b) sequence -(** All the bindings that come from the corresponding injection *) +(** All the bindings that come from the corresponding injection. *) type value = | Value : ('b injection -> 'b option) -> value val bindings : 'a t -> ('a * value) sequence -(** Iterate on all bindings *) +(** Iterate on all bindings. *) diff --git a/src/data/CCMultiMap.ml b/src/data/CCMultiMap.ml index de83764b..8c6ab6f0 100644 --- a/src/data/CCMultiMap.ml +++ b/src/data/CCMultiMap.ml @@ -1,27 +1,4 @@ -(* -copyright (c) 2013, simon cruanes -all rights reserved. - -redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -redistributions of source code must retain the above copyright notice, this -list of conditions and the following disclaimer. redistributions in binary -form must reproduce the above copyright notice, this list of conditions and the -following disclaimer in the documentation and/or other materials provided with -the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*) +(* This file is free software, part of containers. See file "license" for more details. *) (** {1 Multimap} *) diff --git a/src/data/CCMultiMap.mli b/src/data/CCMultiMap.mli index be602417..86ea1788 100644 --- a/src/data/CCMultiMap.mli +++ b/src/data/CCMultiMap.mli @@ -1,27 +1,4 @@ -(* -copyright (c) 2013, simon cruanes -all rights reserved. - -redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -redistributions of source code must retain the above copyright notice, this -list of conditions and the following disclaimer. redistributions in binary -form must reproduce the above copyright notice, this list of conditions and the -following disclaimer in the documentation and/or other materials provided with -the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*) +(* This file is free software, part of containers. See file "license" for more details. *) (** {1 Multimap} *) @@ -33,59 +10,59 @@ module type S = sig type t val empty : t - (** Empty multimap *) + (** Empty multimap. *) val is_empty : t -> bool (** Empty multimap? *) val add : t -> key -> value -> t - (** Add a key/value binding *) + (** Add a key/value binding. *) val remove : t -> key -> value -> t - (** Remove the binding *) + (** Remove the binding. *) val remove_all : t -> key -> t - (** Remove the key from the map *) + (** Remove the key from the map. *) val mem : t -> key -> bool (** Is there a binding for this key? *) val find : t -> key -> value list - (** List of values for this key *) + (** List of values for this key. *) val find_iter : t -> key -> (value -> unit) -> unit - (** Iterate on bindings for this key *) + (** Iterate on bindings for this key. *) val count : t -> key -> int - (** Number of bindings for this key *) + (** Number of bindings for this key. *) val iter : t -> (key -> value -> unit) -> unit - (** Iterate on all key/value *) + (** Iterate on all key/value. *) val fold : t -> 'a -> ('a -> key -> value -> 'a) -> 'a - (** Fold on all key/value *) + (** Fold on all key/value. *) val size : t -> int - (** Number of keys *) + (** Number of keys. *) val union : t -> t -> t - (** Union of multimaps *) + (** Union of multimaps. *) val inter : t -> t -> t - (** Intersection of multimaps *) + (** Intersection of multimaps. *) val diff : t -> t -> t (** Difference of maps, ie bindings of the first that are not - in the second *) + in the second. *) val equal : t -> t -> bool - (** Same multimap *) + (** Same multimap. *) val compare : t -> t -> int - (** Total order on multimaps *) + (** Total order on multimaps. *) val submap : t -> t -> bool - (** [submap m1 m2] is true iff all bindings of [m1] are also in [m2] *) + (** [submap m1 m2] is true iff all bindings of [m1] are also in [m2]. *) val to_seq : t -> (key * value) sequence @@ -94,7 +71,7 @@ module type S = sig val keys : t -> key sequence val values : t -> value sequence - (** Some values may occur several times *) + (** Some values may occur several times. *) end module type OrderedType = sig @@ -120,22 +97,22 @@ module type BIDIR = sig val is_empty : t -> bool val add : t -> left -> right -> t - (** Add a binding (left,right) *) + (** Add a binding (left,right). *) val remove : t -> left -> right -> t - (** Remove a specific binding *) + (** Remove a specific binding. *) val cardinal_left : t -> int - (** Number of distinct left keys *) + (** Number of distinct left keys. *) val cardinal_right : t -> int - (** Number of distinct right keys *) + (** Number of distinct right keys. *) val remove_left : t -> left -> t - (** Remove all bindings for the left key *) + (** Remove all bindings for the left key. *) val remove_right : t -> right -> t - (** Remove all bindings for the right key *) + (** Remove all bindings for the right key. *) val mem_left : t -> left -> bool (** Is the left key present in at least one pair? *) @@ -144,25 +121,25 @@ module type BIDIR = sig (** Is the right key present in at least one pair? *) val find_left : t -> left -> right sequence - (** Find all bindings for this given left-key *) + (** Find all bindings for this given left-key. *) val find_right : t -> right -> left sequence - (** Find all bindings for this given right-key *) + (** Find all bindings for this given right-key. *) val find1_left : t -> left -> right option - (** like {!find_left} but returns at most one value *) + (** Like {!find_left} but returns at most one value. *) val find1_right : t -> right -> left option - (** like {!find_right} but returns at most one value *) + (** Like {!find_right} but returns at most one value. *) val fold : ('a -> left -> right -> 'a) -> 'a -> t -> 'a - (** Fold on pairs *) + (** Fold on pairs. *) val pairs : t -> (left * right) sequence - (** Iterate on pairs *) + (** Iterate on pairs. *) val add_pairs : t -> (left * right) sequence -> t - (** Add pairs *) + (** Add pairs. *) val seq_left : t -> left sequence val seq_right : t -> right sequence diff --git a/src/data/CCMultiSet.mli b/src/data/CCMultiSet.mli index 2f060dc2..053607e7 100644 --- a/src/data/CCMultiSet.mli +++ b/src/data/CCMultiSet.mli @@ -24,31 +24,31 @@ module type S = sig val remove : t -> elt -> t val add_mult : t -> elt -> int -> t - (** [add_mult set x n] adds [n] occurrences of [x] to [set] - @raise Invalid_argument if [n < 0] + (** [add_mult set x n] adds [n] occurrences of [x] to [set]. + @raise Invalid_argument if [n < 0]. @since 0.6 *) val remove_mult : t -> elt -> int -> t - (** [remove_mult set x n] removes at most [n] occurrences of [x] from [set] - @raise Invalid_argument if [n < 0] + (** [remove_mult set x n] removes at most [n] occurrences of [x] from [set]. + @raise Invalid_argument if [n < 0]. @since 0.6 *) val remove_all : t -> elt -> t - (** [remove_all set x] removes all occurrences of [x] from [set] + (** [remove_all set x] removes all occurrences of [x] from [set]. @since 0.22 *) val update : t -> elt -> (int -> int) -> t (** [update set x f] calls [f n] where [n] is the current multiplicity of [x] in [set] ([0] to indicate its absence); the result of [f n] is the new multiplicity of [x]. - @raise Invalid_argument if [f n < 0] + @raise Invalid_argument if [f n < 0]. @since 0.6 *) val min : t -> elt - (** Minimal element w.r.t the total ordering on elements *) + (** Minimal element w.r.t the total ordering on elements. *) val max : t -> elt - (** Maximal element w.r.t the total ordering on elements *) + (** Maximal element w.r.t the total ordering on elements. *) val union : t -> t -> t (** [union a b] contains as many occurrences of an element [x] @@ -56,25 +56,25 @@ module type S = sig val meet : t -> t -> t (** [meet a b] is a multiset such that - [count (meet a b) x = max (count a x) (count b x)] *) + [count (meet a b) x = max (count a x) (count b x)]. *) val intersection : t -> t -> t (** [intersection a b] is a multiset such that - [count (intersection a b) x = min (count a x) (count b x)] *) + [count (intersection a b) x = min (count a x) (count b x)]. *) val diff : t -> t -> t (** MultiSet difference. - [count (diff a b) x = max (count a x - count b x) 0] *) + [count (diff a b) x = max (count a x - count b x) 0]. *) val contains : t -> t -> bool - (** [contains a x = (count m x > 0)] *) + (** [contains a x = (count m x > 0)]. *) val compare : t -> t -> int val equal : t -> t -> bool val cardinal : t -> int - (** Number of distinct elements *) + (** Number of distinct elements. *) val iter : t -> (int -> elt -> unit) -> unit diff --git a/src/data/CCPersistentArray.mli b/src/data/CCPersistentArray.mli index 56d15947..7ed20503 100644 --- a/src/data/CCPersistentArray.mli +++ b/src/data/CCPersistentArray.mli @@ -43,24 +43,24 @@ val make : int -> 'a -> 'a t array entries will modify all other entries at the same time. @raise Invalid_argument if [n < 0] or [n > Sys.max_array_length]. If the value of x is a floating-point number, then the maximum size is - only [Sys.max_array_length / 2].*) + only [Sys.max_array_length / 2]. *) val init : int -> (int -> 'a) -> 'a t -(** [make n f] returns a persistent array of length n, with element +(** [init n f] returns a persistent array of length n, with element [i] initialized to the result of [f i]. @raise Invalid_argument if [n < 0] or [n > Sys.max_array_length]. If the value of x is a floating-point number, then the maximum size is - only [Sys.max_array_length / 2].*) + only [Sys.max_array_length / 2]. *) val get : 'a t -> int -> 'a (** [get a i] returns the element with index [i] from the array [a]. @raise Invalid_argument "index out of bounds" if [n] is outside the - range [0] to [Array.length a - 1].*) + range [0] to [Array.length a - 1]. *) val set : 'a t -> int -> 'a -> 'a t (** [set a i v] sets the element index [i] from the array [a] to [v]. @raise Invalid_argument "index out of bounds" if [n] is outside the - range [0] to [Array.length a - 1].*) + range [0] to [Array.length a - 1]. *) val length : 'a t -> int (** Returns the length of the persistent array. *) @@ -76,31 +76,31 @@ val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t It is equivalent to [fun f t -> init (fun i -> f (get t i))]. *) val iter : ('a -> unit) -> 'a t -> unit -val iteri : (int -> 'a -> unit) -> 'a t -> unit (** [iter f t] applies function [f] to all elements of the persistent array, in order from element [0] to element [length t - 1]. *) +val iteri : (int -> 'a -> unit) -> 'a t -> unit val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a val fold_right : ('a -> 'b -> 'b) -> 'a t -> 'b -> 'b (** Fold on the elements of the array. *) val append : 'a t -> 'a t -> 'a t -(** Append the two arrays +(** Append the two arrays. @since 0.13 *) val flatten : 'a t t -> 'a t -(** Concatenates all the sub-arrays +(** Concatenates all the sub-arrays. @since 0.13 *) val flat_map : ('a -> 'b t) -> 'a t -> 'b t -(** Flat map (map + concatenation) +(** Flat map (map + concatenation). @since 0.13 *) val to_array : 'a t -> 'a array (** [to_array t] returns a mutable copy of [t]. *) val of_array : 'a array -> 'a t -(** [from_array a] returns an immutable copy of [a]. *) +(** [of_array a] returns an immutable copy of [a]. *) val to_list : 'a t -> 'a list (** [to_list t] returns the list of elements in [t]. *) @@ -109,7 +109,7 @@ val of_list : 'a list -> 'a t (** [of_list l] returns a fresh persistent array containing the elements of [l]. *) val of_rev_list : 'a list -> 'a t -(** [of_rev_list l] is the same as [of_list (List.rev l)] but more efficient +(** [of_rev_list l] is the same as [of_list (List.rev l)] but more efficient. @since 0.13 *) (** {2 Conversions} *) diff --git a/src/data/CCPersistentHashtbl.mli b/src/data/CCPersistentHashtbl.mli index 8c51f19c..93672157 100644 --- a/src/data/CCPersistentHashtbl.mli +++ b/src/data/CCPersistentHashtbl.mli @@ -27,29 +27,29 @@ module type S = sig type 'a t val empty : unit -> 'a t - (** Empty table. The table will be allocated at the first binding *) + (** Empty table. The table will be allocated at the first binding. *) val create : int -> 'a t - (** Create a new hashtable, with the given initial capacity *) + (** Create a new hashtable, with the given initial capacity. *) val is_empty : 'a t -> bool (** Is the table empty? *) val find : 'a t -> key -> 'a - (** Find the value for this key, or fails - @raise Not_found if the key is not present in the table *) + (** Find the value for this key, or fails. + @raise Not_found if the key is not present in the table. *) val get_exn : key -> 'a t -> 'a - (** Synonym to {!find} with flipped arguments *) + (** Synonym to {!find} with flipped arguments. *) val get : key -> 'a t -> 'a option - (** Safe version of !{get_exn} *) + (** Safe version of !{get_exn}. *) val mem : 'a t -> key -> bool (** Is the key bound? *) val length : _ t -> int - (** Number of bindings *) + (** Number of bindings. *) val add : 'a t -> key -> 'a -> 'a t (** Add the binding to the table, returning a new table. The old binding @@ -67,11 +67,11 @@ module type S = sig [key] is removed, else it returns [Some v'] and [key -> v'] is added. *) val remove : 'a t -> key -> 'a t - (** Remove the key *) + (** Remove the key. *) val copy : 'a t -> 'a t (** Fresh copy of the table; the underlying structure is not shared - anymore, so using both tables alternatively will be efficient *) + anymore, so using both tables alternatively will be efficient. *) val merge : f:(key -> [`Left of 'a | `Right of 'b | `Both of 'a * 'b] -> 'c option) -> @@ -81,13 +81,13 @@ module type S = sig function returns [None] the key will not appear in the result. *) val iter : 'a t -> (key -> 'a -> unit) -> unit - (** Iterate over bindings *) + (** Iterate over bindings. *) val fold : ('b -> key -> 'a -> 'b) -> 'b -> 'a t -> 'b - (** Fold over bindings *) + (** Fold over bindings. *) val map : (key -> 'a -> 'b) -> 'a t -> 'b t - (** Map all values *) + (** Map all values. *) val filter : (key -> 'a -> bool) -> 'a t -> 'a t @@ -100,7 +100,7 @@ module type S = sig (** {3 Conversions} *) val of_seq : (key * 'a) sequence -> 'a t - (** Add (replace) bindings from the sequence to the table *) + (** Add (replace) bindings from the sequence to the table. *) val of_list : (key * 'a) list -> 'a t @@ -109,7 +109,7 @@ module type S = sig val add_list : 'a t -> (key * 'a) list -> 'a t val to_seq : 'a t -> (key * 'a) sequence - (** Sequence of the bindings of the table *) + (** Sequence of the bindings of the table. *) val to_list : 'a t -> (key * 'a) list diff --git a/src/data/CCRAL.mli b/src/data/CCRAL.mli index 55ae0bde..36c48fdc 100644 --- a/src/data/CCRAL.mli +++ b/src/data/CCRAL.mli @@ -18,50 +18,50 @@ type +'a t (** List containing elements of type 'a *) val empty : 'a t -(** Empty list *) +(** Empty list. *) val is_empty : _ t -> bool -(** Check whether the list is empty *) +(** Check whether the list is empty. *) val cons : 'a -> 'a t -> 'a t -(** Add an element at the front of the list *) +(** Add an element at the front of the list. *) val return : 'a -> 'a t -(** Singleton *) +(** Singleton. *) val map : f:('a -> 'b) -> 'a t -> 'b t -(** Map on elements *) +(** Map on elements. *) val mapi : f:(int -> 'a -> 'b) -> 'a t -> 'b t -(** Map with index *) +(** Map with index. *) val hd : 'a t -> 'a (** First element of the list, or - @raise Invalid_argument if the list is empty *) + @raise Invalid_argument if the list is empty. *) val tl : 'a t -> 'a t (** Remove the first element from the list, or - @raise Invalid_argument if the list is empty *) + @raise Invalid_argument if the list is empty. *) val front : 'a t -> ('a * 'a t) option -(** Remove and return the first element of the list *) +(** Remove and return the first element of the list. *) val front_exn : 'a t -> 'a * 'a t (** Unsafe version of {!front}. - @raise Invalid_argument if the list is empty *) + @raise Invalid_argument if the list is empty. *) val length : 'a t -> int -(** Number of elements. Complexity O(ln n) where n=number of elements *) +(** Number of elements. Complexity [O(ln n)] where n=number of elements. *) val get : 'a t -> int -> 'a option -(** [get l i] accesses the [i]-th element of the list. O(log(n)). *) +(** [get l i] accesses the [i]-th element of the list. [O(log(n))]. *) val get_exn : 'a t -> int -> 'a -(** Unsafe version of {!get} +(** Unsafe version of {!get}. @raise Invalid_argument if the list has less than [i+1] elements. *) val set : 'a t -> int -> 'a -> 'a t -(** [set l i v] sets the [i]-th element of the list to [v]. O(log(n)). +(** [set l i v] sets the [i]-th element of the list to [v]. [O(log(n))]. @raise Invalid_argument if the list has less than [i+1] elements. *) val remove : 'a t -> int -> 'a t @@ -90,39 +90,39 @@ val drop_while : f:('a -> bool) -> 'a t -> 'a t val take_drop : int -> 'a t -> 'a t * 'a t (** [take_drop n l] splits [l] into [a, b] such that [length a = n] - if [length l >= n], and such that [append a b = l] *) + if [length l >= n], and such that [append a b = l]. *) val iter : f:('a -> unit) -> 'a t -> unit -(** Iterate on the list's elements *) +(** Iterate on the list's elements. *) val iteri : f:(int -> 'a -> unit) -> 'a t -> unit val fold : f:('b -> 'a -> 'b) -> x:'b -> 'a t -> 'b -(** Fold on the list's elements *) +(** Fold on the list's elements. *) val fold_rev : f:('b -> 'a -> 'b) -> x:'b -> 'a t -> 'b -(** Fold on the list's elements, in reverse order (starting from the tail) *) +(** Fold on the list's elements, in reverse order (starting from the tail). *) val rev_map : f:('a -> 'b) -> 'a t -> 'b t -(** [rev_map f l] is the same as [map f (rev l)] *) +(** [rev_map f l] is the same as [map f (rev l)]. *) val rev : 'a t -> 'a t -(** Reverse the list *) +(** Reverse the list. *) val equal : eq:('a -> 'a -> bool) -> 'a t -> 'a t -> bool val compare : cmp:('a -> 'a -> int) -> 'a t -> 'a t -> int -(** Lexicographic comparison *) +(** Lexicographic comparison. *) (** {2 Utils} *) val make : int -> 'a -> 'a t val repeat : int -> 'a t -> 'a t -(** [repeat n l] is [append l (append l ... l)] [n] times *) +(** [repeat n l] is [append l (append l ... l)] [n] times. *) val range : int -> int -> int t -(** [range i j] is [i; i+1; ... ; j] or [j; j-1; ...; i] *) +(** [range i j] is [i; i+1; ... ; j] or [j; j-1; ...; i]. *) (** {2 Conversions} *) @@ -132,19 +132,19 @@ type 'a gen = unit -> 'a option val add_list : 'a t -> 'a list -> 'a t val of_list : 'a list -> 'a t -(** Convert a list to a RAL. {b Caution}: non tail-rec *) +(** Convert a list to a RAL. {b Caution}: non tail-rec. *) val to_list : 'a t -> 'a list val of_list_map : f:('a -> 'b) -> 'a list -> 'b t -(** Combination of {!of_list} and {!map} *) +(** Combination of {!of_list} and {!map}. *) val of_array : 'a array -> 'a t val add_array : 'a t -> 'a array -> 'a t val to_array : 'a t -> 'a array -(** More efficient than on usual lists *) +(** More efficient than on usual lists. *) val add_seq : 'a t -> 'a sequence -> 'a t @@ -162,22 +162,22 @@ val to_gen : 'a t -> 'a gen module Infix : sig val (@+) : 'a -> 'a t -> 'a t - (** Cons (alias to {!cons}) *) + (** Cons (alias to {!cons}). *) val (>>=) : 'a t -> ('a -> 'b t) -> 'b t - (** Alias to {!flat_map} *) + (** Alias to {!flat_map}. *) val (>|=) : 'a t -> ('a -> 'b) -> 'b t - (** Alias to {!map} *) + (** Alias to {!map}. *) val (<*>) : ('a -> 'b) t -> 'a t -> 'b t (** Alias to {!app} *) val (--) : int -> int -> int t - (** Alias to {!range} *) + (** Alias to {!range}. *) val (--^) : int -> int -> int t - (** [a -- b] is the integer range from [a] to [b], where [b] is excluded. + (** [a --^ b] is the integer range from [a] to [b], where [b] is excluded. @since 0.17 *) end diff --git a/src/data/CCRingBuffer.mli b/src/data/CCRingBuffer.mli index 5e24ea5b..ffec50fd 100644 --- a/src/data/CCRingBuffer.mli +++ b/src/data/CCRingBuffer.mli @@ -28,31 +28,31 @@ module Array : sig type t val create : int -> t - (** Make an array of the given size, filled with dummy elements *) + (** Make an array of the given size, filled with dummy elements. *) val length: t -> int - (** [length t] gets the total number of elements currently in [t] *) + (** [length t] gets the total number of elements currently in [t]. *) val get: t -> int -> elt - (** [get t i] gets the element at position [i] *) + (** [get t i] gets the element at position [i]. *) val set: t -> int -> elt -> unit - (** [set t i e] sets the element at position [i] to [e] *) + (** [set t i e] sets the element at position [i] to [e]. *) val sub: t -> int -> int -> t - (** [sub t i len] gets the subarray of [t] from - position [i] to [i + len] *) + (** [sub t i len] gets the sub-array of [t] from + position [i] to [i + len]. *) val copy : t -> t - (** [copy t] makes a fresh copy of the array [t] *) + (** [copy t] makes a fresh copy of the array [t]. *) val blit : t -> int -> t -> int -> int -> unit (** [blit t s arr i len] copies [len] elements from [arr] starting at [i] - to position [s] from [t] *) + to position [s] from [t]. *) val iter : (elt -> unit) -> t -> unit (** [iter f t] iterates over the array [t] invoking [f] with - the current element, in array order *) + the current element, in array order. *) end (** Efficient array version for the [char] type *) @@ -82,7 +82,7 @@ module type S = sig (** [create size] creates a new bounded buffer with given size. The underlying array is allocated immediately and no further (large) allocation will happen from now on. - @raise Invalid_argument if the arguments is [< 1] *) + @raise Invalid_argument if the arguments is [< 1]. *) val copy : t -> t (** Make a fresh copy of the buffer. *) @@ -102,7 +102,7 @@ module type S = sig a input buffer [from_buf] to the end of the buffer. If the slice is too large for the buffer, only the last part of the array will be copied. - @raise Invalid_argument if [o,len] is not a valid slice of [s] *) + @raise Invalid_argument if [o,len] is not a valid slice of [s]. *) val blit_into : t -> Array.t -> int -> int -> int (** [blit_into buf to_buf o len] copies at most [len] elements from [buf] @@ -115,7 +115,7 @@ module type S = sig end of [into]. Erases data of [into] if there is not enough room. *) val to_list : t -> Array.elt list - (** Extract the current content into a list *) + (** Extract the current content into a list. *) val clear : t -> unit (** Clear the content of the buffer. Doesn't actually destroy the content. *) @@ -136,7 +136,7 @@ module type S = sig @raise Invalid_argument if [len > length b]. *) val iter : t -> f:(Array.elt -> unit) -> unit - (** [iter b ~f] calls [f i t] for each element [t] in [buf] *) + (** [iter b ~f] calls [f i t] for each element [t] in [buf]. *) val iteri : t -> f:(int -> Array.elt -> unit) -> unit (** [iteri b ~f] calls [f i t] for each element [t] in [buf], with [i] @@ -145,12 +145,12 @@ module type S = sig val get_front : t -> int -> Array.elt (** [get_front buf i] returns the [i]-th element of [buf] from the front, ie the one returned by [take_front buf] after [i-1] calls to [junk_front buf]. - @raise Invalid_argument if the index is invalid (> [length buf]) *) + @raise Invalid_argument if the index is invalid (> [length buf]). *) val get_back : t -> int -> Array.elt (** [get_back buf i] returns the [i]-th element of [buf] from the back, ie the one returned by [take_back buf] after [i-1] calls to [junk_back buf]. - @raise Invalid_argument if the index is invalid (> [length buf]) *) + @raise Invalid_argument if the index is invalid (> [length buf]). *) val push_back : t -> Array.elt -> unit (** Push value at the back of [t]. @@ -174,14 +174,14 @@ module type S = sig @since 1.3 *) val take_back : t -> Array.elt option - (** Take and remove the last value from back of [t], if any *) + (** Take and remove the last value from back of [t], if any. *) val take_back_exn : t -> Array.elt (** Take and remove the last value from back of [t]. @raise Empty if buffer is already empty. *) val take_front : t -> Array.elt option - (** Take and remove the first value from front of [t], if any *) + (** Take and remove the first value from front of [t], if any. *) val take_front_exn : t -> Array.elt (** Take and remove the first value from front of [t]. @@ -189,7 +189,7 @@ module type S = sig val of_array : Array.t -> t (** Create a buffer from an initial array, but doesn't take ownership - of it (stills allocates a new internal array) + of it (still allocates a new internal array). @since 0.11 *) val to_array : t -> Array.t diff --git a/src/data/CCSimple_queue.mli b/src/data/CCSimple_queue.mli index 5b2bbcf1..33dd8d73 100644 --- a/src/data/CCSimple_queue.mli +++ b/src/data/CCSimple_queue.mli @@ -19,24 +19,24 @@ val empty : 'a t val is_empty : 'a t -> bool val push : 'a -> 'a t -> 'a t -(** Push element at the end of the queue *) +(** Push element at the end of the queue. *) val snoc : 'a t -> 'a -> 'a t -(** Flip version of {!push} *) +(** Flip version of {!push}. *) val peek : 'a t -> 'a option -(** First element of the queue *) +(** First element of the queue. *) val peek_exn : 'a t -> 'a (** Same as {!peek} but - @raise Invalid_argument if the queue is empty *) + @raise Invalid_argument if the queue is empty. *) val pop : 'a t -> ('a * 'a t) option -(** Get and remove the first element *) +(** Get and remove the first element. *) val pop_exn : 'a t -> ('a * 'a t) (** Same as {!pop}, but fails on empty queues. - @raise Invalid_argument if the queue is empty *) + @raise Invalid_argument if the queue is empty. *) val junk : 'a t -> 'a t (** Remove first element. If the queue is empty, do nothing. *) @@ -47,7 +47,7 @@ val append : 'a t -> 'a t -> 'a t Linear in the size of the second queue. *) val map : ('a -> 'b) -> 'a t -> 'b t -(** Map values *) +(** Map values. *) val rev : 'a t -> 'a t (** Reverse the queue. Constant time. *) @@ -55,15 +55,15 @@ val rev : 'a t -> 'a t val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool module Infix : sig - val (>|=) : 'a t -> ('a -> 'b) -> 'b t (** Alias to {!map} *) - val (@) : 'a t -> 'a t -> 'a t (** Alias to {!append} *) - val (<::) : 'a t -> 'a -> 'a t (** Alias to {!snoc} *) + val (>|=) : 'a t -> ('a -> 'b) -> 'b t (** Alias to {!map}. *) + val (@) : 'a t -> 'a t -> 'a t (** Alias to {!append}. *) + val (<::) : 'a t -> 'a -> 'a t (** Alias to {!snoc}. *) end include module type of Infix val length : 'a t -> int -(** Number of elements in the queue (linear in time) *) +(** Number of elements in the queue (linear in time). *) val fold : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b diff --git a/src/data/CCTrie.mli b/src/data/CCTrie.mli index 0cb34515..5592bd02 100644 --- a/src/data/CCTrie.mli +++ b/src/data/CCTrie.mli @@ -32,17 +32,17 @@ module type S = sig val is_empty : _ t -> bool val add : key -> 'a -> 'a t -> 'a t - (** Add a binding to the trie (possibly erasing the previous one) *) + (** Add a binding to the trie (possibly erasing the previous one). *) val remove : key -> 'a t -> 'a t - (** Remove the key, if present *) + (** Remove the key, if present. *) val find : key -> 'a t -> 'a option - (** Find the value associated with the key, if any *) + (** Find the value associated with the key, if any. *) val find_exn : key -> 'a t -> 'a (** Same as {!find} but can fail. - @raise Not_found if the key is not present *) + @raise Not_found if the key is not present. *) val longest_prefix : key -> 'a t -> key (** [longest_prefix k m] finds the longest prefix of [k] that leads to @@ -50,7 +50,7 @@ module type S = sig a value. Example: if [m] has keys "abc0" and "abcd", then [longest_prefix "abc2" m] - will return "abc" + will return "abc". @since 0.17 *) @@ -58,7 +58,7 @@ module type S = sig (** Update the binding for the given key. The function is given [None] if the key is absent, or [Some v] if [key] is bound to [v]; if it returns [None] the key is removed, otherwise it - returns [Some y] and [key] becomes bound to [y] *) + returns [Some y] and [key] becomes bound to [y]. *) val fold : ('b -> key -> 'a -> 'b) -> 'b -> 'a t -> 'b (** Fold on key/value bindings. Will use {!WORD.of_list} to rebuild keys. *) @@ -72,19 +72,19 @@ module type S = sig @since 0.17 *) val iter : (key -> 'a -> unit) -> 'a t -> unit - (** Same as {!fold}, but for effectful functions *) + (** Same as {!fold}, but for effectful functions. *) val fold_values : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b - (** More efficient version of {!fold}, that doesn't keep keys *) + (** More efficient version of {!fold}, that doesn't keep keys. *) val iter_values : ('a -> unit) -> 'a t -> unit val merge : ('a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t (** Merge two tries together. The function is used in - case of conflicts, when a key belongs to both tries *) + case of conflicts, when a key belongs to both tries. *) val size : _ t -> int - (** Number of bindings *) + (** Number of bindings. *) (** {6 Conversions} *) @@ -104,11 +104,11 @@ module type S = sig val above : key -> 'a t -> (key * 'a) sequence (** All bindings whose key is bigger or equal to the given key, in - ascending order *) + ascending order. *) val below : key -> 'a t -> (key * 'a) sequence (** All bindings whose key is smaller or equal to the given key, - in decreasing order *) + in decreasing order. *) (**/**) val check_invariants: _ t -> bool diff --git a/src/data/CCWBTree.mli b/src/data/CCWBTree.mli index 078c1df2..3300c17a 100644 --- a/src/data/CCWBTree.mli +++ b/src/data/CCWBTree.mli @@ -38,14 +38,14 @@ module type S = sig val get : key -> 'a t -> 'a option val get_exn : key -> 'a t -> 'a - (** @raise Not_found if the key is not present *) + (** @raise Not_found if the key is not present. *) val nth : int -> 'a t -> (key * 'a) option (** [nth i m] returns the [i]-th [key, value] in the ascending - order. Complexity is [O(log (cardinal m))] *) + order. Complexity is [O(log (cardinal m))]. *) val nth_exn : int -> 'a t -> key * 'a - (** @raise Not_found if the index is invalid *) + (** @raise Not_found if the index is invalid. *) val get_rank : key -> 'a t -> [`At of int | `After of int | `First] (** [get_rank k m] looks for the rank of [k] in [m], i.e. the index @@ -60,7 +60,7 @@ module type S = sig val update : key -> ('a option -> 'a option) -> 'a t -> 'a t (** [update k f m] calls [f (Some v)] if [get k m = Some v], [f None] otherwise. Then, if [f] returns [Some v'] it binds [k] to [v'], - if [f] returns [None] it removes [k] *) + if [f] returns [None] it removes [k]. *) val cardinal : _ t -> int @@ -83,30 +83,30 @@ module type S = sig val split : key -> 'a t -> 'a t * 'a option * 'a t (** [split k t] returns [l, o, r] where [l] is the part of the map with keys smaller than [k], [r] has keys bigger than [k], - and [o = Some v] if [k, v] belonged to the map *) + and [o = Some v] if [k, v] belonged to the map. *) val merge : f:(key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> 'c t - (** Similar to {!Map.S.merge} *) + (** Similar to {!Map.S.merge}. *) val extract_min : 'a t -> key * 'a * 'a t (** [extract_min m] returns [k, v, m'] where [k,v] is the pair with the smallest key in [m], and [m'] does not contain [k]. - @raise Not_found if the map is empty *) + @raise Not_found if the map is empty. *) val extract_max : 'a t -> key * 'a * 'a t (** [extract_max m] returns [k, v, m'] where [k,v] is the pair with the highest key in [m], and [m'] does not contain [k]. - @raise Not_found if the map is empty *) + @raise Not_found if the map is empty. *) val choose : 'a t -> (key * 'a) option val choose_exn : 'a t -> key * 'a - (** @raise Not_found if the tree is empty *) + (** @raise Not_found if the tree is empty. *) val random_choose : Random.State.t -> 'a t -> key * 'a (** Randomly choose a (key,value) pair within the tree, using weights - as probability weights - @raise Not_found if the tree is empty *) + as probability weights. + @raise Not_found if the tree is empty. *) val add_list : 'a t -> (key * 'a) list -> 'a t @@ -127,7 +127,8 @@ module type S = sig val to_gen : 'a t -> (key * 'a) gen val pp : key printer -> 'a printer -> 'a t printer - (** Renamed from [val print] @since NEXT_RELEASE *) + (** Renamed from [val print]. + @since NEXT_RELEASE *) (**/**) val node_ : key -> 'a -> 'a t -> 'a t -> 'a t diff --git a/src/data/CCZipper.mli b/src/data/CCZipper.mli index 0ccc2acb..763074ec 100644 --- a/src/data/CCZipper.mli +++ b/src/data/CCZipper.mli @@ -10,7 +10,7 @@ type 'a t = 'a list * 'a list with the focus on [r]. *) val empty : 'a t -(** Empty zipper *) +(** Empty zipper. *) val is_empty : _ t -> bool (** Empty zipper? Returns true iff the two lists are empty. *) @@ -22,36 +22,36 @@ val is_empty : _ t -> bool val to_list : 'a t -> 'a list (** Convert the zipper back to a list. - [to_list (l,r)] is [List.rev_append l r] *) + [to_list (l,r)] is [List.rev_append l r]. *) val to_rev_list : 'a t -> 'a list (** Convert the zipper back to a {i reversed} list. - In other words, [to_list (l,r)] is [List.rev_append r l] *) + In other words, [to_list (l,r)] is [List.rev_append r l]. *) val make : 'a list -> 'a t -(** Create a zipper pointing at the first element of the list *) +(** Create a zipper pointing at the first element of the list. *) val left : 'a t -> 'a t -(** Go to the left, or do nothing if the zipper is already at leftmost pos *) +(** Go to the left, or do nothing if the zipper is already at leftmost pos. *) val left_exn : 'a t -> 'a t (** Go to the left, or - @raise Invalid_argument if the zipper is already at leftmost pos *) + @raise Invalid_argument if the zipper is already at leftmost pos. *) val right : 'a t -> 'a t -(** Go to the right, or do nothing if the zipper is already at rightmost pos *) +(** Go to the right, or do nothing if the zipper is already at rightmost pos. *) val right_exn : 'a t -> 'a t (** Go to the right, or - @raise Invalid_argument if the zipper is already at rightmost pos *) + @raise Invalid_argument if the zipper is already at rightmost pos. *) val modify : ('a option -> 'a option) -> 'a t -> 'a t (** Modify the current element, if any, by returning a new element, or - returning [None] if the element is to be deleted *) + returning [None] if the element is to be deleted. *) val insert : 'a -> 'a t -> 'a t (** Insert an element at the current position. If an element was focused, - [insert x l] adds [x] just before it, and focuses on [x] *) + [insert x l] adds [x] just before it, and focuses on [x]. *) val remove : 'a t -> 'a t (** [remove l] removes the current element, if any. *) @@ -61,12 +61,12 @@ val is_focused : _ t -> bool return a [Some v]? *) val focused : 'a t -> 'a option -(** Returns the focused element, if any. [focused zip = Some _] iff - [empty zip = false] *) +(** Return the focused element, if any. [focused zip = Some _] iff + [empty zip = false]. *) val focused_exn : 'a t -> 'a -(** Returns the focused element, or - @raise Not_found if the zipper is at an end *) +(** Return the focused element, or + @raise Not_found if the zipper is at an end. *) val drop_before : 'a t -> 'a t (** Drop every element on the "left" (calling {!left} then will do nothing). *) diff --git a/src/threads/CCBlockingQueue.mli b/src/threads/CCBlockingQueue.mli index 003110b1..1912bdc1 100644 --- a/src/threads/CCBlockingQueue.mli +++ b/src/threads/CCBlockingQueue.mli @@ -15,36 +15,36 @@ val create : int -> 'a t (** Create a new queue of size [n]. Using [n=max_int] amounts to using an infinite queue (2^61 items is a lot to fit in memory); using [n=1] amounts to using a box with 0 or 1 elements inside. - @raise Invalid_argument if [n < 1] *) + @raise Invalid_argument if [n < 1]. *) val push : 'a t -> 'a -> unit -(** [push q x] pushes [x] into [q], blocking if the queue is full *) +(** [push q x] pushes [x] into [q], blocking if the queue is full. *) val take : 'a t -> 'a -(** Take the first element, blocking if needed *) +(** Take the first element, blocking if needed. *) val push_list : 'a t -> 'a list -> unit -(** Push items of the list, one by one *) +(** Push items of the list, one by one. *) val take_list : 'a t -> int -> 'a list -(** [take_list n q] takes [n] elements out of [q] *) +(** [take_list n q] takes [n] elements out of [q]. *) val try_take : 'a t -> 'a option (** Take the first element if the queue is not empty, return [None] - otherwise *) + otherwise. *) val try_push : 'a t -> 'a -> bool (** [try_push q x] pushes [x] into [q] if [q] is not full, in which case it returns [true]. - If it fails because [q] is full, it returns [false] *) + If it fails because [q] is full, it returns [false]. *) val peek : 'a t -> 'a option (** [peek q] returns [Some x] if [x] is the first element of [q], - otherwise it returns [None] *) + otherwise it returns [None]. *) val size : _ t -> int -(** Number of elements currently in the queue *) +(** Number of elements currently in the queue. *) val capacity : _ t -> int -(** Number of values the queue can hold *) +(** Number of values the queue can hold. *) diff --git a/src/threads/CCLock.mli b/src/threads/CCLock.mli index 354e47c0..f06ec7c1 100644 --- a/src/threads/CCLock.mli +++ b/src/threads/CCLock.mli @@ -11,17 +11,17 @@ type 'a t (** A value surrounded with a lock *) val create : 'a -> 'a t -(** Create a new protected value *) +(** Create a new protected value. *) val with_lock : 'a t -> ('a -> 'b) -> 'b (** [with_lock l f] runs [f x] where [x] is the value protected with the lock [l], in a critical section. If [f x] fails, [with_lock l f] - fails too but the lock is released *) + fails too but the lock is released. *) val try_with_lock : 'a t -> ('a -> 'b) -> 'b option (** [try_with_lock l f] runs [f x] in a critical section if [l] is not locked. [x] is the value protected by the lock [l]. If [f x] - fails, [try_with_lock l f] fails too but the lock is released + fails, [try_with_lock l f] fails too but the lock is released. @since 0.22 *) (** Type allowing to manipulate the lock as a reference @@ -39,56 +39,56 @@ end val with_lock_as_ref : 'a t -> f:('a LockRef.t -> 'b) -> 'b (** [with_lock_as_ref l f] calls [f] with a reference-like object that allows to manipulate the value of [l] safely. - The object passed to [f] must not escape the function call + The object passed to [f] must not escape the function call. @since 0.13 *) val update : 'a t -> ('a -> 'a) -> unit -(** [update l f] replaces the content [x] of [l] with [f x], atomically *) +(** [update l f] replaces the content [x] of [l] with [f x], atomically. *) val update_map : 'a t -> ('a -> 'a * 'b) -> 'b (** [update_map l f] computes [x', y = f (get l)], then puts [x'] in [l] - and returns [y] + and returns [y]. @since 0.16 *) val mutex : _ t -> Mutex.t -(** Underlying mutex *) +(** Underlying mutex. *) val get : 'a t -> 'a (** Atomically get the value in the lock. The value that is returned isn't protected! *) val set : 'a t -> 'a -> unit -(** Atomically set the value +(** Atomically set the value. @since 0.13 *) val incr : int t -> unit -(** Atomically increment the value +(** Atomically increment the value. @since 0.13 *) val decr : int t -> unit -(** Atomically decrement the value +(** Atomically decrement the value. @since 0.13 *) val incr_then_get : int t -> int -(** [incr_then_get x] increments [x], and return its new value +(** [incr_then_get x] increments [x], and returns its new value. @since 0.16 *) val get_then_incr : int t -> int -(** [get_then_incr x] increments [x], and return its previous value +(** [get_then_incr x] increments [x], and returns its previous value. @since 0.16 *) val decr_then_get : int t -> int -(** [decr_then_get x] decrements [x], and return its new value +(** [decr_then_get x] decrements [x], and returns its new value. @since 0.16 *) val get_then_decr : int t -> int -(** [get_then_decr x] decrements [x], and return its previous value +(** [get_then_decr x] decrements [x], and returns its previous value. @since 0.16 *) val get_then_set : bool t -> bool -(** [get_then_set b] sets [b] to [true], and return the old value +(** [get_then_set b] sets [b] to [true], and returns the old value. @since 0.16 *) val get_then_clear : bool t -> bool -(** [get_then_clear b] sets [b] to [false], and return the old value +(** [get_then_clear b] sets [b] to [false], and returns the old value. @since 0.16 *) diff --git a/src/threads/CCPool.mli b/src/threads/CCPool.mli index 92dd59a9..f915c7d6 100644 --- a/src/threads/CCPool.mli +++ b/src/threads/CCPool.mli @@ -13,7 +13,7 @@ type +'a state = module type PARAM = sig val max_size : int - (** Maximum number of threads in the pool *) + (** Maximum number of threads in the pool. *) end exception Stopped @@ -21,10 +21,10 @@ exception Stopped (** {2 Create a new Pool} *) module Make(P : PARAM) : sig val run : (unit -> _) -> unit - (** [run f] schedules [f] for being executed in the thread pool *) + (** [run f] schedules [f] for being executed in the thread pool. *) val run1 : ('a -> _) -> 'a -> unit - (** [run1 f x] is similar to [run (fun () -> f x)] *) + (** [run1 f x] is similar to [run (fun () -> f x)]. *) val run2 : ('a -> 'b -> _) -> 'a -> 'b -> unit @@ -33,7 +33,7 @@ module Make(P : PARAM) : sig val set_exn_handler : (exn -> unit) -> unit val active : unit -> bool - (** [active ()] is true as long as [stop()] has not been called yet *) + (** [active ()] is true as long as [stop()] has not been called yet. *) val stop : unit -> unit (** After calling [stop ()], Most functions will raise Stopped. @@ -52,10 +52,10 @@ module Make(P : PARAM) : sig (** {2 Constructors} *) val return : 'a -> 'a t - (** Future that is already computed *) + (** Future that is already computed. *) val fail : exn -> 'a t - (** Future that fails immediately *) + (** Future that fails immediately. *) val make : (unit -> 'a) -> 'a t (** Create a future, representing a value that will be computed by @@ -70,10 +70,10 @@ module Make(P : PARAM) : sig val get : 'a t -> 'a (** Blocking get: wait for the future to be evaluated, and get the value, or the exception that failed the future is returned. - raise e if the future failed with e *) + raise e if the future failed with e. *) val state : 'a t -> 'a state - (** State of the future *) + (** State of the future. *) val is_done : 'a t -> bool (** Is the future evaluated (success/failure)? *) @@ -96,10 +96,10 @@ module Make(P : PARAM) : sig Might be evaluated now if the future is already done. *) val flat_map : ('a -> 'b t) -> 'a t -> 'b t - (** Monadic combination of futures *) + (** Monadic combination of futures. *) val and_then : 'a t -> (unit -> 'b t) -> 'b t - (** Wait for the first future to succeed, then launch the second *) + (** Wait for the first future to succeed, then launch the second. *) val sequence_a : 'a t array -> 'a array t (** Future that waits for all previous futures to terminate. If any future @@ -119,25 +119,25 @@ module Make(P : PARAM) : sig val choose_a : 'a t array -> 'a t (** Choose among those futures (the first to terminate). Behaves like - the first future that terminates, by failing if the future fails *) + the first future that terminates, by failing if the future fails. *) val choose_l : 'a t list -> 'a t (** Choose among those futures (the first to terminate). Behaves like - the first future that terminates, by failing if the future fails *) + the first future that terminates, by failing if the future fails. *) val map : ('a -> 'b) -> 'a t -> 'b t - (** Maps the value inside the future. The function doesn't run in its - own task; if it can take time, use {!flat_map} or {!map_async} *) + (** Map the value inside the future. The function doesn't run in its + own task; if it can take time, use {!flat_map} or {!map_async}. *) val map_async : ('a -> 'b) -> 'a t -> 'b t - (** Maps the value inside the future, to be computed in a separated job. *) + (** Map the value inside the future, to be computed in a separated job. *) val app : ('a -> 'b) t -> 'a t -> 'b t - (** [app f x] applies the result of [f] to the result of [x] *) + (** [app f x] applies the result of [f] to the result of [x]. *) val app_async : ('a -> 'b) t -> 'a t -> 'b t - (** [app f x] applies the result of [f] to the result of [x], in - a separated job scheduled in the pool *) + (** [app_async f x] applies the result of [f] to the result of [x], in + a separated job scheduled in the pool. *) val sleep : float -> unit t (** Future that returns with success in the given amount of seconds. Blocks @@ -156,9 +156,9 @@ module Make(P : PARAM) : sig val (>>) : 'a t -> (unit -> 'b t) -> 'b t val (>|=) : 'a t -> ('a -> 'b) -> 'b t - (** Alias to {!map} *) + (** Alias to {!map}. *) val (<*>): ('a -> 'b) t -> 'a t -> 'b t - (** Alias to {!app} *) + (** Alias to {!app}. *) end end diff --git a/src/threads/CCSemaphore.mli b/src/threads/CCSemaphore.mli index 5734d31c..dcf66e29 100644 --- a/src/threads/CCSemaphore.mli +++ b/src/threads/CCSemaphore.mli @@ -8,23 +8,23 @@ type t (** A semaphore *) val create : int -> t -(** [create n] creates a semaphore with initial value [n] - @raise Invalid_argument if [n <= 0] *) +(** [create n] creates a semaphore with initial value [n]. + @raise Invalid_argument if [n <= 0]. *) val get : t -> int -(** Current value *) +(** Current value. *) val acquire : int -> t -> unit (** [acquire n s] blocks until [get s >= n], then atomically - sets [s := !s - n] *) + sets [s := !s - n]. *) val release : int -> t -> unit -(** [release n s] atomically sets [s := !s + n] *) +(** [release n s] atomically sets [s := !s + n]. *) val with_acquire : n:int -> t -> f:(unit -> 'a) -> 'a (** [with_acquire ~n s ~f] first acquires [s] with [n] units, - calls [f ()], and then release [s] with [n] units. - Safely release the semaphore even if [f ()] fails *) + calls [f ()], and then releases [s] with [n] units. + Safely release the semaphore even if [f ()] fails. *) val wait_until_at_least : n:int -> t -> f:(unit -> 'a) -> 'a (** [wait_until_at_least ~n s ~f] waits until [get s >= n], then calls [f ()] diff --git a/src/threads/CCThread.mli b/src/threads/CCThread.mli index fe54e6f8..a8240fed 100644 --- a/src/threads/CCThread.mli +++ b/src/threads/CCThread.mli @@ -8,7 +8,7 @@ type t = Thread.t val spawn : (unit -> _) -> t -(** [spawn f] creates a new thread that runs [f ()] *) +(** [spawn f] creates a new thread that runs [f ()]. *) val spawn1 : ('a -> _) -> 'a -> t (** [spawn1 f x] is like [spawn (fun () -> f x)]. @@ -19,16 +19,16 @@ val spawn2 : ('a -> 'b -> _) -> 'a -> 'b -> t @since 0.16 *) val detach : (unit -> 'a) -> unit -(** [detach f] is the same as [ignore (spawn f)] *) +(** [detach f] is the same as [ignore (spawn f)]. *) (** {2 Array of threads} *) module Arr : sig val spawn : int -> (int -> 'a) -> t array - (** [A.spawn n f] creates an array [res] of length [n], such that - [res.(i) = spawn (fun () -> f i)] *) + (** [Arr.spawn n f] creates an array [res] of length [n], such that + [res.(i) = spawn (fun () -> f i)]. *) val join : t array -> unit - (** [A.join a] joins every thread in [a] *) + (** [Arr.join a] joins every thread in [a]. *) end (** {2 Single-Use Barrier} *) @@ -38,18 +38,18 @@ module Barrier : sig (** Barrier, used to synchronize threads *) val create : unit -> t - (** Create a barrier *) + (** Create a barrier. *) val reset : t -> unit - (** Reset to initial (non-triggered) state *) + (** Reset to initial (non-triggered) state. *) val wait : t -> unit (** [wait b] waits for barrier [b] to be activated by [activate b]. All threads calling this wait until [activate b] is called. - If [b] is already activated, [wait b] does nothing *) + If [b] is already activated, [wait b] does nothing. *) val activate : t -> unit - (** [activate b] unblocks all threads that were waiting on [b] *) + (** [activate b] unblocks all threads that were waiting on [b]. *) val activated : t -> bool (** [activated b] returns [true] iff [activate b] was called, and [reset b] diff --git a/src/threads/CCTimer.mli b/src/threads/CCTimer.mli index f0068cf8..6a2db7e5 100644 --- a/src/threads/CCTimer.mli +++ b/src/threads/CCTimer.mli @@ -14,17 +14,17 @@ val create : unit -> t val set_exn_handler : t -> (exn -> unit) -> unit (** [set_exn_handler timer f] registers [f] so that any exception - raised by a task scheduled in [timer] is given to [f] *) + raised by a task scheduled in [timer] is given to [f]. *) exception Stopped val after : t -> float -> f:(unit -> _) -> unit (** Call the callback [f] after the given number of seconds. - @raise Stopped if the timer was stopped *) + @raise Stopped if the timer was stopped. *) val at : t -> float -> f:(unit -> _) -> unit -(** Create a future that evaluates to [()] at the given Unix timestamp - @raise Stopped if the timer was stopped *) +(** Create a future that evaluates to [()] at the given Unix timestamp. + @raise Stopped if the timer was stopped. *) exception ExitEvery @@ -33,11 +33,11 @@ val every : ?delay:float -> t -> float -> f:(unit -> _) -> unit [f()] can raise ExitEvery to stop the cycle. @param delay if provided, the first call to [f ()] is delayed by that many seconds. - @raise Stopped if the timer was stopped *) + @raise Stopped if the timer was stopped. *) val stop : t -> unit (** Stop the given timer, cancelling pending tasks. Idempotent. From now on, calling most other operations on the timer will raise Stopped. *) val active : t -> bool -(** Returns [true] until [stop t] has been called. *) +(** Return [true] until [stop t] has been called. *)