Correction typos (fichiers src)

This commit is contained in:
Fourchaux 2015-11-08 22:27:59 +01:00
parent 517ed1a030
commit 44387de784
123 changed files with 190 additions and 335 deletions

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, Simon Cruanes, Gabriel Radanne
all rights reserved.
@ -41,7 +40,7 @@ module type S = sig
type 'a t
type ('a,'b) op
(** Operation that converts an ['a t] into a ['b t] *)
(** Operation that converts a ['a t] into a ['b t] *)
val apply : ('a,'b) op -> 'a t -> 'b t
(** Apply the operation to the collection. *)
@ -170,7 +169,7 @@ module Make(C : COLLECTION) = struct
| OptExtern _ -> OptFlatMap (f, op)
| OptBase _ -> OptFlatMap (f, op)
(* optimize a batch operation by fusion *)
(* Optimize a batch operation by fusion *)
let optimize : type a b. (a,b) op -> (a,b) optimized_op
= fun op -> match op with
| Compose (a, b) -> optimize_compose a b
@ -213,7 +212,7 @@ module Make(C : COLLECTION) = struct
| OptExtern (f,c) -> apply_optimized_with_fold c fold z (f a)
| OptFlatMap (f,c) -> apply_optimized_with_fold c fold z (C.flat_map f a)
(* optimize and run *)
(* Optimize and run *)
let apply op a =
let op' = optimize op in
apply_optimized op' a

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.
@ -47,7 +46,7 @@ module type S = sig
type 'a t
type ('a,'b) op
(** Operation that converts an ['a t] into a ['b t] *)
(** Operation that converts a ['a t] into a ['b t] *)
val apply : ('a,'b) op -> 'a t -> 'b t
(** Apply the operation to the collection. *)

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.

View file

@ -111,4 +111,3 @@ module MakeFree(F : FUNCTOR) : FREE_MONAD with module F = F
module MakeFreeFold(FM : FREE_MONAD)(Fold : FOLDABLE with type 'a t = 'a FM.F.t)
: FOLDABLE with type 'a t = 'a FM.t

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.
@ -41,7 +40,7 @@ let _error_of_exn f = try `Ok (f ()) with ExitWithError s -> `Error s
module PMap = struct
type ('a, 'b) t = {
is_empty : unit -> bool;
size : unit -> int; (** Number of keys *)
size : unit -> int; (* Number of keys *)
get : 'a -> 'b option;
fold : 'c. ('c -> 'a -> 'b -> 'c) -> 'c -> 'c;
to_seq : ('a * 'b) sequence;

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.
@ -26,7 +25,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
(** {1 LINQ-like operations on collections}
The purpose it to provide powerful combinators to express iteration,
The purpose is to provide powerful combinators to express iteration,
transformation and combination of collections of items. This module depends
on several other modules, including {!CCList} and {!CCSequence}.
@ -109,7 +108,7 @@ module PMap : sig
(** View a multimap as a collection of individual key/value pairs *)
val flatten_l : ('a,'b list) t -> ('a*'b) sequence
(** View a multimap as a collection of individual key/value pairs *)
(** View a multimap as a list of individual key/value pairs *)
end
(** {2 Query operators} *)
@ -161,7 +160,7 @@ val run : ?limit:int -> 'a t -> 'a sequence
val run1 : 'a t -> 'a
(** Run the query and return the first value
@raise Not_found if the query succeeds with 0 elements *)
@raise Not_found if the query succeeds with 0 element *)
val run_no_optim : ?limit:int -> 'a t -> 'a sequence
(** Run without any optimization *)
@ -169,7 +168,7 @@ val run_no_optim : ?limit:int -> 'a t -> 'a sequence
(** {6 Basics} *)
val map : ('a -> 'b) -> 'a t -> 'b t
(** map each value *)
(** Map each value *)
val (>|=) : 'a t -> ('a -> 'b) -> 'b t
(** Infix synonym of {!map} *)
@ -193,17 +192,15 @@ val flat_map : ('a -> 'b sequence) -> 'a t -> 'b t
val flat_map_l : ('a -> 'b list) -> 'a t -> 'b t
(** map each element to a collection and flatten the result *)
val flat_map_l : ('a -> 'b list) -> 'a t -> 'b t
val flatten : 'a list t -> 'a t
val flatten_seq : 'a sequence t -> 'a t
val take : int -> 'a t -> 'a t
(** take at most [n] elements *)
(** Take at most [n] elements *)
val take_while : ('a -> bool) -> 'a t -> 'a t
(** take elements while they satisfy a predicate *)
(** Take elements while they satisfy a predicate *)
val sort : ?cmp:'a ord -> unit -> 'a t -> 'a t
(** Sort items by the given comparison function *)
@ -327,7 +324,7 @@ Careful, those operators do not allow any optimization before running the
query, they might therefore be pretty slow. *)
val bind : ('a -> 'b t) -> 'a t -> 'b t
(** Use the result of a query to build another query and imediately run it. *)
(** Use the result of a query to build another query and immediately run it. *)
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t
(** Infix version of {!bind} *)

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.
@ -518,5 +517,3 @@ end
module Raw = struct
let wrap f = Wrap f
end
(* vim:ft=ocaml: *)

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.
@ -66,7 +65,7 @@ type 'a with_finalizer
type 'a or_error = [ `Ok of 'a | `Error of string ]
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t
(** wait for the result of an action, then use a function to build a
(** Wait for the result of an action, then use a function to build a
new action and execute it *)
val return : 'a -> 'a t
@ -309,7 +308,7 @@ module File : sig
explored *)
val walk : t -> ([`File | `Dir] * t) Seq.t io
(** similar to {!read_dir} (with [recurse=true]), this function walks
(** Similar to {!read_dir} (with [recurse=true]), this function walks
a directory recursively and yields either files or directories.
Is a file anything that doesn't satisfy {!is_directory} (including
symlinks, etc.) *)

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2015, simon cruanes
all rights reserved.

View file

@ -1,5 +1,3 @@
(*
copyright (c) 2013-2015, simon cruanes
all rights reserved.

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2015, simon cruanes
all rights reserved.
@ -101,7 +100,7 @@ val set : ('a, _, [>`W]) t -> int -> 'a -> unit
(** set n-th element *)
val get : ('a, _, [>`R]) t -> int -> 'a
(** get n-th element *)
(** Get n-th element *)
val fill : ('a, _, [>`W]) t -> 'a -> unit
(** [fill a x] fills [a] with [x] *)
@ -329,7 +328,7 @@ module View : sig
(** See {!select} *)
val foldi : ('b -> int -> 'a -> 'b) -> 'b -> 'a t -> 'b
(** fold on values with their index *)
(** Fold on values with their index *)
val iteri : f:(int -> 'a -> unit) -> 'a t -> unit
(** [iteri ~f v] iterates on elements of [v] with their index *)
@ -367,5 +366,3 @@ module View : sig
(** [to_array v] returns a fresh copy of the content of [v].
Exactly one of [res] and [kind] must be provided *)
end

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.

View file

@ -78,7 +78,7 @@ module type S = sig
@since 0.3.4 *)
val find_idx : ('a -> bool) -> 'a t -> (int * 'a) option
(** [find p x] returns [Some (i,x)] where [x] is the [i]-th element of [l],
(** [find_idx p x] returns [Some (i,x)] where [x] is the [i]-th element of [l],
and [p x] holds. Otherwise returns [None]
@since 0.3.4 *)
@ -152,7 +152,7 @@ module type S = sig
end
(** {2 General Implementation}
Most of those functions that a range [(i,j)] with
Most of those functions use a range [(i,j)] with
[i] included and [j] excluded *)
let rec _foldi f acc a i j =
@ -570,7 +570,7 @@ module Sub = struct
let set a i x =
let j = a.i + i in
if i<0 || j>=a.j then invalid_arg "Array.Sub.get";
if i<0 || j>=a.j then invalid_arg "Array.Sub.set";
a.arr.(j) <- x
let iter f a =
@ -655,7 +655,7 @@ module type MONO_ARRAY = sig
val set : t -> int -> elt -> unit
end
(* Dual Pivot Quicksort (YaroslavSkiy)
(* Dual Pivot Quicksort (Yaroslavskiy)
from "average case analysis of Java 7's Dual Pivot Quicksort" *)
module SortGeneric(A : MONO_ARRAY) = struct
module Rand = Random.State
@ -774,4 +774,3 @@ let sort_generic (type arr)(type elt)
Array.sort CCInt.compare a1; sort_generic ~cmp:CCInt.compare (module IA) a2; \
a1 = a2 )
*)

View file

@ -80,7 +80,7 @@ module type S = sig
@since 0.3.4 *)
val find_idx : ('a -> bool) -> 'a t -> (int * 'a) option
(** [find p x] returns [Some (i,x)] where [x] is the [i]-th element of [l],
(** [find_idx p x] returns [Some (i,x)] where [x] is the [i]-th element of [l],
and [p x] holds. Otherwise returns [None]
@since 0.3.4 *)
@ -125,7 +125,7 @@ module type S = sig
@raise Invalid_argument if they have distinct lengths *)
val shuffle : 'a t -> unit
(** shuffle randomly the array, in place *)
(** Shuffle randomly the array, in place *)
val shuffle_with : Random.State.t -> 'a t -> unit
(** Like shuffle but using a specialized random state *)
@ -142,15 +142,15 @@ module type S = sig
val pp: ?sep:string -> (Buffer.t -> 'a -> unit) ->
Buffer.t -> 'a t -> unit
(** print an array of items with printing function *)
(** Print an array of items with printing function *)
val pp_i: ?sep:string -> (Buffer.t -> int -> 'a -> unit) ->
Buffer.t -> 'a t -> unit
(** print an array, giving the printing function both index and item *)
(** Print an array, giving the printing function both index and item *)
val print : ?sep:string -> (Format.formatter -> 'a -> unit) ->
Format.formatter -> 'a t -> unit
(** print an array of items with printing function *)
(** Print an array of items with printing function *)
end
(** {2 Arrays} *)
@ -169,7 +169,7 @@ val filter_map : ('a -> 'b option) -> 'a t -> 'b t
(** Map each element into another value, or discard it *)
val flat_map : ('a -> 'b t) -> 'a t -> 'b array
(** transform each element into an array, then flatten *)
(** Transform each element into an array, then flatten *)
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t
(** Infix version of {!flat_map} *)
@ -251,4 +251,3 @@ val sort_generic :
(** Sort the array, without allocating (eats stack space though). Performance
might be lower than {!Array.sort}.
@since 0.14 *)

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.
@ -43,4 +42,3 @@ val pp : t printer
(** Printer for booleans *)
val print : t formatter

View file

@ -11,5 +11,3 @@ let compare = Char.compare
let pp = Buffer.add_char
let print = Format.pp_print_char

View file

@ -1,4 +1,3 @@
(* This file is free software, part of containers. See file "license" for more details. *)
(** {1 Utils around char}
@ -12,4 +11,3 @@ val compare : t -> t -> int
val pp : Buffer.t -> t -> unit
val print : Format.formatter -> t -> unit

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.
@ -26,7 +25,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
(** {1 Error Monad}
The variant is polymorphic in the error type since 0.5 *)
The variant is polymorphic in the error type
@since 0.5 *)
type 'a sequence = ('a -> unit) -> unit
type 'a equal = 'a -> 'a -> bool
@ -108,7 +108,8 @@ val fold : success:('a -> 'b) -> failure:('err -> 'b) -> ('a, 'err) t -> 'b
(** {2 Wrappers}
The functions {!guard}, {!wrap1}, {!wrap2} and {!wrap3} now return
exceptions in case of failure, @since 0.5 *)
exceptions in case of failure,
@since 0.5 *)
val guard : (unit -> 'a) -> ('a, exn) t
(** [guard f] runs [f ()] and returns its result wrapped in [`Ok]. If
@ -130,6 +131,7 @@ val wrap2 : ('a -> 'b -> 'c) -> 'a -> 'b -> ('c, exn) t
(** Same as {!guard} but gives the function two arguments. *)
val wrap3 : ('a -> 'b -> 'c -> 'd) -> 'a -> 'b -> 'c -> ('d, exn) t
(** Same as {!guard} but gives the function three arguments. *)
(** {2 Applicative} *)

View file

@ -84,7 +84,7 @@ let fsign a =
exception TrapNaN of string
let sign_exn (a:float) =
if is_nan a then raise (TrapNaN "sign")
if is_nan a then raise (TrapNaN "sign_exn")
else compare a 0.
let to_int (a:float) = Pervasives.int_of_float a
@ -101,4 +101,3 @@ let random_range i j st = i +. random (j-.i) st
let equal_precision ~epsilon a b = abs_float (a-.b) < epsilon
let classify = Pervasives.classify_float

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013, simon cruanes
all rights reserved.

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013, simon cruanes
all rights reserved.
@ -35,7 +34,7 @@ type 'a printer = t -> 'a -> unit
(** {2 Combinators} *)
val silent : 'a printer (** prints nothing *)
val silent : 'a printer (** Prints nothing *)
val unit : unit printer
val int : int printer

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.
@ -52,7 +51,7 @@ val const : 'a -> 'b -> 'a
(** [const x y = x] for any [y] *)
val flip : ('a -> 'b -> 'c) -> 'b -> 'a -> 'c
(** flip arguments *)
(** Flip arguments *)
val curry : ('a * 'b -> 'c) -> 'a -> 'b -> 'c
@ -80,7 +79,7 @@ val finally : h:(unit -> unit) -> f:(unit -> 'a) -> 'a
(** {2 Monad}
functions with a fixed domain are monads in their codomain *)
Functions with a fixed domain are monads in their codomain *)
module Monad(X : sig type t end) : sig
type 'a t = X.t -> 'a

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.
@ -118,11 +117,11 @@ module type S = sig
(** Iterate on values in the table *)
val keys_list : ('a, 'b) Hashtbl.t -> 'a list
(** [keys t] is the list of keys in [t].
(** [keys_list t] is the list of keys in [t].
@since 0.8 *)
val values_list : ('a, 'b) Hashtbl.t -> 'b list
(** [values t] is the list of values in [t].
(** [values_list t] is the list of values in [t].
@since 0.8 *)
val map_list : (key -> 'a -> 'b) -> 'a t -> 'b list

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.
@ -46,11 +45,11 @@ val values : ('a,'b) Hashtbl.t -> 'b sequence
(** Iterate on values in the table *)
val keys_list : ('a, 'b) Hashtbl.t -> 'a list
(** [keys t] is the list of keys in [t].
(** [keys_list t] is the list of keys in [t].
@since 0.8 *)
val values_list : ('a, 'b) Hashtbl.t -> 'b list
(** [values t] is the list of values in [t].
(** [values_list t] is the list of values in [t].
@since 0.8 *)
val map_list : ('a -> 'b -> 'c) -> ('a, 'b) Hashtbl.t -> 'c list
@ -227,4 +226,5 @@ module MakeCounter(X : Hashtbl.HashedType)
with type elt = X.t
and type t = int Hashtbl.Make(X).t
(** Create a new counter type
The type [t] is exposed @since 0.14 *)
The type [t] is exposed
@since 0.14 *)

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.
@ -112,7 +111,7 @@ val write_line : out_channel -> string -> unit
val write_gen : ?sep:string -> out_channel -> string gen -> unit
(** Write the given strings on the output. If provided, add [sep] between
every two string (but not at the end) *)
every two strings (but not at the end) *)
val write_lines : out_channel -> string gen -> unit
(** Write every string on the output, followed by "\n". *)
@ -188,7 +187,7 @@ module File : sig
type walk_item = [`File | `Dir] * t
val walk : t -> walk_item gen
(** similar to {!read_dir} (with [recurse=true]), this function walks
(** Similar to {!read_dir} (with [recurse=true]), this function walks
a directory recursively and yields either files or directories.
Is a file anything that doesn't satisfy {!is_directory} (including
symlinks, etc.) *)

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.
@ -48,7 +47,7 @@ let pow a b =
else acc * (aux (acc*acc) (n/2))
in
match b with
| 0 -> if a = 0 then raise (Invalid_argument "Undefined value 0^0") else 1
| 0 -> if a = 0 then raise (Invalid_argument "pow: undefined value 0^0") else 1
| b when b < 0 -> raise (Invalid_argument "pow: can't raise int to negative power")
| b -> aux a b

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.
@ -43,7 +42,7 @@ val neg : t -> t
val pow : t -> t -> t
(** [pow a b = a^b] for positive integers [a] and [b].
raises [Invalid_argument] if [a = b = 0] or [b] < 0.
Raises [Invalid_argument] if [a = b = 0] or [b] < 0.
@since 0.11 *)
type 'a printer = Buffer.t -> 'a -> unit
@ -62,4 +61,3 @@ val to_string : t -> string
val of_string : string -> t option
(** @since 0.13 *)

View file

@ -1,4 +1,3 @@
(* This file is free software, part of containers. See file "license" for more details. *)
include Int64

View file

@ -1,4 +1,3 @@
(* This file is free software, part of containers. See file "license" for more details. *)
(** {1 Int64}
@ -78,4 +77,3 @@ val to_string : t -> string
val of_string : string -> t option
val of_string_exn : string -> t

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.
@ -72,8 +71,8 @@ val fold_map : ('acc -> 'a -> 'acc * 'b) -> 'acc -> 'a list -> 'acc * 'b list
@since 0.14 *)
val fold_flat_map : ('acc -> 'a -> 'acc * 'b list) -> 'acc -> 'a list -> 'acc * 'b list
(** [fold_map f acc l] is a [fold_left]-like function, but it also maps the
list to a list of list that is then [flatten]'d..
(** [fold_flat_map f acc l] is a [fold_left]-like function, but it also maps the
list to a list of lists that is then [flatten]'d..
@since 0.14 *)
val init : int -> (int -> 'a) -> 'a t
@ -85,13 +84,13 @@ val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val flat_map : ('a -> 'b t) -> 'a t -> 'b t
(** map and flatten at the same time (safe). Evaluation order is not guaranteed. *)
(** Map and flatten at the same time (safe). Evaluation order is not guaranteed. *)
val flatten : 'a t t -> 'a t
(** Safe flatten *)
val product : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t
(** cartesian product of the two lists, with the given combinator *)
(** Cartesian product of the two lists, with the given combinator *)
val fold_product : ('c -> 'a -> 'b -> 'c) -> 'c -> 'a t -> 'b t -> 'c
(** Fold on the cartesian product *)
@ -119,10 +118,10 @@ val return : 'a -> 'a t
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t
val take : int -> 'a t -> 'a t
(** take the [n] first elements, drop the rest *)
(** Take the [n] first elements, drop the rest *)
val drop : int -> 'a t -> 'a t
(** drop the [n] first elements, keep the rest *)
(** Drop the [n] first elements, keep the rest *)
val take_drop : int -> 'a t -> 'a t * 'a t
(** [take_drop n l] returns [l1, l2] such that [l1 @ l2 = l] and
@ -135,7 +134,7 @@ val drop_while : ('a -> bool) -> 'a t -> 'a t
(** @since 0.13 *)
val split : int -> 'a t -> 'a t * 'a t
(** synonym to {!take_drop}
(** Synonym to {!take_drop}
@deprecated since 0.13: conflict with the {!List.split} standard function *)
val last : int -> 'a t -> 'a t
@ -153,7 +152,7 @@ val find_pred_exn : ('a -> bool) -> 'a t -> 'a
@since 0.11 *)
val find_map : ('a -> 'b option) -> 'a t -> 'b option
(** [find f l] traverses [l], applying [f] to each element. If for
(** [find_map f l] traverses [l], applying [f] to each element. If for
some element [x], [f x = Some y], then [Some y] is returned. Otherwise
the call returns [None]
@since 0.11 *)
@ -170,7 +169,7 @@ val findi : (int -> 'a -> 'b option) -> 'a t -> 'b option
@since 0.3.4 *)
val find_idx : ('a -> bool) -> 'a t -> (int * 'a) option
(** [find p x] returns [Some (i,x)] where [x] is the [i]-th element of [l],
(** [find_idx p x] returns [Some (i,x)] where [x] is the [i]-th element of [l],
and [p x] holds. Otherwise returns [None] *)
val remove : ?eq:('a -> 'a -> bool) -> x:'a -> 'a t -> 'a t
@ -182,7 +181,7 @@ val filter_map : ('a -> 'b option) -> 'a t -> 'b t
(** Map and remove elements at the same time *)
val sorted_merge : ?cmp:('a -> 'a -> int) -> 'a list -> 'a list -> 'a list
(** merges elements from both sorted list *)
(** Merges elements from both sorted list *)
val sort_uniq : ?cmp:('a -> 'a -> int) -> 'a list -> 'a list
(** Sort the list and remove duplicate elements *)
@ -212,20 +211,20 @@ module Idx : sig
val iteri : (int -> 'a -> unit) -> 'a t -> unit
val foldi : ('b -> int -> 'a -> 'b) -> 'b -> 'a t -> 'b
(** fold on list, with index *)
(** Fold on list, with index *)
val get : 'a t -> int -> 'a option
val get_exn : 'a t -> int -> 'a
(** get the i-th element, or
(** Get the i-th element, or
@raise Not_found if the index is invalid *)
val set : 'a t -> int -> 'a -> 'a t
(** set i-th element (removes the old one), or does nothing if
index too high *)
(** Set i-th element (removes the old one), or does nothing if
index is too high *)
val insert : 'a t -> int -> 'a -> 'a t
(** insert at i-th position, between the two existing elements. If the
(** Insert at i-th position, between the two existing elements. If the
index is too high, append at the end of the list *)
val remove : 'a t -> int -> 'a t
@ -245,22 +244,22 @@ module Set : sig
@since 0.11 *)
val mem : ?eq:('a -> 'a -> bool) -> 'a -> 'a t -> bool
(** membership to the list. Linear time *)
(** Membership to the list. Linear time *)
val subset : ?eq:('a -> 'a -> bool) -> 'a t -> 'a t -> bool
(** test for inclusion *)
(** Test for inclusion *)
val uniq : ?eq:('a -> 'a -> bool) -> 'a t -> 'a t
(** list uniq: remove duplicates w.r.t the equality predicate.
(** List uniq. Remove duplicates w.r.t the equality predicate.
Complexity is quadratic in the length of the list, but the order
of elements is preserved. If you wish for a faster de-duplication
but do not care about the order, use {!sort_uniq}*)
val union : ?eq:('a -> 'a -> bool) -> 'a t -> 'a t -> 'a t
(** list union. Complexity is product of length of inputs. *)
(** List union. Complexity is product of length of inputs. *)
val inter : ?eq:('a -> 'a -> bool) -> 'a t -> 'a t -> 'a t
(** list intersection. Complexity is product of length of inputs., *)
(** List intersection. Complexity is product of length of inputs. *)
end
(** {2 Other Constructors} *)
@ -277,10 +276,10 @@ val (--) : int -> int -> int t
(** Infix alias for [range] *)
val replicate : int -> 'a -> 'a t
(** replicate the given element [n] times *)
(** Replicate the given element [n] times *)
val repeat : int -> 'a t -> 'a t
(** concatenate the list with itself [n] times *)
(** Concatenate the list with itself [n] times *)
(** {2 Association Lists} *)
@ -341,7 +340,7 @@ module Zipper : sig
val right_exn : 'a t -> 'a t
(** Go to the right, or
@raise Invalid_argument if the zipper is already at rightmost position
@raise Invalid_argument if the zipper is already at rightmost pos
@since 0.14 *)
val modify : ('a option -> 'a option) -> 'a t -> 'a t

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.
@ -123,4 +122,3 @@ module Make(O : Map.OrderedType) = struct
) m;
Format.pp_print_string fmt stop
end

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.
@ -190,4 +189,3 @@ let pp ppx buf o = match o with
let print ppx out = function
| None -> Format.pp_print_string out "None"
| Some x -> Format.fprintf out "@[Some %a@]" ppx x

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.
@ -58,13 +57,13 @@ val flat_map : ('a -> 'b t) -> 'a t -> 'b t
val map2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t
val iter : ('a -> unit) -> 'a t -> unit
(** Iterate on 0 or 1 elements *)
(** Iterate on 0 or 1 element *)
val fold : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a
(** Fold on 0 or 1 elements *)
(** Fold on 0 or 1 element *)
val filter : ('a -> bool) -> 'a t -> 'a t
(** Filter on 0 or 1 elements
(** Filter on 0 or 1 element
@since 0.5 *)
val get : 'a -> 'a t -> 'a
@ -138,4 +137,3 @@ val pp : 'a printer -> 'a t printer
val print : 'a fmt -> 'a t fmt
(** @since 0.13 *)

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013, simon cruanes
all rights reserved.

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013, simon cruanes
all rights reserved.
@ -91,7 +90,7 @@ val output : out_channel -> 'a t -> 'a -> unit
val to_string : 'a t -> 'a -> string
val sprintf : ('a, Buffer.t, unit, string) format4 -> 'a
(** print into a string *)
(** Print into a string *)
val fprintf : out_channel -> ('a, Buffer.t, unit, unit) format4 -> 'a
(** Print on a channel *)

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.
@ -91,7 +90,7 @@ let _split i st =
let split i st = try Some (_split i st) with SplitFail -> None
(* partition of an int into [len] integers. We divide-and-conquer on
(* Partition of an int into [len] integers. We divide-and-conquer on
the expected length, until it reaches 1. *)
let split_list i ~len st =
let rec aux i ~len acc =
@ -178,4 +177,3 @@ let (<*>) f g st = f st (g st)
let __default_state = Random.State.make_self_init ()
let run ?(st=__default_state) g = g st

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.
@ -74,7 +73,7 @@ val choose_return : 'a list -> 'a t
@raise Invalid_argument if the list is empty *)
val replicate : int -> 'a t -> 'a list t
(** [replace n g] makes a list of [n] elements which are all generated
(** [replicate n g] makes a list of [n] elements which are all generated
randomly using [g] *)
val list_seq : 'a t list -> 'a list t
@ -146,5 +145,3 @@ val (<*>) : ('a -> 'b) t -> 'a t -> 'b t
val run : ?st:state -> 'a t -> 'a
(** Using a random state (possibly the one in argument) run a generator *)

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.
@ -54,5 +53,3 @@ let to_seq r yield = yield !r
let print pp_x fmt r = pp_x fmt !r
let pp pp_x buf r = pp_x buf !r

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.
@ -57,4 +56,3 @@ val to_seq : 'a t -> 'a sequence
val print : 'a print -> 'a t print
val pp : 'a pp -> 'a t pp

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.
@ -95,4 +94,3 @@ module Make(O : Map.OrderedType) = struct
) m;
Format.pp_print_string fmt stop
end

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.
@ -86,7 +85,7 @@ let _is_sub ~sub i s j ~len =
j+len <= String.length s && check 0
let is_sub ~sub i s j ~len =
if i+len > String.length sub then invalid_arg "String.is_sub";
if i+len > String.length sub then invalid_arg "CCString.is_sub";
_is_sub ~sub i s j ~len
(* note: inefficient *)
@ -116,7 +115,7 @@ let rfind ~sub s =
with Exit ->
!i
(* replace substring [s.[pos]....s.[pos+len-1]] by [by] in [s] *)
(* Replace substring [s.[pos]....s.[pos+len-1]] by [by] in [s] *)
let replace_at_ ~pos ~len ~by s =
let b = Buffer.create (length s + length by - len) in
Buffer.add_substring b s 0 pos;
@ -125,7 +124,7 @@ let replace_at_ ~pos ~len ~by s =
Buffer.contents b
let replace ?(which=`All) ~sub ~by s =
if sub="" then invalid_arg "CCstring.replace";
if sub="" then invalid_arg "CCString.replace";
match which with
| `Left ->
let i = find ~sub s in
@ -416,23 +415,23 @@ let exists p s =
with MyExit -> true
let map2 f s1 s2 =
if length s1 <> length s2 then invalid_arg "String.map2";
if length s1 <> length s2 then invalid_arg "CCString.map2";
init (String.length s1) (fun i -> f s1.[i] s2.[i])
let iter2 f s1 s2 =
if length s1 <> length s2 then invalid_arg "String.iter2";
if length s1 <> length s2 then invalid_arg "CCString.iter2";
for i = 0 to String.length s1 - 1 do
f s1.[i] s2.[i]
done
let iteri2 f s1 s2 =
if length s1 <> length s2 then invalid_arg "String.iteri2";
if length s1 <> length s2 then invalid_arg "CCString.iteri2";
for i = 0 to String.length s1 - 1 do
f i s1.[i] s2.[i]
done
let fold2 f acc s1 s2 =
if length s1 <> length s2 then invalid_arg "String.fold2";
if length s1 <> length s2 then invalid_arg "CCString.fold2";
let rec fold' acc s1 s2 i =
if i = String.length s1 then acc
else fold' (f acc s1.[i] s2.[i]) s1 s2 (i+1)

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.
@ -222,28 +221,28 @@ val iter : (char -> unit) -> string -> unit
@since 0.12 *)
val iteri : (int -> char -> unit) -> string -> unit
(** iter on chars with their index
(** Iter on chars with their index
@since 0.12 *)
val map : (char -> char) -> string -> string
(** map chars
(** Map chars
@since 0.12 *)
val mapi : (int -> char -> char) -> string -> string
(** map chars with their index
(** Map chars with their index
@since 0.12 *)
val flat_map : ?sep:string -> (char -> string) -> string -> string
(** map each chars to a string, then concatenates them all
(** Map each chars to a string, then concatenates them all
@param sep optional separator between each generated string
@since 0.12 *)
val for_all : (char -> bool) -> string -> bool
(** true for all chars?
(** True for all chars?
@since 0.12 *)
val exists : (char -> bool) -> string -> bool
(** true for some char?
(** True for some char?
@since 0.12 *)
include S with type t := string
@ -251,32 +250,32 @@ include S with type t := string
(** {2 Operations on 2 strings} *)
val map2 : (char -> char -> char) -> string -> string -> string
(** map pairs of chars
(** Map pairs of chars
@raise Invalid_argument if the strings have not the same length
@since 0.12 *)
val iter2: (char -> char -> unit) -> string -> string -> unit
(** iterate on pairs of chars
(** Iterate on pairs of chars
@raise Invalid_argument if the strings have not the same length
@since 0.12 *)
val iteri2: (int -> char -> char -> unit) -> string -> string -> unit
(** iterate on pairs of chars with their index
(** Iterate on pairs of chars with their index
@raise Invalid_argument if the strings have not the same length
@since 0.12 *)
val fold2: ('a -> char -> char -> 'a) -> 'a -> string -> string -> 'a
(** fold on pairs of chars
(** Fold on pairs of chars
@raise Invalid_argument if the strings have not the same length
@since 0.12 *)
val for_all2 : (char -> char -> bool) -> string -> string -> bool
(** all pair of chars respect the predicate?
(** All pairs of chars respect the predicate?
@raise Invalid_argument if the strings have not the same length
@since 0.12 *)
val exists2 : (char -> char -> bool) -> string -> string -> bool
(** exists a pair of chars?
(** Exists a pair of chars?
@raise Invalid_argument if the strings have not the same length
@since 0.12 *)
@ -284,7 +283,7 @@ val exists2 : (char -> char -> bool) -> string -> string -> bool
module Split : sig
val list_ : by:string -> string -> (string*int*int) list
(** split the given string along the given separator [by]. Should only
(** Eplit the given string along the given separator [by]. Should only
be used with very small separators, otherwise
use {!Containers_string.KMP}.
@return a list of slices [(s,index,length)] that are
@ -318,7 +317,7 @@ module Split : sig
val klist_cpy : by:string -> string -> string klist
val left : by:string -> string -> (string * string) option
(** Split on the first occurrence of [by] from the left-most part of
(** Split on the first occurrence of [by] from the leftmost part of
the string
@since 0.12 *)

View file

@ -36,7 +36,7 @@ type 'a ord = 'a -> 'a -> int
type 'a printer = Buffer.t -> 'a -> unit
type 'a formatter = Format.formatter -> 'a -> unit
(** a vector of 'a. *)
(** A vector of 'a. *)
type ('a,'mut) t = {
mutable size : int;
mutable vec : 'a array;
@ -167,7 +167,7 @@ let push v x =
let v = of_list [1;2;3] in push v 4; to_list v = [1;2;3;4]
*)
(** add all elements of b to a *)
(** Add all elements of b to a *)
let append a b =
if _empty_array a
then if _empty_array b
@ -198,15 +198,15 @@ let append a b =
*)
let get v i =
if i < 0 || i >= v.size then invalid_arg "Vector.get";
if i < 0 || i >= v.size then invalid_arg "CCVector.get";
Array.unsafe_get v.vec i
let set v i x =
if i < 0 || i >= v.size then invalid_arg "Vector.set";
if i < 0 || i >= v.size then invalid_arg "CCVector.set";
Array.unsafe_set v.vec i x
let remove v i =
if i < 0 || i >= v.size then invalid_arg "Vector.remove";
if i < 0 || i >= v.size then invalid_arg "CCVector.remove";
(* if v.(i) not the last element, then put last element at index i *)
if i < v.size - 1
then v.vec.(i) <- v.vec.(v.size - 1);

View file

@ -31,7 +31,7 @@ type rw = [`RW]
(** Mutability is [rw] (read-write) or [ro] (read-only) *)
type ('a, 'mut) t
(** the type of a vector of elements of type ['a], with
(** The type of a vector of elements of type ['a], with
a mutability flat ['mut] *)
type 'a vector = ('a, rw) t
@ -70,7 +70,7 @@ val init : int -> (int -> 'a) -> ('a, 'mut) t
(** Init the vector with the given function and size *)
val clear : ('a, rw) t -> unit
(** clear the content of the vector *)
(** Clear the content of the vector *)
val ensure_with : init:'a -> ('a, rw) t -> int -> unit
(** Hint to the vector that it should have at least the given capacity.
@ -84,16 +84,16 @@ val ensure : ('a, rw) t -> int -> unit
is not provided. *)
val is_empty : ('a, _) t -> bool
(** is the vector empty? *)
(** Is the vector empty? *)
val push : ('a, rw) t -> 'a -> unit
(** add an element at the end of the vector *)
(** Add an element at the end of the vector *)
val append : ('a, rw) t -> ('a, _) t -> unit
(** [append a b] adds all elements of b to a *)
val append_array : ('a, rw) t -> 'a array -> unit
(** same as append, with an array *)
(** Same as append, with an array *)
val append_seq : ('a, rw) t -> 'a sequence -> unit
(** Append content of sequence *)
@ -105,7 +105,7 @@ val append_list : ('a, rw) t -> 'a list -> unit
val equal : 'a equal -> ('a,_) t equal
val compare : 'a ord -> ('a,_) t ord
(** Total ordering on vectors: Lexicographic comparison. *)
(** Total ordering on vectors. Lexicographic comparison. *)
exception Empty
(** Raised on empty stack *)
@ -114,7 +114,7 @@ val pop : ('a, rw) t -> 'a option
(** Remove last element, or [None] *)
val pop_exn : ('a, rw) t -> 'a
(** remove last element, or raise a Failure if empty
(** Remove last element, or raise a Failure if empty
@raise Empty on an empty vector *)
val top : ('a, _) t -> 'a option
@ -130,11 +130,11 @@ val copy : ('a,_) t -> ('a,'mut) t
(** Shallow copy (may give an immutable or mutable vector) *)
val shrink : ('a, rw) t -> int -> unit
(** shrink to the given size (remove elements above this size).
(** Shrink to the given size (remove elements above this size).
Does nothing if the parameter is bigger than the current size. *)
val member : ?eq:('a -> 'a -> bool) -> 'a -> ('a, _) t -> bool
(** is the element a member of the vector? *)
(** Is the element a member of the vector? *)
val sort : ('a -> 'a -> int) -> ('a, _) t -> ('a, 'mut) t
(** Sort the vector, returning a copy of it that is sorted
@ -144,39 +144,39 @@ val sort' : ('a -> 'a -> int) -> ('a, rw) t -> unit
(** Sort the vector in place (modifying it). *)
val uniq_sort : ('a -> 'a -> int) -> ('a, rw) t -> unit
(** Sort the array and remove duplicates, in place (e.e. modifying
(** Sort the array and remove duplicates, in place (e.g. modifying
the vector itself) *)
val iter : ('a -> unit) -> ('a,_) t -> unit
(** iterate on the vector's content *)
(** Iterate on the vector's content *)
val iteri : (int -> 'a -> unit) -> ('a,_) t -> unit
(** iterate on the vector, with indexes *)
(** Iterate on the vector, with indexes *)
val map : ('a -> 'b) -> ('a,_) t -> ('b, 'mut) t
(** map elements of the vector, yielding a new vector *)
(** Map elements of the vector, yielding a new vector *)
val filter : ('a -> bool) -> ('a,_) t -> ('a, 'mut) t
(** filter elements from the vector. [filter p v] leaves [v] unchanged but
(** Filter elements from the vector. [filter p v] leaves [v] unchanged but
returns a new vector that only contains elements of [v] satisfying [p]. *)
val filter' : ('a -> bool) -> ('a, rw) t -> unit
(** Filter elements in place. *)
val fold : ('b -> 'a -> 'b) -> 'b -> ('a,_) t -> 'b
(** fold on elements of the vector *)
(** Fold on elements of the vector *)
val exists : ('a -> bool) -> ('a,_) t -> bool
(** existential test (is there an element that satisfies the predicate?) *)
(** Existential test (is there an element that satisfies the predicate?) *)
val for_all : ('a -> bool) -> ('a,_) t -> bool
(** universal test (do all the elements satisfy the predicate?) *)
(** Universal test (do all the elements satisfy the predicate?) *)
val find : ('a -> bool) -> ('a,_) t -> 'a option
(** Find an element that satisfies the predicate *)
val find_exn : ('a -> bool) -> ('a,_) t -> 'a
(** find an element that satisfies the predicate, or
(** Find an element that satisfies the predicate, or
@raise Not_found if no element does *)
val find_map : ('a -> 'b option) -> ('a,_) t -> 'b option
@ -211,11 +211,11 @@ val (>|=) : ('a,_) t -> ('a -> 'b) -> ('b, 'mut) t
(** Infix version of {!map} *)
val get : ('a,_) t -> int -> 'a
(** access element by its index, or
(** Access element by its index, or
@raise Invalid_argument if bad index *)
val set : ('a, rw) t -> int -> 'a -> unit
(** modify element at given index, or
(** Modify element at given index, or
@raise Invalid_argument if bad index *)
val remove : ('a, rw) t -> int -> unit
@ -237,7 +237,7 @@ val rev_iter : ('a -> unit) -> ('a,_) t -> unit
@since 0.14 *)
val size : ('a,_) t -> int
(** number of elements in vector *)
(** Number of elements in vector *)
val length : (_,_) t -> int
(** Synonym for {! size} *)

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013, simon cruanes
all rights reserved.

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013, simon cruanes
all rights reserved.
@ -99,17 +98,17 @@ val union_into : into:t -> t -> unit
(** [union ~into bv] sets [into] to the union of itself and [bv]. *)
val inter_into : into:t -> t -> unit
(** [union ~into bv] sets [into] to the intersection of itself and [bv] *)
(** [inter ~into bv] sets [into] to the intersection of itself and [bv] *)
val union : t -> t -> t
(** [union bv1 bv2] returns the union of the two sets *)
val inter : t -> t -> t
(** Intersection of bitvectors *)
(** [inter bv1 bv2] returns the intersection of the two sets *)
val select : t -> 'a array -> 'a list
(** [select arr bv] selects the elements of [arr] whose index
correspond to a true bit in [bv]. If [bv] is too short, elements of [arr]
corresponds to a true bit in [bv]. If [bv] is too short, elements of [arr]
with too high an index cannot be selected and are therefore not
selected. *)

View file

@ -51,7 +51,7 @@ module type S = sig
@raise TooManyFields if there is no room *)
val int3 : ?name:string -> unit -> int field
(** New field for 3-bits int (same as [int ~width:3])
(** New field of type 3-bits int (same as [int ~width:3])
@raise Frozen if [freeze ()] was called
@raise TooManyFields if there is no room *)

View file

@ -85,7 +85,7 @@ module type S = sig
@raise TooManyFields if there is no room *)
val int3 : ?name:string -> unit -> int field
(** New field for 3-bits int (same as [int ~width:3])
(** New field of type 3-bits int (same as [int ~width:3])
@raise Frozen if [freeze ()] was called
@raise TooManyFields if there is no room *)

View file

@ -1,4 +1,3 @@
(* This file is free software, part of containers. See file "license" for more details. *)
(** {1 Bloom Filter} *)
@ -163,4 +162,3 @@ let add_seq f seq = seq (add f)
let rec add_gen f g = match g() with
| None -> ()
| Some x -> add f x; add_gen f g

View file

@ -1,4 +1,3 @@
(* This file is free software, part of containers. See file "license" for more details. *)
(** {1 Bloom Filter}
@ -46,7 +45,7 @@ val load : _ t -> float
accurate {!mem} is *)
val mem : 'a t -> 'a -> bool
(** [mem f x] tests whether [x] (probably) belongs in [f] *)
(** [mem f x] tests whether [x] (probably) belongs to [f] *)
val add : 'a t -> 'a -> unit
(** [add f x] adds [x] into [f] *)
@ -57,7 +56,7 @@ val union_mut : into:'a t -> 'a t -> unit
@raise Invalid_argument if the two sets do not have the same size *)
val union : 'a t -> 'a t -> 'a t
(** the sets MUST have the same set of hash functions
(** The sets MUST have the same set of hash functions
@raise Invalid_argument if the two sets do not have the same size *)
val inter_mut : into:'a t -> 'a t -> unit
@ -66,7 +65,7 @@ val inter_mut : into:'a t -> 'a t -> unit
@raise Invalid_argument if the two sets do not have the same size *)
val inter : 'a t -> 'a t -> 'a t
(** the sets MUST have the same set of hash functions
(** The sets MUST have the same set of hash functions
@raise Invalid_argument if the two sets do not have the same size *)
(** {2 Conversions} *)
@ -76,4 +75,3 @@ val add_list : 'a t -> 'a list -> unit
val add_seq : 'a t -> 'a sequence -> unit
val add_gen : 'a t -> 'a gen -> unit

View file

@ -64,7 +64,7 @@ val with_cache_rec : ('a,'b) t -> (('a -> 'b) -> 'a -> 'b) -> 'a -> 'b
some [f' = fix f], such that recursive calls to [f'] are cached in [c].
It is similar to {!with_cache} but with a function that takes as
first argument its own recursive version.
Examples (memoized Fibonacci function):
Example (memoized Fibonacci function):
{[
let fib = with_cache_rec (lru 256)
(fun fib' n -> match n with
@ -84,7 +84,7 @@ val iter : ('a,'b) t -> ('a -> 'b -> unit) -> unit
(** Iterate on cached values. Should yield [size cache] pairs. *)
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

View file

@ -47,7 +47,7 @@ val equal : ?eq:('a -> 'a -> bool) -> 'a t -> 'a t -> bool
@since 0.13 *)
val compare : ?cmp:('a -> 'a -> int) -> 'a t -> 'a t -> int
(** [equal a b] compares lexicographically [a] and [b]
(** [compare a b] compares lexicographically [a] and [b]
@param cmp comparison function for elements
@since 0.13 *)

View file

@ -364,8 +364,8 @@ let append q1 q2 =
*)
(*$R
let q1 = of_seq (Sequence.of_list [1;2;3;4]) in
let q2 = of_seq (Sequence.of_list [5;6;7;8]) in
let q1 = of_seq (Sequence.of_list [1;2;3;4]) in
let q2 = of_seq (Sequence.of_list [5;6;7;8]) in
let q = append q1 q2 in
let l = Sequence.to_list (to_seq q) in
OUnit.assert_equal ~printer:pp_ilist [1;2;3;4;5;6;7;8] l
@ -516,4 +516,3 @@ let print pp_x out d =
pp_x out x
) d;
Format.fprintf out "}@]"

View file

@ -86,7 +86,7 @@ val last : 'a t -> 'a option
(** Last element of the queue *)
val first_exn : 'a t -> 'a
(** Same as {!peek} but
(** Same as {!first} but
@raise Empty if the queue is empty *)
val last_exn : 'a t -> 'a

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.
@ -269,4 +268,3 @@ module Make(X : HASHABLE) = struct
(function Empty -> () | Key (_, v, _) -> yield v)
tbl.arr
end

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2015, simon cruanes
all rights reserved.

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2015, simon cruanes
all rights reserved.
@ -53,7 +52,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
@ -342,7 +341,7 @@ val mk_mut_tbl : ?eq:('v -> 'v -> bool) ->
?hash:('v -> int) ->
int ->
('v, ('v * 'a * 'v)) 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}

View file

@ -1,4 +1,4 @@
(* This file is free softwarem part of containers. See file "license" for more details. *)
(* This file is free software, part of containers. See file "license" for more details. *)
(** {1 Mutable Set} *)
@ -37,7 +37,7 @@ module type S = sig
(** [mem s x] returns [true] iff [x] is in [s] *)
val find_exn : t -> elt -> elt
(** [find s x] returns [y] if [x] and [y] are equal, and [mem s y].
(** [find_exn s x] returns [y] if [x] and [y] are equal, and [mem s y].
@raise Not_found if [x] not in [s] *)
val find : t -> elt -> elt option

View file

@ -1,4 +1,4 @@
(* This file is free softwarem part of containers. See file "license" for more details. *)
(* This file is free software, part of containers. See file "license" for more details. *)
(** {1 Mutable Set}
@ -41,7 +41,7 @@ module type S = sig
(** [mem s x] returns [true] iff [x] is in [s] *)
val find_exn : t -> elt -> elt
(** [find s x] returns [y] if [x] and [y] are equal, and [mem s y].
(** [find_exn s x] returns [y] if [x] and [y] are equal, and [mem s y].
@raise Not_found if [x] not in [s] *)
val find : t -> elt -> elt option
@ -101,4 +101,3 @@ module type ELEMENT = sig
end
module Make(E : ELEMENT) : S with type elt = E.t

View file

@ -1,4 +1,3 @@
(* This file is free software, part of containers. See file "license" for more details. *)
(*$inject
@ -642,7 +641,7 @@ module Make(Key : KEY)
|> List.sort Pervasives.compare) )
*)
let rec add_gen_mut~id m g = match g() with
let rec add_gen_mut ~id m g = match g() with
| None -> m
| Some (k,v) -> add_gen_mut ~id (add_mut ~id k v m) g
@ -732,4 +731,3 @@ end
assert_bool "check all get after remove"
(Sequence.for_all (fun i -> None = M.get i m) Sequence.(501 -- 1000));
*)

View file

@ -1,4 +1,3 @@
(* This file is free software, part of containers. See file "license" for more details. *)
(** {1 Hash Tries}

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2015, simon cruanes
all rights reserved.
@ -58,7 +57,7 @@ module type S = sig
(** Fast equality test [O(1)] *)
val compare : t -> t -> int
(** Fast (arbitrary) comparisontest [O(1)] *)
(** Fast (arbitrary) comparison test [O(1)] *)
val hash : t -> int
(** Fast (arbitrary, deterministic) hash [O(1)] *)

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2015, simon cruanes
all rights reserved.
@ -62,7 +61,7 @@ module type S = sig
(** Fast equality test [O(1)] *)
val compare : t -> t -> int
(** Fast (arbitrary) comparisontest [O(1)] *)
(** Fast (arbitrary) comparison test [O(1)] *)
val hash : t -> int
(** Fast (arbitrary, deterministic) hash [O(1)] *)
@ -77,7 +76,7 @@ module type S = sig
(** Iterate on elements, in no particular order *)
val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a
(** fold on elements, in arbitrary order *)
(** Fold on elements, in arbitrary order *)
val choose : t -> elt option

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2015, simon cruanes
all rights reserved.

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2015, simon cruanes
all rights reserved.

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.
@ -24,7 +23,7 @@ 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.
*)
(** {1 Hash Table with Heterogeneous Keys} *)
(** {1 Maps with Heterogeneous Values} *)
type 'b injection = {
get : (unit -> unit) -> 'b option;

View file

@ -31,7 +31,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
type 'a injection
(** An accessor for values of type 'a in any map. Values put
in the map using an key can only be retrieved using this
in the map using a key can only be retrieved using this
very same key. *)
val create_inj : unit -> 'a injection

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2015, simon cruanes
all rights reserved.

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2015, simon cruanes
all rights reserved.
@ -73,5 +72,3 @@ val get_exn : key:'a key -> t -> 'a
val cardinal : t -> int
(** Number of mappings *)

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.

View file

@ -29,7 +29,7 @@ From https://github.com/mjambon/mixtbl (thanks to him).
Example:
{[
let inj_int = CCMixtbl.access () ;;
let inj_int = CCMixtbl.create_inj () ;;
let tbl = CCMixtbl.create 10 ;;
@ -39,7 +39,7 @@ CCMixtbl.set inj_int tbl "a" 1;;
OUnit.assert_equal (Some 1) (CCMixtbl.get ~inj:inj_int tbl "a");;
let inj_string = CCMixtbl.access () ;;
let inj_string = CCMixtbl.create_inj () ;;
CCMixtbl.set inj_string tbl "b" "Hello";
@ -60,7 +60,7 @@ type 'a t
type 'b injection
(** An accessor for values of type 'b in any table. Values put
in the table using an key can only be retrieved using this
in the table using a key can only be retrieved using this
very same key. *)
val create : int -> 'a t

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013, simon cruanes
all rights reserved.

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013, simon cruanes
all rights reserved.
@ -127,10 +126,10 @@ module type BIDIR = sig
(** 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 *)

View file

@ -131,7 +131,7 @@ module Make(O : Set.OrderedType) = struct
if n=0 then ms else M.remove x ms
| n' ->
if n' < 0
then invalid_arg "CCMultiSet.udpate"
then invalid_arg "CCMultiSet.update"
else M.add x n' ms
let min ms =
@ -150,12 +150,12 @@ module Make(O : Set.OrderedType) = struct
m1 m2
let meet m1 m2 =
M.merge
(fun _ n1 n2 -> match n1, n2 with
| None, None -> assert false
| Some n, None | None, Some n -> Some n
| Some n1, Some n2 -> Some (Pervasives.max n1 n2))
m1 m2
M.merge
(fun _ n1 n2 -> match n1, n2 with
| None, None -> assert false
| Some n, None | None, Some n -> Some n
| Some n1, Some n2 -> Some (Pervasives.max n1 n2))
m1 m2
let intersection m1 m2 =
M.merge

View file

@ -66,6 +66,7 @@ module type S = sig
(** Minimal element w.r.t the total ordering on elements *)
val max : t -> elt
(** 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]

View file

@ -53,7 +53,7 @@ val init : int -> (int -> 'a) -> 'a t
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].
(** [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].*)
@ -133,4 +133,3 @@ type 'a printer = Format.formatter -> 'a -> unit
val print : 'a printer -> 'a t printer
(** @since 0.13 *)

View file

@ -151,4 +151,3 @@ end
(** {2 Implementation} *)
module Make(H : HashedType) : S with type key = H.t

View file

@ -1,4 +1,3 @@
(* This file is free software, part of containers. See file "license" for more details. *)
(** {1 Random-Access Lists} *)
@ -108,7 +107,7 @@ let front l = match l with
Some (x, Cons (size', t1, Cons (size', t2, l')))
let front_exn l = match l with
| Nil -> invalid_arg "RAL.front"
| Nil -> invalid_arg "RAL.front_exn"
| Cons (_, Leaf x, tl) -> x, tl
| Cons (size, Node (x, t1, t2), l') ->
let size' = size / 2 in
@ -574,4 +573,3 @@ let print ?(sep=", ") pp_item fmt l =
pp_item fmt x
);
()

View file

@ -1,4 +1,3 @@
(* This file is free software, part of containers. See file "license" for more details. *)
(** {1 Random-Access Lists}
@ -185,5 +184,3 @@ include module type of Infix
type 'a printer = Format.formatter -> 'a -> unit
val print : ?sep:string -> 'a printer -> 'a t printer

View file

@ -393,7 +393,7 @@ module MakeFromArray(A:Array.S) = struct
let blit_into b to_buf o len =
if o+len > A.length to_buf
then invalid_arg "RingBuffer.blit_into";
then invalid_arg "CCRingBuffer.blit_into";
if b.stop >= b.start
then
let n = min (b.stop - b.start) len in
@ -529,7 +529,7 @@ module MakeFromArray(A:Array.S) = struct
let skip b len =
if len > length b then
invalid_arg ("CCRingRingBuffer.skip: " ^ string_of_int len);
invalid_arg ("CCRingBuffer.skip: " ^ string_of_int len);
if b.stop >= b.start
then b.start <- b.start + len
else

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.
@ -108,7 +107,7 @@ module type S = sig
(** {6 Ranges} *)
val above : key -> 'a t -> (key * 'a) sequence
(** All bindings whose key is bigger than (or equal to) the given key *)
(** All bindings whose key is bigger or equal to the given key *)
val below : key -> 'a t -> (key * 'a) sequence
(** All bindings whose key is smaller or equal to the given key *)

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.
@ -108,7 +107,7 @@ module type S = sig
(** {6 Ranges} *)
val above : key -> 'a t -> (key * 'a) sequence
(** All bindings whose key is bigger than (or equal to) the given key *)
(** All bindings whose key is bigger or equal to the given key *)
val below : key -> 'a t -> (key * 'a) sequence
(** All bindings whose key is smaller or equal to the given key *)

View file

@ -109,7 +109,7 @@ module type S = sig
val extract_min : 'a t -> key * 'a * 'a t
(** [extract_min m] returns [k, v, m'] where [k,v] is the pair with the
smaller key in [m], and [m'] does not contain [k].
smallest key in [m], and [m'] does not contain [k].
@raise Not_found if the map is empty *)
val extract_max : 'a t -> key * 'a * 'a t

View file

@ -1,4 +1,3 @@
(* This file is free software, part of containers. See file "license" for more details. *)
(** {1 Weight-Balanced Tree}
@ -75,7 +74,7 @@ module type S = sig
val extract_min : 'a t -> key * 'a * 'a t
(** [extract_min m] returns [k, v, m'] where [k,v] is the pair with the
smaller key in [m], and [m'] does not contain [k].
smallest key in [m], and [m'] does not contain [k].
@raise Not_found if the map is empty *)
val extract_max : 'a t -> key * 'a * 'a t

View file

@ -1,5 +1,5 @@
(** {!CCIO} has moved into {!Containers}, the main library.
The reason is that it has no additional dependency and is arguably a
useful completement to parts of {!Pervasives} (the channel management)

View file

@ -1,4 +1,3 @@
(*
copyright (c) 2013-2014, simon cruanes
all rights reserved.
@ -346,4 +345,3 @@ module Dot = struct
let g = make ~name trees in
print_to_file filename g
end

Some files were not shown because too many files have changed in this diff Show more