diff --git a/3.10/containers-data/CCBV/.dummy b/3.10/containers-data/CCBV/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCBV/index.html b/3.10/containers-data/CCBV/index.html new file mode 100644 index 00000000..e2edb5f6 --- /dev/null +++ b/3.10/containers-data/CCBV/index.html @@ -0,0 +1,3 @@ + +CCBV (containers-data.CCBV)

Module CCBV

Imperative Bitvectors.

A bitvector is stored in some form of internal array (on the heap). Is it a bit similar to a more storage-efficient version of bool + CCVector.vector, with additional operations.

BREAKING CHANGES since 1.2: size is now stored along with the bitvector. Some functions have a new signature.

The size of the bitvector used to be rounded up to the multiple of 30 or 62. In other words some functions such as iter would iterate on more bits than what was originally asked for. This is not the case anymore.

type t

A resizable bitvector

val empty : unit -> t

Empty bitvector. Length is 0.

val create : size:int -> bool -> t

Create a bitvector of given size, with given default value. Length of result is size.

val init : int -> ( int -> bool ) -> t

init len f initializes a bitvector of length len, where bit i is true iff f i is.

  • since 3.9
val copy : t -> t

Copy of bitvector.

val cardinal : t -> int

Number of bits set to one, seen as a set of bits.

val length : t -> int

Size of underlying bitvector. This is not related to the underlying implementation. Changed at 1.2

val capacity : t -> int

The number of bits this bitvector can store without resizing.

  • since 1.2
val resize : t -> int -> unit

Resize the BV so that it has the specified length. This can grow the underlying array, but it will not shrink it, to minimize memory traffic.

  • raises Invalid_argument

    on negative sizes.

val resize_minimize_memory : t -> int -> unit

Same as resize, but this can also shrink the underlying array if this reduces the size.

  • raises Invalid_argument

    on negative sizes.

  • since 3.9
val is_empty : t -> bool

Are there any true bits?

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? Return false if the index is too high.

val reset : t -> int -> unit

Set i-th bit to 0, extending the bitvector if needed.

val set_bool : t -> int -> bool -> unit

Set or reset i-th bit.

  • since 3.9
val flip : t -> int -> unit

Flip i-th bit, extending the bitvector if needed.

val clear : t -> unit

Set every bit to 0. Does not change the length.

val clear_and_shrink : t -> unit

Set every bit to 0, and set length to 0.

  • since 3.9
val iter : t -> ( int -> bool -> unit ) -> unit

Iterate on all bits.

val iter_true : t -> ( int -> unit ) -> unit

Iterate on bits set to 1.

val to_list : t -> int list

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.

val of_list : int list -> t

From a list of true bits.

The bits are interpreted as indices into the returned bitvector, so the final bitvector bv will have length bv equal to 1 more than max of list indices.

val first : t -> int option

First set bit, or return None. Changed type at 1.2

val first_exn : t -> int

First set bit, or

  • raises 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. Length is unchanged.

val negate_self : t -> unit

negate_self t flips all of the bits in t. Length is unchanged.

  • since 1.2
val negate : t -> t

negate t returns a copy of t with all of the bits flipped. Length is unchanged.

val union_into : into:t -> t -> unit

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 ~into bv sets into to the intersection of itself and bv. Also updates the length of into to be at most length bv.

After executing:

  • length ~into' = min (length into) (length bv).
  • for all i: get into' ==> get into i /\ get bv i
val union : t -> t -> t

union bv1 bv2 returns the union of the two sets. The length of the result is the max of the inputs' lengths.

val inter : t -> t -> t

inter bv1 bv2 returns the intersection of the two sets. The length of the result is the min of the inputs' lengths.

val diff_into : into:t -> t -> unit

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 returns those bits found in t1 but not in t2.

  • since 1.2
val select : t -> 'a array -> 'a list

select arr bv selects the elements of arr whose index 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.

val selecti : t -> 'a array -> ('a * int) list

Same as select, but selected elements are paired with their indexes.

val equal : t -> t -> bool

Bitwise comparison, including the size (equal a b implies length a=length b).

  • since 3.5
type 'a iter = ( 'a -> unit ) -> unit
val to_iter : t -> int iter

Iterate over the true bits.

val of_iter : int iter -> t

Build from true bits.

val pp : Stdlib.Format.formatter -> t -> unit

Print the bitvector as a string of bits.

  • since 0.13
\ No newline at end of file diff --git a/3.10/containers-data/CCBijection/.dummy b/3.10/containers-data/CCBijection/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCBijection/Make/argument-1-L/index.html b/3.10/containers-data/CCBijection/Make/argument-1-L/index.html new file mode 100644 index 00000000..fba2a2b4 --- /dev/null +++ b/3.10/containers-data/CCBijection/Make/argument-1-L/index.html @@ -0,0 +1,2 @@ + +L (containers-data.CCBijection.Make.1-L)

Parameter Make.1-L

type t
val compare : t -> t -> int
\ No newline at end of file diff --git a/3.10/containers-data/CCBijection/Make/argument-2-R/index.html b/3.10/containers-data/CCBijection/Make/argument-2-R/index.html new file mode 100644 index 00000000..0df51b4c --- /dev/null +++ b/3.10/containers-data/CCBijection/Make/argument-2-R/index.html @@ -0,0 +1,2 @@ + +R (containers-data.CCBijection.Make.2-R)

Parameter Make.2-R

type t
val compare : t -> t -> int
\ No newline at end of file diff --git a/3.10/containers-data/CCBijection/Make/index.html b/3.10/containers-data/CCBijection/Make/index.html new file mode 100644 index 00000000..cc16c71b --- /dev/null +++ b/3.10/containers-data/CCBijection/Make/index.html @@ -0,0 +1,2 @@ + +Make (containers-data.CCBijection.Make)

Module CCBijection.Make

Parameters

module L : OrderedType
module R : OrderedType

Signature

type t
type left = L.t
type right = R.t
val empty : t
val is_empty : t -> bool
val equal : t -> t -> bool
val compare : t -> t -> int
val add : left -> right -> t -> t

Add left and right correspondence to bijection such that left and right are unique in their respective sets and only correspond to each other.

val cardinal : t -> int

Number of bindings. O(n) time.

val mem : left -> right -> t -> bool

Check both sides for key membership.

val mem_left : left -> t -> bool

Check for membership of correspondence using left key.

val mem_right : right -> t -> bool

Check for membership of correspondence using right key.

val find_left : left -> t -> right
  • raises Not_found

    if left is not found.

val find_right : right -> t -> left
  • raises Not_found

    if right is not found.

val remove : left -> right -> t -> t

Remove the left, right binding if it exists. Return the same bijection otherwise.

val remove_left : left -> t -> t

Remove the binding with left key if it exists. Return the same bijection otherwise.

val remove_right : right -> t -> t

Remove the binding with right key if it exists. Return the same bijection otherwise.

val list_left : t -> (left * right) list

Return the bindings as a list of (left, right) values.

val list_right : t -> (right * left) list

Return the bindings as a list of (right, left) values.

val add_iter : (left * right) iter -> t -> t
val of_iter : (left * right) iter -> t
val to_iter : t -> (left * right) iter
val add_list : (left * right) list -> t -> t
val of_list : (left * right) list -> t
val to_list : t -> (left * right) list
\ No newline at end of file diff --git a/3.10/containers-data/CCBijection/index.html b/3.10/containers-data/CCBijection/index.html new file mode 100644 index 00000000..dad5a1e8 --- /dev/null +++ b/3.10/containers-data/CCBijection/index.html @@ -0,0 +1,5 @@ + +CCBijection (containers-data.CCBijection)

Module CCBijection

Functor to build a bijection Represents 1-to-1 mappings between two types. Each element from the "left" is mapped to one "right" value, and conversely.

type 'a iter = ( 'a -> unit ) -> unit
module type OrderedType = sig ... end
module type S = sig ... end
module Make + (L : OrderedType) + (R : OrderedType) : + S with type left = L.t and type right = R.t
\ No newline at end of file diff --git a/3.10/containers-data/CCBijection/module-type-OrderedType/index.html b/3.10/containers-data/CCBijection/module-type-OrderedType/index.html new file mode 100644 index 00000000..8376112f --- /dev/null +++ b/3.10/containers-data/CCBijection/module-type-OrderedType/index.html @@ -0,0 +1,2 @@ + +OrderedType (containers-data.CCBijection.OrderedType)

Module type CCBijection.OrderedType

type t
val compare : t -> t -> int
\ No newline at end of file diff --git a/3.10/containers-data/CCBijection/module-type-S/index.html b/3.10/containers-data/CCBijection/module-type-S/index.html new file mode 100644 index 00000000..e310edc3 --- /dev/null +++ b/3.10/containers-data/CCBijection/module-type-S/index.html @@ -0,0 +1,2 @@ + +S (containers-data.CCBijection.S)

Module type CCBijection.S

type t
type left
type right
val empty : t
val is_empty : t -> bool
val equal : t -> t -> bool
val compare : t -> t -> int
val add : left -> right -> t -> t

Add left and right correspondence to bijection such that left and right are unique in their respective sets and only correspond to each other.

val cardinal : t -> int

Number of bindings. O(n) time.

val mem : left -> right -> t -> bool

Check both sides for key membership.

val mem_left : left -> t -> bool

Check for membership of correspondence using left key.

val mem_right : right -> t -> bool

Check for membership of correspondence using right key.

val find_left : left -> t -> right
  • raises Not_found

    if left is not found.

val find_right : right -> t -> left
  • raises Not_found

    if right is not found.

val remove : left -> right -> t -> t

Remove the left, right binding if it exists. Return the same bijection otherwise.

val remove_left : left -> t -> t

Remove the binding with left key if it exists. Return the same bijection otherwise.

val remove_right : right -> t -> t

Remove the binding with right key if it exists. Return the same bijection otherwise.

val list_left : t -> (left * right) list

Return the bindings as a list of (left, right) values.

val list_right : t -> (right * left) list

Return the bindings as a list of (right, left) values.

val add_iter : (left * right) iter -> t -> t
val of_iter : (left * right) iter -> t
val to_iter : t -> (left * right) iter
val add_list : (left * right) list -> t -> t
val of_list : (left * right) list -> t
val to_list : t -> (left * right) list
\ No newline at end of file diff --git a/3.10/containers-data/CCBitField/.dummy b/3.10/containers-data/CCBitField/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCBitField/Make/argument-1-_/index.html b/3.10/containers-data/CCBitField/Make/argument-1-_/index.html new file mode 100644 index 00000000..81bc9934 --- /dev/null +++ b/3.10/containers-data/CCBitField/Make/argument-1-_/index.html @@ -0,0 +1,2 @@ + +_ (containers-data.CCBitField.Make.1-_)

Parameter Make.1-_

\ No newline at end of file diff --git a/3.10/containers-data/CCBitField/Make/index.html b/3.10/containers-data/CCBitField/Make/index.html new file mode 100644 index 00000000..194ea0ef --- /dev/null +++ b/3.10/containers-data/CCBitField/Make/index.html @@ -0,0 +1,2 @@ + +Make (containers-data.CCBitField.Make)

Module CCBitField.Make

Create a new bitfield type

Parameters

module _ : sig ... end

Signature

type t = private int

Generative type of bitfields. Each instantiation of the functor should create a new, incompatible type

val empty : t

Empty bitfields (all bits 0).

type field
val get : field -> t -> bool

Get the value of this field.

val set : field -> bool -> t -> t

Set the value of this field.

val mk_field : unit -> field

Make a new field.

val freeze : unit -> unit

Prevent new fields from being added. From now on, creating a field will raise Frozen.

val total_width : unit -> int

Current width of the bitfield.

\ No newline at end of file diff --git a/3.10/containers-data/CCBitField/index.html b/3.10/containers-data/CCBitField/index.html new file mode 100644 index 00000000..40e56596 --- /dev/null +++ b/3.10/containers-data/CCBitField/index.html @@ -0,0 +1,12 @@ + +CCBitField (containers-data.CCBitField)

Module CCBitField

Efficient Bit Field for up to 31 or 61 fiels

This module defines efficient bitfields up to 31 or 61 bits (depending on the architecture) in a relatively type-safe way.

module B = CCBitField.Make(struct end);;
+
+let x = B.mk_field ()
+let y = B.mk_field ()
+let z = B.mk_field ()
+
+let f = B.empty |> B.set x true |> B.set y true;;
+
+assert (not (B.get z f)) ;;
+
+assert (f |> B.set z true |> B.get z);;
exception TooManyFields

Raised when too many fields are packed into one bitfield.

exception Frozen

Raised when a frozen bitfield is modified.

val max_width : int

System-dependent maximum width for a bitfield, typically 30 or 62.

module type S = sig ... end
module Make (_ : sig ... end) : S

Create a new bitfield type

\ No newline at end of file diff --git a/3.10/containers-data/CCBitField/module-type-S/index.html b/3.10/containers-data/CCBitField/module-type-S/index.html new file mode 100644 index 00000000..97f28302 --- /dev/null +++ b/3.10/containers-data/CCBitField/module-type-S/index.html @@ -0,0 +1,2 @@ + +S (containers-data.CCBitField.S)

Module type CCBitField.S

Bitfield Signature

type t = private int

Generative type of bitfields. Each instantiation of the functor should create a new, incompatible type

val empty : t

Empty bitfields (all bits 0).

type field
val get : field -> t -> bool

Get the value of this field.

val set : field -> bool -> t -> t

Set the value of this field.

val mk_field : unit -> field

Make a new field.

val freeze : unit -> unit

Prevent new fields from being added. From now on, creating a field will raise Frozen.

val total_width : unit -> int

Current width of the bitfield.

\ No newline at end of file diff --git a/3.10/containers-data/CCCache/.dummy b/3.10/containers-data/CCCache/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCCache/index.html b/3.10/containers-data/CCCache/index.html new file mode 100644 index 00000000..ef966acf --- /dev/null +++ b/3.10/containers-data/CCCache/index.html @@ -0,0 +1,25 @@ + +CCCache (containers-data.CCCache)

Module CCCache

Caches Utils

Particularly useful for memoization. See with_cache and with_cache_rec for more details.

type 'a equal = 'a -> 'a -> bool
type 'a hash = 'a -> int

Value interface

Typical use case: one wants to memoize a function f : 'a -> 'b. Code sample:

let f x =
+  print_endline "call f";
+  x + 1;;
+
+let f' = with_cache (lru 256) f;;
+f' 0;;  (* prints *)
+f' 1;;  (* prints *)
+f' 0;;  (* doesn't print, returns cached value *)
type ('a, 'b) t
val clear : ( _, _ ) t -> unit

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 or not. Should never raise.

  • parameter in_cache

    is true if the value was in cache, false if the value was just produced.

  • since 1.3
val with_cache : + ?cb:( 'a, 'b ) callback -> + ( 'a, 'b ) t -> + ( 'a -> 'b ) -> + 'a -> + 'b

with_cache c f behaves like f, but caches calls to f in the 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.

  • parameter 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 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. Example (memoized Fibonacci function):

let fib = with_cache_rec (lru 256)
+    (fun fib' n -> match n with
+       | 1 | 2 -> 1
+       | _ -> fib' (n-1) + fib' (n-2)
+    );;
+
+fib 70;;
  • parameter cb

    called after the value is generated or retrieved.

val size : ( _, _ ) t -> int

Size of the cache (number of entries). At most linear in the number of entries.

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. Return 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.

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.

  • parameter eq

    optional equality predicate for keys.

val replacing : eq:'a equal -> ?hash:'a hash -> int -> ( 'a, 'b ) t

Replacing cache of the given size. Equality and hash functions can be parametrized. It's a hash table that handles collisions by replacing the old value with the new (so a cache entry is evicted when another entry with the same hash (modulo size) is added). Never grows wider than the given size.

val lru : eq:'a equal -> ?hash:'a hash -> int -> ( 'a, 'b ) t

LRU cache of the given size ("Least Recently Used": keys that have not been used recently are deleted first). Never grows wider than the given size.

val unbounded : eq:'a equal -> ?hash:'a hash -> int -> ( 'a, 'b ) t

Unbounded cache, backed by a Hash table. Will grow forever unless clear is called manually.

\ No newline at end of file diff --git a/3.10/containers-data/CCDeque/.dummy b/3.10/containers-data/CCDeque/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCDeque/index.html b/3.10/containers-data/CCDeque/index.html new file mode 100644 index 00000000..ec31a56a --- /dev/null +++ b/3.10/containers-data/CCDeque/index.html @@ -0,0 +1,2 @@ + +CCDeque (containers-data.CCDeque)

Module CCDeque

Imperative deque

This structure provides fast access to its front and back elements, with O(1) operations.

type 'a t

Contains 'a elements, queue in both ways

exception Empty
val create : unit -> 'a t

New deque.

val clear : _ t -> unit

Remove all elements.

  • since 0.13
val is_empty : 'a t -> bool

Is the deque empty?

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.

  • parameter 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.

  • parameter cmp

    comparison function for elements.

  • since 0.13
val length : 'a t -> int

Number of elements. Used to be linear time, now constant time.

val push_front : 'a t -> 'a -> unit

Push value at the front.

val push_back : 'a t -> 'a -> unit

Push value at the back.

val peek_front : 'a t -> 'a

First value.

  • raises Empty

    if empty.

val peek_front_opt : 'a t -> 'a option

First value.

  • since 2.7
val peek_back : 'a t -> 'a

Last value.

  • raises Empty

    if empty.

val peek_back_opt : 'a t -> 'a option

Last value.

  • since 2.7
val remove_back : 'a t -> unit

Remove last value. If the deque is empty do nothing

  • since 2.7
val remove_front : 'a t -> unit

Remove first value. If the deque is empty do nothing

  • since 2.7
val take_back : 'a t -> 'a

Take last value.

  • raises Empty

    if empty.

val take_back_opt : 'a t -> 'a option

Take last value.

  • since 2.7
val take_front : 'a t -> 'a

Take first value.

  • raises Empty

    if empty.

val take_front_opt : 'a t -> 'a option

Take first value.

  • since 2.7
val update_back : 'a t -> ( 'a -> 'a option ) -> unit

Update last value. If the deque is empty do nothing. If the function returns None, remove last element; if it returns Some x, replace last element with x.

  • since 2.7
val update_front : 'a t -> ( 'a -> 'a option ) -> unit

Update first value. If the deque is empty do nothing. Similar to update_back but for the first value.

  • since 2.7
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.

  • 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.

  • since 0.13
val iter : ( 'a -> unit ) -> 'a t -> unit

Iterate on elements.

val fold : ( 'b -> 'a -> 'b ) -> 'b -> 'a t -> 'b

Fold on elements.

  • since 0.13

Conversions

type 'a gen = unit -> 'a option
type 'a iter = ( 'a -> unit ) -> unit
val of_iter : 'a iter -> 'a t

Create a deque from the sequence. Optional argument deque disappears, use add_iter_back instead.

  • since 0.13
val to_iter : 'a t -> 'a iter

Iterate on the elements.

val of_gen : 'a gen -> 'a t

of_gen g makes a deque containing the elements of g.

  • since 0.13
val to_gen : 'a t -> 'a gen

Iterate on the elements of the deque.

  • since 0.13
val add_iter_front : 'a t -> 'a iter -> unit

add_iter_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.

  • since 0.13
val add_iter_back : 'a t -> 'a iter -> unit

add_iter_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.

  • since 0.13
val copy : 'a t -> 'a t

Fresh copy, O(n) in time.

val of_list : 'a list -> 'a t

Conversion from list, in order.

  • since 0.13
val to_list : 'a t -> 'a list

List of elements, in order. Less efficient than to_rev_list.

  • since 0.13
val to_rev_list : 'a t -> 'a list

Efficient conversion to list, in reverse order.

  • since 0.13
val filter : ( 'a -> bool ) -> 'a t -> 'a t

Filter into a new copy.

  • since 2.7
val filter_map : ( 'a -> 'b option ) -> 'a t -> 'b t

Filter map into a new copy

  • since 2.7
val filter_in_place : 'a t -> ( 'a -> bool ) -> unit

Keep only elements that satisfy the predicate.

  • since 2.7

print

type 'a printer = Stdlib.Format.formatter -> 'a -> unit
val pp : 'a printer -> 'a t printer

Print the elements.

  • since 0.13
\ No newline at end of file diff --git a/3.10/containers-data/CCFQueue/.dummy b/3.10/containers-data/CCFQueue/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCFQueue/index.html b/3.10/containers-data/CCFQueue/index.html new file mode 100644 index 00000000..071bb5f3 --- /dev/null +++ b/3.10/containers-data/CCFQueue/index.html @@ -0,0 +1,2 @@ + +CCFQueue (containers-data.CCFQueue)

Module CCFQueue

Functional queues

type 'a iter = ( 'a -> unit ) -> unit
type 'a equal = 'a -> 'a -> bool
type 'a printer = Stdlib.Format.formatter -> 'a -> unit

Basics

type +'a t

Queue containing elements of type 'a

val empty : 'a t
val is_empty : 'a t -> bool
val singleton : 'a -> 'a t
val doubleton : 'a -> 'a -> 'a t
exception Empty
val cons : 'a -> 'a t -> 'a t

Push element at the front of the queue.

val snoc : 'a t -> 'a -> 'a t

Push element at the end of the queue.

val take_front : 'a t -> ('a * 'a t) option

Get and remove the first element.

val take_front_exn : 'a t -> 'a * 'a t

Same as take_front, but fails on empty queues.

  • raises 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.

  • raises 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.

val take_back_exn : 'a t -> 'a t * 'a

Same as take_back, but fails on empty queues.

  • raises 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].

  • raises Invalid_argument

    if n<0.

val take_back_while : ( 'a -> bool ) -> 'a t -> 'a t * 'a list

Individual extraction

val first : 'a t -> 'a option

First element of the queue.

val last : 'a t -> 'a option

Last element of the queue.

val first_exn : 'a t -> 'a

Same as first but

  • raises 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.

val nth_exn : int -> 'a t -> 'a

Unsafe version of nth.

  • raises Not_found

    if the index is wrong.

val tail : 'a t -> 'a t

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.

Global Operations

val append : 'a t -> 'a t -> 'a t

Append two queues. Elements from the second one come after elements of the first one. Linear in the size of the second queue.

val rev : 'a t -> 'a t

Reverse the queue, O(n) complexity.

  • since 0.10
val map : ( 'a -> 'b ) -> 'a t -> 'b t

Map values.

val (>|=) : 'a t -> ( 'a -> 'b ) -> 'b t

Synonym to map.

val size : 'a t -> int

Number of elements in the queue (constant time).

val fold : ( 'b -> 'a -> 'b ) -> 'b -> 'a t -> 'b
val iter : ( 'a -> unit ) -> 'a t -> unit
val equal : 'a equal -> 'a t equal

Conversions

val of_list : 'a list -> 'a t
val to_list : 'a t -> 'a list
val add_iter_front : 'a iter -> 'a t -> 'a t
  • since 3.0
val add_iter_back : 'a t -> 'a iter -> 'a t
  • since 3.0
val to_iter : 'a t -> 'a iter
  • since 3.0
val of_iter : 'a iter -> 'a t
  • since 3.0
val add_seq_front : 'a Stdlib.Seq.t -> 'a t -> 'a t
  • since 3.0
val add_seq_back : 'a t -> 'a Stdlib.Seq.t -> 'a t
  • since 3.0
val to_seq : 'a t -> 'a Stdlib.Seq.t
  • since 3.0
val of_seq : 'a Stdlib.Seq.t -> 'a t
  • since 3.0
val (--) : int -> int -> int t

a -- b is the integer range from a to b, both included.

  • since 0.10
val (--^) : int -> int -> int t

a -- b is the integer range from a to b, where b is excluded.

  • since 0.17
val pp : 'a printer -> 'a t printer
  • since 0.13
\ No newline at end of file diff --git a/3.10/containers-data/CCFun_vec/.dummy b/3.10/containers-data/CCFun_vec/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCFun_vec/index.html b/3.10/containers-data/CCFun_vec/index.html new file mode 100644 index 00000000..3a80b298 --- /dev/null +++ b/3.10/containers-data/CCFun_vec/index.html @@ -0,0 +1,2 @@ + +CCFun_vec (containers-data.CCFun_vec)

Module CCFun_vec

Functional Vectors

Tree with a large branching factor for logarithmic operations with a low multiplicative factor.

status: experimental. DO NOT USE (yet)

type 'a iter = ( 'a -> unit ) -> unit
type 'a gen = unit -> 'a option
type 'a printer = Stdlib.Format.formatter -> 'a -> unit
type 'a ktree = unit -> [ `Nil | `Node of 'a * 'a ktree list ]

Signature

type 'a t
val empty : 'a t
val is_empty : _ t -> bool
val return : 'a -> 'a t
val length : _ t -> int
val push : 'a -> 'a t -> 'a t

Add element at the end.

val get : int -> 'a t -> 'a option
val get_exn : int -> 'a t -> 'a
  • raises Not_found

    if key not present.

val pop_exn : 'a t -> 'a * 'a t

Pop last element.

val pop : 'a t -> ('a * 'a t) option

Pop last element.

  • since 2.5
val iter : f:( 'a -> unit ) -> 'a t -> unit
val iteri : f:( int -> 'a -> unit ) -> 'a t -> unit

Iterate on elements with their index, in increasing order.

val iteri_rev : f:( int -> 'a -> unit ) -> 'a t -> unit

Iterate on elements with their index, but starting from the end.

val fold : f:( 'b -> 'a -> 'b ) -> x:'b -> 'a t -> 'b
val foldi : f:( 'b -> int -> 'a -> 'b ) -> x:'b -> 'a t -> 'b
val append : 'a t -> 'a t -> 'a t
val map : ( 'a -> 'b ) -> 'a t -> 'b t
val choose : 'a t -> 'a option
Conversions
val to_list : 'a t -> 'a list
val of_list : 'a list -> 'a t
val add_list : 'a t -> 'a list -> 'a t
val add_iter : 'a t -> 'a iter -> 'a t
val of_iter : 'a iter -> 'a t
val to_iter : 'a t -> 'a iter
val add_gen : 'a t -> 'a gen -> 'a t
val of_gen : 'a gen -> 'a t
val to_gen : 'a t -> 'a gen
IO
val pp : 'a printer -> 'a t printer
\ No newline at end of file diff --git a/3.10/containers-data/CCGraph/.dummy b/3.10/containers-data/CCGraph/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCGraph/Dot/index.html b/3.10/containers-data/CCGraph/Dot/index.html new file mode 100644 index 00000000..cc68f40d --- /dev/null +++ b/3.10/containers-data/CCGraph/Dot/index.html @@ -0,0 +1,20 @@ + +Dot (containers-data.CCGraph.Dot)

Module CCGraph.Dot

type attribute = [
| `Color of string
| `Shape of string
| `Weight of int
| `Style of string
| `Label of string
| `Other of string * string
]

Dot attribute

type vertex_state

Hidden state associated to a vertex

val pp : + tbl:( 'v, vertex_state ) table -> + eq:( 'v -> 'v -> bool ) -> + ?attrs_v:( 'v -> attribute list ) -> + ?attrs_e:( 'e -> attribute list ) -> + ?name:string -> + graph:( 'v, 'e ) t -> + Stdlib.Format.formatter -> + 'v -> + unit

Print the graph, starting from given vertex, on the formatter.

  • parameter attrs_v

    attributes for vertices.

  • parameter attrs_e

    attributes for edges.

  • parameter name

    name of the graph.

val pp_all : + tbl:( 'v, vertex_state ) table -> + eq:( 'v -> 'v -> bool ) -> + ?attrs_v:( 'v -> attribute list ) -> + ?attrs_e:( 'e -> attribute list ) -> + ?name:string -> + graph:( 'v, 'e ) t -> + Stdlib.Format.formatter -> + 'v iter -> + unit

Same as pp but starting from several vertices, not just one.

  • since 2.8
val with_out : string -> ( Stdlib.Format.formatter -> 'a ) -> 'a

Shortcut to open a file and write to it.

\ No newline at end of file diff --git a/3.10/containers-data/CCGraph/Iter/index.html b/3.10/containers-data/CCGraph/Iter/index.html new file mode 100644 index 00000000..4efa9468 --- /dev/null +++ b/3.10/containers-data/CCGraph/Iter/index.html @@ -0,0 +1,2 @@ + +Iter (containers-data.CCGraph.Iter)

Module CCGraph.Iter

type 'a t = 'a iter
val return : 'a -> 'a t
val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t
val map : ( 'a -> 'b ) -> 'a t -> 'b t
val filter_map : ( 'a -> 'b option ) -> 'a t -> 'b t
val iter : ( 'a -> unit ) -> 'a t -> unit
val fold : ( 'b -> 'a -> 'b ) -> 'b -> 'a t -> 'b
val to_list : 'a t -> 'a list
\ No newline at end of file diff --git a/3.10/containers-data/CCGraph/Lazy_tree/index.html b/3.10/containers-data/CCGraph/Lazy_tree/index.html new file mode 100644 index 00000000..480f2342 --- /dev/null +++ b/3.10/containers-data/CCGraph/Lazy_tree/index.html @@ -0,0 +1,2 @@ + +Lazy_tree (containers-data.CCGraph.Lazy_tree)

Module CCGraph.Lazy_tree

type ('v, 'e) t = {
vertex : 'v;
children : ('e * ( 'v, 'e ) t) list Stdlib.Lazy.t;
}
val map_v : ( 'a -> 'b ) -> ( 'a, 'e ) t -> ( 'b, 'e ) t
val fold_v : ( 'acc -> 'v -> 'acc ) -> 'acc -> ( 'v, _ ) t -> 'acc
\ No newline at end of file diff --git a/3.10/containers-data/CCGraph/Map/index.html b/3.10/containers-data/CCGraph/Map/index.html new file mode 100644 index 00000000..ff975bb0 --- /dev/null +++ b/3.10/containers-data/CCGraph/Map/index.html @@ -0,0 +1,2 @@ + +Map (containers-data.CCGraph.Map)

Module CCGraph.Map

Parameters

module O : Stdlib.Map.OrderedType

Signature

type vertex = O.t
type 'a t
val as_graph : 'a t -> ( vertex, 'a ) graph

Graph view of the map.

val empty : 'a t
val add_edge : vertex -> 'a -> vertex -> 'a t -> 'a t
val remove_edge : vertex -> vertex -> 'a t -> 'a t
val add : vertex -> 'a t -> 'a t

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 NOT removed, they must be manually removed with remove_edge.

val union : 'a t -> 'a t -> 'a t
val vertices : _ t -> vertex iter
val vertices_l : _ t -> vertex list
val of_list : (vertex * 'a * vertex) list -> 'a t
val add_list : (vertex * 'a * vertex) list -> 'a t -> 'a t
val to_list : 'a t -> (vertex * 'a * vertex) list
val of_iter : (vertex * 'a * vertex) iter -> 'a t
  • since 2.8
val add_iter : (vertex * 'a * vertex) iter -> 'a t -> 'a t
  • since 2.8
val to_iter : 'a t -> (vertex * 'a * vertex) iter
  • since 2.8
\ No newline at end of file diff --git a/3.10/containers-data/CCGraph/Traverse/Event/index.html b/3.10/containers-data/CCGraph/Traverse/Event/index.html new file mode 100644 index 00000000..bf90b6d5 --- /dev/null +++ b/3.10/containers-data/CCGraph/Traverse/Event/index.html @@ -0,0 +1,12 @@ + +Event (containers-data.CCGraph.Traverse.Event)

Module Traverse.Event

More detailed interface

type edge_kind = [
| `Forward
| `Back
| `Cross
]
type ('v, 'e) t = [
| `Enter of 'v * int * ( 'v, 'e ) path
| `Exit of 'v
| `Edge of 'v * 'e * 'v * edge_kind
]

A traversal is a sequence of such events

val get_vertex : ( 'v, 'e ) t -> ('v * [ `Enter | `Exit ]) option
val get_enter : ( 'v, 'e ) t -> 'v option
val get_exit : ( 'v, 'e ) t -> 'v option
val get_edge : ( 'v, 'e ) t -> ('v * 'e * 'v) option
val get_edge_kind : ( 'v, 'e ) t -> ('v * 'e * 'v * edge_kind) option
val dfs : + tbl:'v set -> + eq:( 'v -> 'v -> bool ) -> + graph:( 'v, 'e ) graph -> + 'v iter -> + ( 'v, 'e ) t iter_once

Full version of DFS.

  • parameter eq

    equality predicate on vertices.

val dfs_tag : + eq:( 'v -> 'v -> bool ) -> + tags:'v tag_set -> + graph:( 'v, 'e ) graph -> + 'v iter -> + ( 'v, 'e ) t iter_once

Full version of DFS using integer tags.

  • parameter eq

    equality predicate on vertices.

\ No newline at end of file diff --git a/3.10/containers-data/CCGraph/Traverse/index.html b/3.10/containers-data/CCGraph/Traverse/index.html new file mode 100644 index 00000000..8d7ffc04 --- /dev/null +++ b/3.10/containers-data/CCGraph/Traverse/index.html @@ -0,0 +1,22 @@ + +Traverse (containers-data.CCGraph.Traverse)

Module CCGraph.Traverse

type ('v, 'e) path = ('v * 'e * 'v) list
val generic : + tbl:'v set -> + bag:'v bag -> + graph:( 'v, 'e ) t -> + 'v iter -> + 'v iter_once

Traversal of the given graph, starting from a sequence of vertices, using the given bag to choose the next vertex to explore. Each vertex is visited at most once.

val generic_tag : + tags:'v tag_set -> + bag:'v bag -> + graph:( 'v, 'e ) t -> + 'v iter -> + 'v iter_once

One-shot traversal of the graph using a tag set and the given bag.

val dfs : tbl:'v set -> graph:( 'v, 'e ) t -> 'v iter -> 'v iter_once
val dfs_tag : tags:'v tag_set -> graph:( 'v, 'e ) t -> 'v iter -> 'v iter_once
val bfs : tbl:'v set -> graph:( 'v, 'e ) t -> 'v iter -> 'v iter_once
val bfs_tag : tags:'v tag_set -> graph:( 'v, 'e ) t -> 'v iter -> 'v iter_once
val dijkstra : + tbl:'v set -> + ?dist:( 'e -> int ) -> + graph:( 'v, 'e ) t -> + 'v iter -> + ('v * int * ( 'v, 'e ) path) iter_once

Dijkstra algorithm, traverses a graph in increasing distance order. 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).

  • parameter dist

    distance from origin of the edge to destination, must be strictly positive. Default is 1 for every edge.

val dijkstra_tag : + ?dist:( 'e -> int ) -> + tags:'v tag_set -> + graph:( 'v, 'e ) t -> + 'v iter -> + ('v * int * ( 'v, 'e ) path) iter_once
module Event : sig ... end
\ No newline at end of file diff --git a/3.10/containers-data/CCGraph/index.html b/3.10/containers-data/CCGraph/index.html new file mode 100644 index 00000000..2cef21af --- /dev/null +++ b/3.10/containers-data/CCGraph/index.html @@ -0,0 +1,44 @@ + +CCGraph (containers-data.CCGraph)

Module CCGraph

Simple Graph Interface

A collections of algorithms on (mostly read-only) graph structures. The user provides her own graph structure as a ('v, 'e) CCGraph.t, where 'v is the type of vertices and 'e the type of edges (for instance, 'e = ('v * 'v) is perfectly fine in many cases).

Such a ('v, 'e) CCGraph.t structure is a record containing three functions: two relate edges to their origin and destination, and one maps vertices to their outgoing edges. This abstract notion of graph makes it possible to run the algorithms on any user-specific type that happens to have a graph structure.

Many graph algorithms here take an iterator of vertices as input. The helper module Iter contains basic functions for that, as does the iter library on opam. If the user only has a single vertex (e.g., for a topological sort from a given vertex), they can use Iter.return x to build a iter of one element.

status: unstable

Iter Helpers

type 'a iter = ( 'a -> unit ) -> unit

A sequence of items of type 'a, possibly infinite

  • since 2.8
type 'a iter_once = 'a iter

Iter that should be used only once

  • since 2.8
exception Iter_once

Raised when a sequence meant to be used once is used several times.

module Iter : sig ... end

Interfaces for graphs

This interface is designed for oriented graphs with labels on edges

type ('v, 'e) t = 'v -> ('e * 'v) iter

Directed graph with vertices of type 'v and edges labeled with e'

type ('v, 'e) graph = ( 'v, 'e ) t
val make : ( 'v -> ('e * 'v) iter ) -> ( 'v, 'e ) t

Make a graph by providing the children function.

type 'v tag_set = {
get_tag : 'v -> bool;
set_tag : 'v -> unit;(*

Set tag for the given element

*)
}

Tags

Mutable tags from values of type 'v to tags of type bool

type ('k, 'a) table = {
mem : 'k -> bool;
find : 'k -> 'a;(*
  • raises Not_found

    if element not added before

*)
add : 'k -> 'a -> unit;(*

Erases previous binding

*)
}

Table

Mutable table with keys 'k and values 'a

type 'a set = ( 'a, unit ) table

Mutable set

val mk_table : + eq:( 'k -> 'k -> bool ) -> + ?hash:( 'k -> int ) -> + int -> + ( 'k, 'a ) table

Default implementation for Table: a Hashtbl.t.

val mk_map : cmp:( 'k -> 'k -> int ) -> unit -> ( 'k, 'a ) table

Use a Map.S underneath.

Bags of vertices

type 'a bag = {
push : 'a -> unit;
is_empty : unit -> bool;
pop : unit -> 'a;(*

raises some exception is empty

*)
}

Bag of elements of type 'a

val mk_queue : unit -> 'a bag
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.

Traversals

module Traverse : sig ... end

Cycles

val is_dag : + tbl:'v set -> + eq:( 'v -> 'v -> bool ) -> + graph:( 'v, _ ) t -> + 'v iter -> + bool

is_dag ~graph vs returns true if the subset of graph reachable from vs is acyclic.

  • since 0.18

Topological Sort

exception Has_cycle
val topo_sort : + eq:( 'v -> 'v -> bool ) -> + ?rev:bool -> + tbl:'v set -> + graph:( 'v, 'e ) t -> + 'v iter -> + 'v list

topo_sort ~graph seq returns a list of vertices l where each 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 wikipedia.

  • parameter eq

    equality predicate on vertices (default (=)).

  • parameter rev

    if true, the dependency relation is inverted (v -> v' means v' occurs before v).

  • raises Has_cycle

    if the graph is not a DAG.

val topo_sort_tag : + eq:( 'v -> 'v -> bool ) -> + ?rev:bool -> + tags:'v tag_set -> + graph:( 'v, 'e ) t -> + 'v iter -> + 'v list

Same as topo_sort but uses an explicit tag set.

  • raises Has_cycle

    if the graph is not a DAG.

Lazy Spanning Tree

module Lazy_tree : sig ... end
val spanning_tree : + tbl:'v set -> + graph:( 'v, 'e ) t -> + '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.

val spanning_tree_tag : + tags:'v tag_set -> + graph:( 'v, 'e ) t -> + 'v -> + ( 'v, 'e ) Lazy_tree.t

Strongly Connected Components

type 'v scc_state

Hidden state for scc.

val scc : + tbl:( 'v, 'v scc_state ) table -> + graph:( 'v, 'e ) t -> + 'v iter -> + 'v list iter_once

Strongly connected components reachable from the given vertices. Each component is a list of vertices that are all mutually reachable 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 Tarjan's algorithm.

  • parameter tbl

    table used to map nodes to some hidden state.

  • raises Iter_once

    if the result is iterated on more than once.

Pretty printing in the DOT (graphviz) format

Example (print divisors from 42):

let open CCGraph in
+let open Dot in
+with_out "/tmp/truc.dot"
+  (fun out ->
+     pp ~attrs_v:(fun i -> [`Label (string_of_int i)]) ~graph:divisors_graph out 42
+  )
module Dot : sig ... end

Mutable Graph

type ('v, 'e) mut_graph = {
graph : ( 'v, 'e ) t;
add_edge : 'v -> 'e -> 'v -> unit;
remove : 'v -> unit;
}
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.

Immutable Graph

A classic implementation of a graph structure on totally ordered vertices, with unlabelled edges. The graph allows to add and remove edges and vertices, and to iterate on edges and vertices.

module type MAP = sig ... end
module Map (O : Stdlib.Map.OrderedType) : MAP with type vertex = O.t

Misc

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.

  • parameter eq

    equality used to compare vertices.

val of_hashtbl : ( 'v, 'v list ) Stdlib.Hashtbl.t -> ( 'v, unit ) t

of_hashtbl tbl makes a graph from a hashtable that maps vertices 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.

\ No newline at end of file diff --git a/3.10/containers-data/CCGraph/module-type-MAP/index.html b/3.10/containers-data/CCGraph/module-type-MAP/index.html new file mode 100644 index 00000000..0cd468e9 --- /dev/null +++ b/3.10/containers-data/CCGraph/module-type-MAP/index.html @@ -0,0 +1,2 @@ + +MAP (containers-data.CCGraph.MAP)

Module type CCGraph.MAP

type vertex
type 'a t
val as_graph : 'a t -> ( vertex, 'a ) graph

Graph view of the map.

val empty : 'a t
val add_edge : vertex -> 'a -> vertex -> 'a t -> 'a t
val remove_edge : vertex -> vertex -> 'a t -> 'a t
val add : vertex -> 'a t -> 'a t

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 NOT removed, they must be manually removed with remove_edge.

val union : 'a t -> 'a t -> 'a t
val vertices : _ t -> vertex iter
val vertices_l : _ t -> vertex list
val of_list : (vertex * 'a * vertex) list -> 'a t
val add_list : (vertex * 'a * vertex) list -> 'a t -> 'a t
val to_list : 'a t -> (vertex * 'a * vertex) list
val of_iter : (vertex * 'a * vertex) iter -> 'a t
  • since 2.8
val add_iter : (vertex * 'a * vertex) iter -> 'a t -> 'a t
  • since 2.8
val to_iter : 'a t -> (vertex * 'a * vertex) iter
  • since 2.8
\ No newline at end of file diff --git a/3.10/containers-data/CCHashSet/.dummy b/3.10/containers-data/CCHashSet/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCHashSet/Make/argument-1-E/index.html b/3.10/containers-data/CCHashSet/Make/argument-1-E/index.html new file mode 100644 index 00000000..2d01f30a --- /dev/null +++ b/3.10/containers-data/CCHashSet/Make/argument-1-E/index.html @@ -0,0 +1,2 @@ + +E (containers-data.CCHashSet.Make.1-E)

Parameter Make.1-E

type t
val equal : t -> t -> bool
val hash : t -> int

Positive value

\ No newline at end of file diff --git a/3.10/containers-data/CCHashSet/Make/index.html b/3.10/containers-data/CCHashSet/Make/index.html new file mode 100644 index 00000000..6953207a --- /dev/null +++ b/3.10/containers-data/CCHashSet/Make/index.html @@ -0,0 +1,2 @@ + +Make (containers-data.CCHashSet.Make)

Module CCHashSet.Make

Parameters

module E : ELEMENT

Signature

type t
type elt = E.t
val create : int -> t

create n makes a new set with the given capacity n.

val singleton : elt -> t

singleton x is the singleton {x}.

val clear : t -> unit

clear s removes all elements from s.

val copy : t -> t

Fresh copy.

val copy_into : into:t -> t -> unit

copy_into ~into s copies all elements of s into into.

val insert : t -> elt -> unit

insert s x adds x into s.

val remove : t -> elt -> unit

Remove the element, if it were in there.

val cardinal : t -> int

cardinal s returns the number of elements in s.

val mem : t -> elt -> bool

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.

  • raises Not_found

    if x not in s.

val find : t -> elt -> elt option

Safe version of find_exn.

val inter : t -> t -> t

inter a b returns a ∩ b.

val inter_mut : into:t -> t -> unit

inter_mut ~into a changes into into a ∩ into.

val union : t -> t -> t

union a b returns a ∪ b.

val union_mut : into:t -> t -> unit

union_mut ~into a changes into into a ∪ into.

val diff : t -> t -> t

diff a b returns a - b.

val subset : t -> t -> bool

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).

val for_all : ( elt -> bool ) -> t -> bool
val exists : ( elt -> bool ) -> t -> bool
val iter : ( elt -> unit ) -> t -> unit

Iterate on values.

val fold : ( 'a -> elt -> 'a ) -> 'a -> t -> 'a

Fold on values.

val elements : t -> elt list

List of elements.

val of_list : elt list -> t
val to_iter : t -> elt iter
val of_iter : elt iter -> t
val add_iter : t -> elt iter -> unit
val pp : ?pp_sep:unit printer -> elt printer -> t printer

pp pp_elt returns a set printer, given a printer for individual elements.

\ No newline at end of file diff --git a/3.10/containers-data/CCHashSet/index.html b/3.10/containers-data/CCHashSet/index.html new file mode 100644 index 00000000..6580eb59 --- /dev/null +++ b/3.10/containers-data/CCHashSet/index.html @@ -0,0 +1,2 @@ + +CCHashSet (containers-data.CCHashSet)

Module CCHashSet

Mutable Set

status: unstable

type 'a iter = ( 'a -> unit ) -> unit
type 'a printer = Stdlib.Format.formatter -> 'a -> unit
module type S = sig ... end
module type ELEMENT = sig ... end
module Make (E : ELEMENT) : S with type elt = E.t
\ No newline at end of file diff --git a/3.10/containers-data/CCHashSet/module-type-ELEMENT/index.html b/3.10/containers-data/CCHashSet/module-type-ELEMENT/index.html new file mode 100644 index 00000000..759934dd --- /dev/null +++ b/3.10/containers-data/CCHashSet/module-type-ELEMENT/index.html @@ -0,0 +1,2 @@ + +ELEMENT (containers-data.CCHashSet.ELEMENT)

Module type CCHashSet.ELEMENT

type t
val equal : t -> t -> bool
val hash : t -> int

Positive value

\ No newline at end of file diff --git a/3.10/containers-data/CCHashSet/module-type-S/index.html b/3.10/containers-data/CCHashSet/module-type-S/index.html new file mode 100644 index 00000000..5c2228cb --- /dev/null +++ b/3.10/containers-data/CCHashSet/module-type-S/index.html @@ -0,0 +1,2 @@ + +S (containers-data.CCHashSet.S)

Module type CCHashSet.S

type t
type elt
val create : int -> t

create n makes a new set with the given capacity n.

val singleton : elt -> t

singleton x is the singleton {x}.

val clear : t -> unit

clear s removes all elements from s.

val copy : t -> t

Fresh copy.

val copy_into : into:t -> t -> unit

copy_into ~into s copies all elements of s into into.

val insert : t -> elt -> unit

insert s x adds x into s.

val remove : t -> elt -> unit

Remove the element, if it were in there.

val cardinal : t -> int

cardinal s returns the number of elements in s.

val mem : t -> elt -> bool

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.

  • raises Not_found

    if x not in s.

val find : t -> elt -> elt option

Safe version of find_exn.

val inter : t -> t -> t

inter a b returns a ∩ b.

val inter_mut : into:t -> t -> unit

inter_mut ~into a changes into into a ∩ into.

val union : t -> t -> t

union a b returns a ∪ b.

val union_mut : into:t -> t -> unit

union_mut ~into a changes into into a ∪ into.

val diff : t -> t -> t

diff a b returns a - b.

val subset : t -> t -> bool

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).

val for_all : ( elt -> bool ) -> t -> bool
val exists : ( elt -> bool ) -> t -> bool
val iter : ( elt -> unit ) -> t -> unit

Iterate on values.

val fold : ( 'a -> elt -> 'a ) -> 'a -> t -> 'a

Fold on values.

val elements : t -> elt list

List of elements.

val of_list : elt list -> t
val to_iter : t -> elt iter
val of_iter : elt iter -> t
val add_iter : t -> elt iter -> unit
val pp : ?pp_sep:unit printer -> elt printer -> t printer

pp pp_elt returns a set printer, given a printer for individual elements.

\ No newline at end of file diff --git a/3.10/containers-data/CCHashTrie/.dummy b/3.10/containers-data/CCHashTrie/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCHashTrie/Make/argument-1-K/index.html b/3.10/containers-data/CCHashTrie/Make/argument-1-K/index.html new file mode 100644 index 00000000..57308aa9 --- /dev/null +++ b/3.10/containers-data/CCHashTrie/Make/argument-1-K/index.html @@ -0,0 +1,2 @@ + +K (containers-data.CCHashTrie.Make.1-K)

Parameter Make.1-K

type t
val equal : t -> t -> bool
val hash : t -> int
\ No newline at end of file diff --git a/3.10/containers-data/CCHashTrie/Make/index.html b/3.10/containers-data/CCHashTrie/Make/index.html new file mode 100644 index 00000000..e1a72d71 --- /dev/null +++ b/3.10/containers-data/CCHashTrie/Make/index.html @@ -0,0 +1,7 @@ + +Make (containers-data.CCHashTrie.Make)

Module CCHashTrie.Make

Functors

Parameters

module K : KEY

Signature

type key = K.t
type 'a t
val empty : 'a t
val is_empty : _ t -> bool
val singleton : key -> 'a -> 'a t
val add : key -> 'a -> 'a t -> 'a t
val mem : key -> _ t -> bool
val get : key -> 'a t -> 'a option
val get_exn : key -> 'a t -> 'a
  • raises Not_found

    if key not present.

val remove : key -> 'a t -> 'a t

Remove the key, if present.

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.

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).

  • raises 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.

  • raises 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.

  • raises Transient.Frozen

    if id is frozen.

val cardinal : _ t -> int
val choose : 'a t -> (key * 'a) option
val choose_exn : 'a t -> key * 'a
  • raises Not_found

    if not pair was found.

val iter : f:( key -> 'a -> unit ) -> 'a t -> unit
val fold : f:( 'b -> key -> 'a -> 'b ) -> x:'b -> 'a t -> 'b
Conversions
val to_list : 'a t -> (key * 'a) list
val add_list : 'a t -> (key * 'a) list -> 'a t
val add_list_mut : id:Transient.t -> 'a t -> (key * 'a) list -> 'a t
  • raises Frozen

    if the ID is frozen.

val of_list : (key * 'a) list -> 'a t
val add_iter : 'a t -> (key * 'a) iter -> 'a t
val add_iter_mut : id:Transient.t -> 'a t -> (key * 'a) iter -> 'a t
  • raises Frozen

    if the ID is frozen.

val of_iter : (key * 'a) iter -> 'a t
val to_iter : 'a t -> (key * 'a) iter
val add_gen : 'a t -> (key * 'a) gen -> 'a t
val add_gen_mut : id:Transient.t -> 'a t -> (key * 'a) gen -> 'a t
  • raises Frozen

    if the ID is frozen.

val of_gen : (key * 'a) gen -> 'a t
val to_gen : 'a t -> (key * 'a) gen
IO
val pp : key printer -> 'a printer -> 'a t printer

Renamed from val print.

  • since 2.0
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.

\ No newline at end of file diff --git a/3.10/containers-data/CCHashTrie/Transient/index.html b/3.10/containers-data/CCHashTrie/Transient/index.html new file mode 100644 index 00000000..d7e1bc20 --- /dev/null +++ b/3.10/containers-data/CCHashTrie/Transient/index.html @@ -0,0 +1,2 @@ + +Transient (containers-data.CCHashTrie.Transient)

Module CCHashTrie.Transient

Transient Identifiers

type t

Identifiers for transient modifications. A transient modification is uniquely identified by a Transient.t. Once Transient.freeze r is called, r cannot be used to modify the structure again.

val create : unit -> t

Create a new, active ID.

val equal : t -> t -> bool

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).

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

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.

\ No newline at end of file diff --git a/3.10/containers-data/CCHashTrie/index.html b/3.10/containers-data/CCHashTrie/index.html new file mode 100644 index 00000000..2eaa7f68 --- /dev/null +++ b/3.10/containers-data/CCHashTrie/index.html @@ -0,0 +1,2 @@ + +CCHashTrie (containers-data.CCHashTrie)

Module CCHashTrie

Hash Tries

Trie indexed by the hash of the keys, where the branching factor is fixed. The goal is to have a quite efficient functional structure with fast update and access if the hash function is good. The trie is not binary, to improve cache locality and decrease depth.

Preliminary benchmarks (see the "tbl" section of benchmarks) tend to show that this type is quite efficient for small data sets.

status: unstable

type 'a iter = ( 'a -> unit ) -> unit
type 'a gen = unit -> 'a option
type 'a printer = Stdlib.Format.formatter -> 'a -> unit
type 'a ktree = unit -> [ `Nil | `Node of 'a * 'a ktree list ]
module Transient : sig ... end
module type S = sig ... end
module type KEY = sig ... end
module Make (K : KEY) : S with type key = K.t
\ No newline at end of file diff --git a/3.10/containers-data/CCHashTrie/module-type-KEY/index.html b/3.10/containers-data/CCHashTrie/module-type-KEY/index.html new file mode 100644 index 00000000..3c2b3435 --- /dev/null +++ b/3.10/containers-data/CCHashTrie/module-type-KEY/index.html @@ -0,0 +1,2 @@ + +KEY (containers-data.CCHashTrie.KEY)

Module type CCHashTrie.KEY

Type for keys

type t
val equal : t -> t -> bool
val hash : t -> int
\ No newline at end of file diff --git a/3.10/containers-data/CCHashTrie/module-type-S/index.html b/3.10/containers-data/CCHashTrie/module-type-S/index.html new file mode 100644 index 00000000..124b7b81 --- /dev/null +++ b/3.10/containers-data/CCHashTrie/module-type-S/index.html @@ -0,0 +1,7 @@ + +S (containers-data.CCHashTrie.S)

Module type CCHashTrie.S

Signature

type key
type 'a t
val empty : 'a t
val is_empty : _ t -> bool
val singleton : key -> 'a -> 'a t
val add : key -> 'a -> 'a t -> 'a t
val mem : key -> _ t -> bool
val get : key -> 'a t -> 'a option
val get_exn : key -> 'a t -> 'a
  • raises Not_found

    if key not present.

val remove : key -> 'a t -> 'a t

Remove the key, if present.

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.

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).

  • raises 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.

  • raises 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.

  • raises Transient.Frozen

    if id is frozen.

val cardinal : _ t -> int
val choose : 'a t -> (key * 'a) option
val choose_exn : 'a t -> key * 'a
  • raises Not_found

    if not pair was found.

val iter : f:( key -> 'a -> unit ) -> 'a t -> unit
val fold : f:( 'b -> key -> 'a -> 'b ) -> x:'b -> 'a t -> 'b
Conversions
val to_list : 'a t -> (key * 'a) list
val add_list : 'a t -> (key * 'a) list -> 'a t
val add_list_mut : id:Transient.t -> 'a t -> (key * 'a) list -> 'a t
  • raises Frozen

    if the ID is frozen.

val of_list : (key * 'a) list -> 'a t
val add_iter : 'a t -> (key * 'a) iter -> 'a t
val add_iter_mut : id:Transient.t -> 'a t -> (key * 'a) iter -> 'a t
  • raises Frozen

    if the ID is frozen.

val of_iter : (key * 'a) iter -> 'a t
val to_iter : 'a t -> (key * 'a) iter
val add_gen : 'a t -> (key * 'a) gen -> 'a t
val add_gen_mut : id:Transient.t -> 'a t -> (key * 'a) gen -> 'a t
  • raises Frozen

    if the ID is frozen.

val of_gen : (key * 'a) gen -> 'a t
val to_gen : 'a t -> (key * 'a) gen
IO
val pp : key printer -> 'a printer -> 'a t printer

Renamed from val print.

  • since 2.0
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.

\ No newline at end of file diff --git a/3.10/containers-data/CCHet/.dummy b/3.10/containers-data/CCHet/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCHet/Key/index.html b/3.10/containers-data/CCHet/Key/index.html new file mode 100644 index 00000000..91dff501 --- /dev/null +++ b/3.10/containers-data/CCHet/Key/index.html @@ -0,0 +1,2 @@ + +Key (containers-data.CCHet.Key)

Module CCHet.Key

type 'a t
val create : unit -> 'a t
val equal : 'a t -> 'a t -> bool

Compare two keys that have compatible types.

\ No newline at end of file diff --git a/3.10/containers-data/CCHet/Map/index.html b/3.10/containers-data/CCHet/Map/index.html new file mode 100644 index 00000000..827c64c4 --- /dev/null +++ b/3.10/containers-data/CCHet/Map/index.html @@ -0,0 +1,2 @@ + +Map (containers-data.CCHet.Map)

Module CCHet.Map

Immutable map

type t
val empty : t
val mem : _ Key.t -> t -> bool
val add : 'a Key.t -> 'a -> t -> t
val remove : _ Key.t -> t -> t
val length : t -> int
val cardinal : t -> int
val find : 'a Key.t -> t -> 'a option
val find_exn : 'a Key.t -> t -> 'a
  • raises Not_found

    if the key is not in the table.

val iter : ( pair -> unit ) -> t -> unit
val to_iter : t -> pair iter
val of_iter : pair iter -> t
val add_iter : t -> pair iter -> t
val add_list : t -> pair list -> t
val of_list : pair list -> t
val to_list : t -> pair list
\ No newline at end of file diff --git a/3.10/containers-data/CCHet/Tbl/index.html b/3.10/containers-data/CCHet/Tbl/index.html new file mode 100644 index 00000000..de55e266 --- /dev/null +++ b/3.10/containers-data/CCHet/Tbl/index.html @@ -0,0 +1,2 @@ + +Tbl (containers-data.CCHet.Tbl)

Module CCHet.Tbl

Imperative table indexed by Key

type t
val create : ?size:int -> unit -> t
val mem : t -> _ Key.t -> bool
val add : t -> 'a Key.t -> 'a -> unit
val remove : t -> _ Key.t -> unit
val length : t -> int
val find : t -> 'a Key.t -> 'a option
val find_exn : t -> 'a Key.t -> 'a
  • raises Not_found

    if the key is not in the table.

val iter : ( pair -> unit ) -> t -> unit
val to_iter : t -> pair iter
val of_iter : pair iter -> t
val add_iter : t -> pair iter -> unit
val add_list : t -> pair list -> unit
val of_list : pair list -> t
val to_list : t -> pair list
\ No newline at end of file diff --git a/3.10/containers-data/CCHet/index.html b/3.10/containers-data/CCHet/index.html new file mode 100644 index 00000000..600e76a3 --- /dev/null +++ b/3.10/containers-data/CCHet/index.html @@ -0,0 +1,2 @@ + +CCHet (containers-data.CCHet)

Module CCHet

Associative containers with Heterogeneous Values

This is similar to CCMixtbl, but the injection is directly used as a key.

type 'a iter = ( 'a -> unit ) -> unit
type 'a gen = unit -> 'a option
module Key : sig ... end
type pair =
| Pair : 'a Key.t * 'a -> pair
module Tbl : sig ... end
module Map : sig ... end
\ No newline at end of file diff --git a/3.10/containers-data/CCImmutArray/.dummy b/3.10/containers-data/CCImmutArray/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCImmutArray/index.html b/3.10/containers-data/CCImmutArray/index.html new file mode 100644 index 00000000..5b19f86c --- /dev/null +++ b/3.10/containers-data/CCImmutArray/index.html @@ -0,0 +1,7 @@ + +CCImmutArray (containers-data.CCImmutArray)

Module CCImmutArray

Immutable Arrays

Purely functional use of arrays. Update is costly, but reads are very fast. Sadly, it is not possible to make this type covariant without using black magic.

type 'a t

Array of values of type 'a. The underlying type really is an array, but it will never be modified.

It should be covariant but OCaml will not accept it.

val empty : 'a t
val length : _ t -> int
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.

val init : int -> ( int -> 'a ) -> 'a t

init n f makes the array [| f 0; f 1; ... ; f (n-1) |].

  • raises Invalid_argument

    if n < 0.

val get : 'a t -> int -> 'a

Access the element.

val set : 'a t -> int -> 'a -> 'a t

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 from start to pstart + len - 1 of array a.

Raises Invalid_argument "Array.sub" if start and len do not designate a valid subarray of a; that is, if start < 0, or len < 0, or start + len > Array.length a.

  • since 1.5
val map : ( 'a -> 'b ) -> 'a t -> 'b t
val mapi : ( int -> 'a -> 'b ) -> 'a t -> 'b t
val append : 'a t -> 'a t -> 'a t
val iter : ( 'a -> unit ) -> 'a t -> unit
val iteri : ( int -> 'a -> unit ) -> 'a t -> unit
val foldi : ( 'a -> int -> 'b -> 'a ) -> 'a -> 'b t -> 'a
val fold : ( 'a -> 'b -> 'a ) -> 'a -> 'b t -> 'a
val for_all : ( 'a -> bool ) -> 'a t -> bool
val exists : ( 'a -> bool ) -> 'a t -> bool

Conversions

type 'a iter = ( 'a -> unit ) -> unit
type 'a gen = unit -> 'a option
val of_list : 'a list -> 'a t
val to_list : 'a t -> 'a list
val of_array_unsafe : 'a array -> 'a t

Take ownership of the given array. Careful, the array must NOT be modified afterwards!

val to_iter : 'a t -> 'a iter
val of_iter : 'a iter -> 'a t
val of_gen : 'a gen -> 'a t
val to_gen : 'a t -> 'a gen

IO

type 'a printer = Stdlib.Format.formatter -> 'a -> unit
val pp : + ?pp_start:unit printer -> + ?pp_stop:unit printer -> + ?pp_sep:unit printer -> + 'a printer -> + 'a t printer

pp ~pp_start ~pp_stop ~pp_sep pp_item ppf a formats the array a on ppf. Each element is formatted with pp_item, pp_start is called at the beginning, pp_stop is called at the end, pp_sep is called between each elements. By defaults pp_start and pp_stop does nothing and pp_sep defaults to (fun out -> Format.fprintf out ",@ ").

\ No newline at end of file diff --git a/3.10/containers-data/CCIntMap/.dummy b/3.10/containers-data/CCIntMap/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCIntMap/index.html b/3.10/containers-data/CCIntMap/index.html new file mode 100644 index 00000000..9c0cf662 --- /dev/null +++ b/3.10/containers-data/CCIntMap/index.html @@ -0,0 +1,6 @@ + +CCIntMap (containers-data.CCIntMap)

Module CCIntMap

Map specialized for Int keys

status: stable

type +'a t
val empty : 'a t
val is_empty : _ t -> bool

Is the map empty?

  • since 2.3
val singleton : int -> 'a -> 'a t
val doubleton : int -> 'a -> int -> 'a -> 'a t
val mem : int -> _ t -> bool
val find : int -> 'a t -> 'a option
val find_exn : int -> 'a t -> 'a

Same as find but unsafe.

  • raises Not_found

    if key is not present.

val add : int -> 'a -> 'a t -> 'a t
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.

  • since 0.13
val compare : cmp:( 'a -> 'a -> int ) -> 'a t -> 'a t -> int

Total order between maps; the precise order is unspecified.

  • since 0.13
val update : int -> ( 'a option -> 'a option ) -> 'a t -> 'a t
val filter : ( int -> 'a -> bool ) -> 'a t -> 'a t

Filter values using the given predicate

  • since 2.3
val filter_map : ( int -> 'a -> 'b option ) -> 'a t -> 'b t

Filter-map values using the given function

  • since 2.3
val cardinal : _ t -> int

Number of bindings in the map. Linear time.

val iter : ( int -> 'a -> unit ) -> 'a t -> unit
val fold : ( int -> 'a -> 'b -> 'b ) -> 'a t -> 'b -> 'b
val mapi : ( int -> 'a -> 'b ) -> 'a t -> 'b t
  • since 0.17
val map : ( 'a -> 'b ) -> 'a t -> 'b t
  • since 0.17
val choose : 'a t -> (int * 'a) option
val choose_exn : 'a t -> int * 'a
  • raises Not_found

    if not pair was found.

val union : ( int -> 'a -> 'a -> 'a ) -> 'a t -> 'a t -> 'a t
val inter : ( int -> 'a -> 'a -> 'a ) -> 'a t -> 'a t -> 'a t
val merge : + f:( int -> [ `Left of 'a | `Right of 'b | `Both of 'a * 'b ] -> 'c option ) -> + 'a t -> + 'b t -> + 'c t

merge ~f m1 m2 merges m1 and m2 together, calling f once on every key that occurs in at least one of m1 and m2. if f k binding = Some c then k -> c is part of the result, else k is not part of the result.

  • since 2.3

Whole-collection operations

type 'a iter = ( 'a -> unit ) -> unit
type 'a gen = unit -> 'a option
val add_list : 'a t -> (int * 'a) list -> 'a t
val of_list : (int * 'a) list -> 'a t
val to_list : 'a t -> (int * 'a) list
val add_iter : 'a t -> (int * 'a) iter -> 'a t
val of_iter : (int * 'a) iter -> 'a t
val to_iter : 'a t -> (int * 'a) iter
val keys : _ t -> int iter
val values : 'a t -> 'a iter
val add_gen : 'a t -> (int * 'a) gen -> 'a t
  • since 0.13
val of_gen : (int * 'a) gen -> 'a t
  • since 0.13
val to_gen : 'a t -> (int * 'a) gen
  • since 0.13
val add_seq : 'a t -> (int * 'a) Stdlib.Seq.t -> 'a t
  • since 3.0
val of_seq : (int * 'a) Stdlib.Seq.t -> 'a t
  • since 3.0
val to_seq : 'a t -> (int * 'a) Stdlib.Seq.t
  • since 3.0
type 'a tree = unit -> [ `Nil | `Node of 'a * 'a tree list ]
val as_tree : 'a t -> [ `Node of int * int | `Leaf of int * 'a ] tree

IO

type 'a printer = Stdlib.Format.formatter -> 'a -> unit
val pp : 'a printer -> 'a t printer
  • since 0.13

Helpers

\ No newline at end of file diff --git a/3.10/containers-data/CCKTree/.dummy b/3.10/containers-data/CCKTree/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCKTree/Dot/index.html b/3.10/containers-data/CCKTree/Dot/index.html new file mode 100644 index 00000000..9199dc66 --- /dev/null +++ b/3.10/containers-data/CCKTree/Dot/index.html @@ -0,0 +1,2 @@ + +Dot (containers-data.CCKTree.Dot)

Module CCKTree.Dot

type attribute = [
| `Color of string
| `Shape of string
| `Weight of int
| `Style of string
| `Label of string
| `Id of string(*

Unique ID in the graph. Allows sharing.

*)
| `Other of string * string
]

Dot attributes for nodes

type graph = string * attribute list t list

A dot graph is a name, plus a list of trees labelled with attributes

val mk_id : ( 'a, Stdlib.Buffer.t, unit, attribute ) Stdlib.format4 -> 'a

Using a formatter string, build an ID.

val mk_label : ( 'a, Stdlib.Buffer.t, unit, attribute ) Stdlib.format4 -> 'a

Using a formatter string, build a label.

val make : name:string -> attribute list t list -> graph
val singleton : name:string -> attribute list t -> graph
val pp_single : string -> attribute list t printer
val pp : graph printer

Printer to DOT with indentation, etc.

  • since 0.6.1
val print_to_file : string -> graph -> unit

print_to_file filename g prints g into a file whose name is filename.

  • since 0.6.1
val to_file : ?name:string -> string -> attribute list t list -> unit

to_file filename trees makes a graph out of the trees, opens the file filename and prints the graph into the file.

  • parameter name

    name of the graph.

  • since 0.6.1
\ No newline at end of file diff --git a/3.10/containers-data/CCKTree/class-type-pset/index.html b/3.10/containers-data/CCKTree/class-type-pset/index.html new file mode 100644 index 00000000..5162b655 --- /dev/null +++ b/3.10/containers-data/CCKTree/class-type-pset/index.html @@ -0,0 +1,2 @@ + +pset (containers-data.CCKTree.pset)

Class type CCKTree.pset

Abstract Set structure

method add : 'a -> 'a pset
method mem : 'a -> bool
\ No newline at end of file diff --git a/3.10/containers-data/CCKTree/index.html b/3.10/containers-data/CCKTree/index.html new file mode 100644 index 00000000..f7e2bbaa --- /dev/null +++ b/3.10/containers-data/CCKTree/index.html @@ -0,0 +1,15 @@ + +CCKTree (containers-data.CCKTree)

Module CCKTree

Lazy Tree Structure This structure can be used to represent trees and directed graphs (as infinite trees) in a lazy fashion. Like CCKList, it is a structural type.

type 'a iter = ( 'a -> unit ) -> unit
type 'a gen = unit -> 'a option
type 'a printer = Stdlib.Format.formatter -> 'a -> unit

Basics

type +'a t = unit -> [ `Nil | `Node of 'a * 'a t list ]
val empty : 'a t
val is_empty : _ t -> bool
val singleton : 'a -> 'a t

Tree with only one label.

val node : 'a -> 'a t list -> 'a t

Build a node from a label and a list of children.

val node1 : 'a -> 'a t -> 'a t

Node with one child.

val node2 : 'a -> 'a t -> 'a t -> 'a t

Node with two children.

val fold : ( 'a -> 'b -> 'a ) -> 'a -> 'b t -> 'a

Fold on values in no specified order. May not terminate if the tree is infinite.

val iter : ( 'a -> unit ) -> 'a t -> unit
val size : _ t -> int

Number of elements.

val height : _ t -> int

Length of the longest path to empty leaves.

val map : ( 'a -> 'b ) -> 'a t -> 'b t
val (>|=) : 'a t -> ( 'a -> 'b ) -> 'b t
val cut_depth : int -> 'a t -> 'a t

Cut the tree at the given depth, so it becomes finite.

Graph Traversals

class type 'a pset = object ... end

Abstract Set structure

val set_of_cmp : cmp:( 'a -> 'a -> int ) -> unit -> 'a pset

Build a set structure given a total ordering.

val dfs : pset:'a pset -> 'a t -> [ `Enter of 'a | `Exit of 'a ] Stdlib.Seq.t

Depth-first traversal of the tree.

val bfs : pset:'a pset -> 'a t -> 'a Stdlib.Seq.t

Breadth-first traversal of the tree.

val force : 'a t -> [ `Nil | `Node of 'a * 'b list ] as 'b

force t evaluates t completely and returns a regular tree structure.

  • since 0.13
val find : pset:'a pset -> ( 'a -> 'b option ) -> 'a t -> 'b option

Look for an element that maps to Some _.

Pretty-printing

Example (tree of calls for naive Fibonacci function):

let mk_fib n =
+  let rec fib' l r i =
+    if i=n then r else fib' r (l+r) (i+1)
+  in fib' 1 1 1;;
+
+let rec fib n = match n with
+  | 0 | 1 -> CCKTree.singleton (`Cst n)
+  | _ -> CCKTree.node2 (`Plus (mk_fib n)) (fib (n-1)) (fib (n-2));;
+
+let pp_node fmt = function
+  | `Cst n -> Format.fprintf fmt "%d" n
+  | `Plus n -> Format.fprintf fmt "%d" n;;
+
+Format.printf "%a@." (CCKTree.pp pp_node) (fib 8);;
val pp : 'a printer -> 'a t printer

A pretty-printer using S-expressions and boxes to render the tree. Empty nodes are not rendered; sharing is ignored.

  • since 0.9

Pretty printing in the DOT (graphviz) format

module Dot : sig ... end
\ No newline at end of file diff --git a/3.10/containers-data/CCLazy_list/.dummy b/3.10/containers-data/CCLazy_list/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCLazy_list/Infix/index.html b/3.10/containers-data/CCLazy_list/Infix/index.html new file mode 100644 index 00000000..9f0b1b39 --- /dev/null +++ b/3.10/containers-data/CCLazy_list/Infix/index.html @@ -0,0 +1,2 @@ + +Infix (containers-data.CCLazy_list.Infix)

Module CCLazy_list.Infix

val (>|=) : 'a t -> ( 'a -> 'b ) -> 'b t
val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t
val (<|>) : 'a t -> 'a t -> 'a t

Alias to default.

  • since 2.1
\ No newline at end of file diff --git a/3.10/containers-data/CCLazy_list/index.html b/3.10/containers-data/CCLazy_list/index.html new file mode 100644 index 00000000..40729ceb --- /dev/null +++ b/3.10/containers-data/CCLazy_list/index.html @@ -0,0 +1,2 @@ + +CCLazy_list (containers-data.CCLazy_list)

Module CCLazy_list

Lazy List

type +'a t = 'a node lazy_t
and +'a node =
| Nil
| Cons of 'a * 'a t
val empty : 'a t

Empty list.

val return : 'a -> 'a t

Return a computed value.

val is_empty : _ t -> bool

Evaluate the head.

val length : _ t -> int

length l returns the number of elements in l, eagerly (linear time). Caution, will not terminate if l is infinite.

val cons : 'a -> 'a t -> 'a t
val head : 'a t -> ('a * 'a t) option

Evaluate head, return it, or None if the list is empty.

val map : f:( 'a -> 'b ) -> 'a t -> 'b t

Lazy map.

val filter : f:( 'a -> bool ) -> 'a t -> 'a t

Filter values.

  • since 0.18
val take : int -> 'a t -> 'a t

Take at most n values.

  • since 0.18
val append : 'a t -> 'a t -> 'a t

Lazy concatenation.

val flat_map : f:( 'a -> 'b t ) -> 'a t -> 'b t

Monadic flatten + map.

val default : default:'a t -> 'a t -> 'a t

Choice operator.

  • since 2.1
module Infix : sig ... end
include module type of Infix
val (>|=) : 'a t -> ( 'a -> 'b ) -> 'b t
val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t
val (<|>) : 'a t -> 'a t -> 'a t

Alias to default.

  • since 2.1
type 'a gen = unit -> 'a option
val of_gen : 'a gen -> 'a t
val of_list : 'a list -> 'a t
val to_list : 'a t -> 'a list
val to_list_rev : 'a t -> 'a list
val to_gen : 'a t -> 'a gen
\ No newline at end of file diff --git a/3.10/containers-data/CCMixmap/.dummy b/3.10/containers-data/CCMixmap/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCMixmap/Make/argument-1-X/index.html b/3.10/containers-data/CCMixmap/Make/argument-1-X/index.html new file mode 100644 index 00000000..8bd8f2d9 --- /dev/null +++ b/3.10/containers-data/CCMixmap/Make/argument-1-X/index.html @@ -0,0 +1,2 @@ + +X (containers-data.CCMixmap.Make.1-X)

Parameter Make.1-X

type t
val compare : t -> t -> int
\ No newline at end of file diff --git a/3.10/containers-data/CCMixmap/Make/index.html b/3.10/containers-data/CCMixmap/Make/index.html new file mode 100644 index 00000000..d8f28c80 --- /dev/null +++ b/3.10/containers-data/CCMixmap/Make/index.html @@ -0,0 +1,2 @@ + +Make (containers-data.CCMixmap.Make)

Module CCMixmap.Make

Parameters

module X : ORD

Signature

type key = X.t
type t

A map containing values of different types, indexed by key.

val empty : t

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.

val add : inj:'a injection -> key -> 'a -> t -> t

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.

  • raises Not_found

    if either the key is not found, or if its value doesn't belong to the right type.

val cardinal : t -> int

Number of bindings.

val remove : key -> t -> t

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.

val fold_keys : f:( 'a -> key -> 'a ) -> x:'a -> t -> 'a

Fold over the keys.

Iterators

type 'a iter = ( 'a -> unit ) -> unit
val keys_iter : t -> key iter

All the keys.

val bindings_of : inj:'a injection -> t -> (key * 'a) iter

All the bindings that come from the corresponding injection.

type value =
| Value : ( 'a injection -> 'a option ) -> value
val bindings : t -> (key * value) iter

Iterate on all bindings.

\ No newline at end of file diff --git a/3.10/containers-data/CCMixmap/index.html b/3.10/containers-data/CCMixmap/index.html new file mode 100644 index 00000000..1478b339 --- /dev/null +++ b/3.10/containers-data/CCMixmap/index.html @@ -0,0 +1,19 @@ + +CCMixmap (containers-data.CCMixmap)

Module CCMixmap

Maps with Heterogeneous Values

status: experimental

module M = CCMixmap.Make(CCInt)
+
+let inj_int = CCMixmap.create_inj()
+let inj_str = CCMixmap.create_inj()
+let inj_list_int = CCMixmap.create_inj()
+
+let m =
+  M.empty
+  |> M.add ~inj:inj_int 1 1
+  |> M.add ~inj:inj_str 2 "2"
+  |> M.add ~inj:inj_list_int 3 [3;3;3]
+
+    assert (M.get ~inj:inj_int 1 m = Some 1)
+    assert (M.get ~inj:inj_str 1 m = None)
+    assert (M.get ~inj:inj_str 2 m = Some "2")
+    assert (M.get ~inj:inj_int 2 m = None)
+    assert (M.get ~inj:inj_list_int 3 m = Some [3;3;3])
+    assert (M.get ~inj:inj_str 3 m = None)

change of API, the map is last argument to make piping with |> easier since 0.16.

type 'a injection

An accessor for values of type 'a in any map. Values put in the map using a key can only be retrieved using this very same key.

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 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 across multiple maps (although not in a thread-safe way).

module type S = sig ... end
module type ORD = sig ... end
module Make (X : ORD) : S with type key = X.t
\ No newline at end of file diff --git a/3.10/containers-data/CCMixmap/module-type-ORD/index.html b/3.10/containers-data/CCMixmap/module-type-ORD/index.html new file mode 100644 index 00000000..8c472ced --- /dev/null +++ b/3.10/containers-data/CCMixmap/module-type-ORD/index.html @@ -0,0 +1,2 @@ + +ORD (containers-data.CCMixmap.ORD)

Module type CCMixmap.ORD

type t
val compare : t -> t -> int
\ No newline at end of file diff --git a/3.10/containers-data/CCMixmap/module-type-S/index.html b/3.10/containers-data/CCMixmap/module-type-S/index.html new file mode 100644 index 00000000..db44f4dd --- /dev/null +++ b/3.10/containers-data/CCMixmap/module-type-S/index.html @@ -0,0 +1,2 @@ + +S (containers-data.CCMixmap.S)

Module type CCMixmap.S

type key
type t

A map containing values of different types, indexed by key.

val empty : t

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.

val add : inj:'a injection -> key -> 'a -> t -> t

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.

  • raises Not_found

    if either the key is not found, or if its value doesn't belong to the right type.

val cardinal : t -> int

Number of bindings.

val remove : key -> t -> t

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.

val fold_keys : f:( 'a -> key -> 'a ) -> x:'a -> t -> 'a

Fold over the keys.

Iterators

type 'a iter = ( 'a -> unit ) -> unit
val keys_iter : t -> key iter

All the keys.

val bindings_of : inj:'a injection -> t -> (key * 'a) iter

All the bindings that come from the corresponding injection.

type value =
| Value : ( 'a injection -> 'a option ) -> value
val bindings : t -> (key * value) iter

Iterate on all bindings.

\ No newline at end of file diff --git a/3.10/containers-data/CCMixset/.dummy b/3.10/containers-data/CCMixset/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCMixset/index.html b/3.10/containers-data/CCMixset/index.html new file mode 100644 index 00000000..55a82715 --- /dev/null +++ b/3.10/containers-data/CCMixset/index.html @@ -0,0 +1,14 @@ + +CCMixset (containers-data.CCMixset)

Module CCMixset

Set of Heterogeneous Values

let k1 : int key = newkey () in
+let k2 : int key = newkey () in
+let k3 : string key = newkey () in
+let set =
+  empty
+  |> set ~key:k1 1
+  |> set ~key:k2 2
+  |> set ~key:k3 "3"
+in
+assert (get ~key:k1 set = Some 1);
+assert (get ~key:k2 set = Some 2);
+assert (get ~key:k3 set = Some "3");
+()
type t

A set of values of heterogeneous types

type 'a key

A unique "key" to access a value of type 'a in a set

val newkey : unit -> 'a key

newkey () creates a new unique key that can be used to access a 'a value in a set. Each key created with newkey is distinct from any other key, even if they have the same type.

Not thread-safe.

val empty : t

Empty set.

val set : key:'a key -> 'a -> t -> t

set ~key v set maps key to v in set. It means that for every set, get ~key (set ~key v set) = Some v.

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.

  • raises Not_found

    if the key is not present.

val cardinal : t -> int

Number of mappings.

\ No newline at end of file diff --git a/3.10/containers-data/CCMixtbl/.dummy b/3.10/containers-data/CCMixtbl/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCMixtbl/index.html b/3.10/containers-data/CCMixtbl/index.html new file mode 100644 index 00000000..b090a21c --- /dev/null +++ b/3.10/containers-data/CCMixtbl/index.html @@ -0,0 +1,22 @@ + +CCMixtbl (containers-data.CCMixtbl)

Module CCMixtbl

Hash Table with Heterogeneous Keys

From https://github.com/mjambon/mixtbl (thanks to him). Example:

let inj_int = CCMixtbl.create_inj () ;;
+
+let tbl = CCMixtbl.create 10 ;;
+
+assert_equal None (CCMixtbl.get ~inj:inj_int tbl "a");;
+
+CCMixtbl.set inj_int tbl "a" 1;;
+
+assert_equal (Some 1) (CCMixtbl.get ~inj:inj_int tbl "a");;
+
+let inj_string = CCMixtbl.create_inj () ;;
+
+CCMixtbl.set inj_string tbl "b" "Hello";
+
+assert_equal (Some "Hello") (CCMixtbl.get inj_string tbl "b");;
+assert_equal None (CCMixtbl.get inj_string tbl "a");;
+assert_equal (Some 1) (CCMixtbl.get inj_int tbl "a");;
+CCMixtbl.set inj_string tbl "a" "Bye";;
+
+assert_equal None (CCMixtbl.get inj_int tbl "a");;
+assert_equal (Some "Bye") (CCMixtbl.get inj_string tbl "a");;
type 'a t

A hash table containing values of different types. The type parameter 'a represents the type of the keys.

type 'b injection

An accessor for values of type 'b in any table. Values put in the table using a key can only be retrieved using this very same key.

val create : int -> 'a t

create n creates a hash table of initial size n.

val create_inj : unit -> 'b 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 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 across multiple tables (although not in a thread-safe way).

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.

val set : inj:'b injection -> 'a t -> 'a -> 'b -> unit

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.

  • raises Not_found

    if either the key is not found, or if its value doesn't belong to the right type.

val length : 'a t -> int

Number of bindings.

val clear : 'a t -> unit

Clear content of the hashtable.

val remove : 'a t -> 'a -> unit

Remove the binding for this key.

val copy : 'a t -> 'a t

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.

val fold_keys : 'a t -> 'b -> ( 'b -> 'a -> 'b ) -> 'b

Fold over the keys.

Iterators

type 'a iter = ( 'a -> unit ) -> unit
val keys_iter : 'a t -> 'a iter

All the keys.

val bindings_of : inj:'b injection -> 'a t -> ('a * 'b) iter

All the bindings that come from the corresponding injection.

type value =
| Value : ( 'b injection -> 'b option ) -> value
val bindings : 'a t -> ('a * value) iter

Iterate on all bindings.

\ No newline at end of file diff --git a/3.10/containers-data/CCMultiMap/.dummy b/3.10/containers-data/CCMultiMap/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCMultiMap/Make/argument-1-K/index.html b/3.10/containers-data/CCMultiMap/Make/argument-1-K/index.html new file mode 100644 index 00000000..d81da0b2 --- /dev/null +++ b/3.10/containers-data/CCMultiMap/Make/argument-1-K/index.html @@ -0,0 +1,2 @@ + +K (containers-data.CCMultiMap.Make.1-K)

Parameter Make.1-K

type t
val compare : t -> t -> int
\ No newline at end of file diff --git a/3.10/containers-data/CCMultiMap/Make/argument-2-V/index.html b/3.10/containers-data/CCMultiMap/Make/argument-2-V/index.html new file mode 100644 index 00000000..fe317534 --- /dev/null +++ b/3.10/containers-data/CCMultiMap/Make/argument-2-V/index.html @@ -0,0 +1,2 @@ + +V (containers-data.CCMultiMap.Make.2-V)

Parameter Make.2-V

type t
val compare : t -> t -> int
\ No newline at end of file diff --git a/3.10/containers-data/CCMultiMap/Make/index.html b/3.10/containers-data/CCMultiMap/Make/index.html new file mode 100644 index 00000000..e08fb3b7 --- /dev/null +++ b/3.10/containers-data/CCMultiMap/Make/index.html @@ -0,0 +1,2 @@ + +Make (containers-data.CCMultiMap.Make)

Module CCMultiMap.Make

Parameters

module K : OrderedType
module V : OrderedType

Signature

type key = K.t
type value = V.t
type t
val empty : t

Empty multimap.

val is_empty : t -> bool

Empty multimap?

val add : t -> key -> value -> t

Add a key/value binding.

val remove : t -> key -> value -> t

Remove the binding.

val remove_all : t -> key -> t

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.

val find_iter : t -> key -> ( value -> unit ) -> unit

Iterate on bindings for this key.

val count : t -> key -> int

Number of bindings for this key.

val iter : t -> ( key -> value -> unit ) -> unit

Iterate on all key/value.

val fold : t -> 'a -> ( 'a -> key -> value -> 'a ) -> 'a

Fold on all key/value.

val size : t -> int

Number of keys.

val union : t -> t -> t

Union of multimaps.

val inter : t -> t -> t

Intersection of multimaps.

val diff : t -> t -> t

Difference of maps, i.e. bindings of the first that are not in the second.

val equal : t -> t -> bool

Same multimap.

val compare : t -> t -> int

Total order on multimaps.

val submap : t -> t -> bool

submap m1 m2 is true iff all bindings of m1 are also in m2.

val to_iter : t -> (key * value) iter
val of_iter : ?init:t -> (key * value) iter -> t
val keys : t -> key iter
val values : t -> value iter

Some values may occur several times.

\ No newline at end of file diff --git a/3.10/containers-data/CCMultiMap/MakeBidir/argument-1-L/index.html b/3.10/containers-data/CCMultiMap/MakeBidir/argument-1-L/index.html new file mode 100644 index 00000000..19b0d01b --- /dev/null +++ b/3.10/containers-data/CCMultiMap/MakeBidir/argument-1-L/index.html @@ -0,0 +1,2 @@ + +L (containers-data.CCMultiMap.MakeBidir.1-L)

Parameter MakeBidir.1-L

type t
val compare : t -> t -> int
\ No newline at end of file diff --git a/3.10/containers-data/CCMultiMap/MakeBidir/argument-2-R/index.html b/3.10/containers-data/CCMultiMap/MakeBidir/argument-2-R/index.html new file mode 100644 index 00000000..e8509a66 --- /dev/null +++ b/3.10/containers-data/CCMultiMap/MakeBidir/argument-2-R/index.html @@ -0,0 +1,2 @@ + +R (containers-data.CCMultiMap.MakeBidir.2-R)

Parameter MakeBidir.2-R

type t
val compare : t -> t -> int
\ No newline at end of file diff --git a/3.10/containers-data/CCMultiMap/MakeBidir/index.html b/3.10/containers-data/CCMultiMap/MakeBidir/index.html new file mode 100644 index 00000000..ff9a5e32 --- /dev/null +++ b/3.10/containers-data/CCMultiMap/MakeBidir/index.html @@ -0,0 +1,2 @@ + +MakeBidir (containers-data.CCMultiMap.MakeBidir)

Module CCMultiMap.MakeBidir

Parameters

module L : OrderedType
module R : OrderedType

Signature

type t
type left = L.t
type right = R.t
val empty : t
val is_empty : t -> bool
val add : t -> left -> right -> t

Add a binding (left,right).

val remove : t -> left -> right -> t

Remove a specific binding.

val cardinal_left : t -> int

Number of distinct left keys.

val cardinal_right : t -> int

Number of distinct right keys.

val remove_left : t -> left -> t

Remove all bindings for the left key.

val remove_right : t -> right -> t

Remove all bindings for the right key.

val mem_left : t -> left -> bool

Is the left key present in at least one pair?

val mem_right : t -> right -> bool

Is the right key present in at least one pair?

val find_left : t -> left -> right iter

Find all bindings for this given left-key.

val find_right : t -> right -> left iter

Find all bindings for this given right-key.

val find1_left : t -> left -> right option

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.

val fold : ( 'a -> left -> right -> 'a ) -> 'a -> t -> 'a

Fold on pairs.

val pairs : t -> (left * right) iter

Iterate on pairs.

val add_pairs : t -> (left * right) iter -> t

Add pairs.

val iter_left : t -> left iter
val iter_right : t -> right iter
\ No newline at end of file diff --git a/3.10/containers-data/CCMultiMap/index.html b/3.10/containers-data/CCMultiMap/index.html new file mode 100644 index 00000000..6aa12fcd --- /dev/null +++ b/3.10/containers-data/CCMultiMap/index.html @@ -0,0 +1,8 @@ + +CCMultiMap (containers-data.CCMultiMap)

Module CCMultiMap

Map that can map key to several values

type 'a iter = ( 'a -> unit ) -> unit
module type S = sig ... end
module type OrderedType = sig ... end
module Make + (K : OrderedType) + (V : OrderedType) : + S with type key = K.t and type value = V.t

Two-Way Multimap

Represents n-to-n mappings between two types. Each element from the "left" is mapped to several right values, and conversely.

module type BIDIR = sig ... end
module MakeBidir + (L : OrderedType) + (R : OrderedType) : + BIDIR with type left = L.t and type right = R.t
\ No newline at end of file diff --git a/3.10/containers-data/CCMultiMap/module-type-BIDIR/index.html b/3.10/containers-data/CCMultiMap/module-type-BIDIR/index.html new file mode 100644 index 00000000..d7688dc0 --- /dev/null +++ b/3.10/containers-data/CCMultiMap/module-type-BIDIR/index.html @@ -0,0 +1,2 @@ + +BIDIR (containers-data.CCMultiMap.BIDIR)

Module type CCMultiMap.BIDIR

type t
type left
type right
val empty : t
val is_empty : t -> bool
val add : t -> left -> right -> t

Add a binding (left,right).

val remove : t -> left -> right -> t

Remove a specific binding.

val cardinal_left : t -> int

Number of distinct left keys.

val cardinal_right : t -> int

Number of distinct right keys.

val remove_left : t -> left -> t

Remove all bindings for the left key.

val remove_right : t -> right -> t

Remove all bindings for the right key.

val mem_left : t -> left -> bool

Is the left key present in at least one pair?

val mem_right : t -> right -> bool

Is the right key present in at least one pair?

val find_left : t -> left -> right iter

Find all bindings for this given left-key.

val find_right : t -> right -> left iter

Find all bindings for this given right-key.

val find1_left : t -> left -> right option

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.

val fold : ( 'a -> left -> right -> 'a ) -> 'a -> t -> 'a

Fold on pairs.

val pairs : t -> (left * right) iter

Iterate on pairs.

val add_pairs : t -> (left * right) iter -> t

Add pairs.

val iter_left : t -> left iter
val iter_right : t -> right iter
\ No newline at end of file diff --git a/3.10/containers-data/CCMultiMap/module-type-OrderedType/index.html b/3.10/containers-data/CCMultiMap/module-type-OrderedType/index.html new file mode 100644 index 00000000..1ac4228a --- /dev/null +++ b/3.10/containers-data/CCMultiMap/module-type-OrderedType/index.html @@ -0,0 +1,2 @@ + +OrderedType (containers-data.CCMultiMap.OrderedType)

Module type CCMultiMap.OrderedType

type t
val compare : t -> t -> int
\ No newline at end of file diff --git a/3.10/containers-data/CCMultiMap/module-type-S/index.html b/3.10/containers-data/CCMultiMap/module-type-S/index.html new file mode 100644 index 00000000..3aa17e24 --- /dev/null +++ b/3.10/containers-data/CCMultiMap/module-type-S/index.html @@ -0,0 +1,2 @@ + +S (containers-data.CCMultiMap.S)

Module type CCMultiMap.S

type key
type value
type t
val empty : t

Empty multimap.

val is_empty : t -> bool

Empty multimap?

val add : t -> key -> value -> t

Add a key/value binding.

val remove : t -> key -> value -> t

Remove the binding.

val remove_all : t -> key -> t

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.

val find_iter : t -> key -> ( value -> unit ) -> unit

Iterate on bindings for this key.

val count : t -> key -> int

Number of bindings for this key.

val iter : t -> ( key -> value -> unit ) -> unit

Iterate on all key/value.

val fold : t -> 'a -> ( 'a -> key -> value -> 'a ) -> 'a

Fold on all key/value.

val size : t -> int

Number of keys.

val union : t -> t -> t

Union of multimaps.

val inter : t -> t -> t

Intersection of multimaps.

val diff : t -> t -> t

Difference of maps, i.e. bindings of the first that are not in the second.

val equal : t -> t -> bool

Same multimap.

val compare : t -> t -> int

Total order on multimaps.

val submap : t -> t -> bool

submap m1 m2 is true iff all bindings of m1 are also in m2.

val to_iter : t -> (key * value) iter
val of_iter : ?init:t -> (key * value) iter -> t
val keys : t -> key iter
val values : t -> value iter

Some values may occur several times.

\ No newline at end of file diff --git a/3.10/containers-data/CCMultiSet/.dummy b/3.10/containers-data/CCMultiSet/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCMultiSet/Make/index.html b/3.10/containers-data/CCMultiSet/Make/index.html new file mode 100644 index 00000000..b9772335 --- /dev/null +++ b/3.10/containers-data/CCMultiSet/Make/index.html @@ -0,0 +1,2 @@ + +Make (containers-data.CCMultiSet.Make)

Module CCMultiSet.Make

Parameters

module O : Stdlib.Set.OrderedType

Signature

type elt = O.t
type t
val empty : t
val is_empty : t -> bool
val mem : t -> elt -> bool
val count : t -> elt -> int
val singleton : elt -> t
val add : t -> elt -> t
val remove : t -> elt -> t
val add_mult : t -> elt -> int -> t

add_mult set x n adds n occurrences of x to set.

  • raises 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.

  • raises 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.

  • 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.

  • raises Invalid_argument

    if f n < 0.

  • since 0.6
val min : t -> elt

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 as count a x + count b x.

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).

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).

val diff : t -> t -> t

MultiSet difference. 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).

val compare : t -> t -> int
val equal : t -> t -> bool
val cardinal : t -> int

Number of distinct elements.

val iter : t -> ( int -> elt -> unit ) -> unit
val fold : t -> 'b -> ( 'b -> int -> elt -> 'b ) -> 'b
val of_list : elt list -> t
val to_list : t -> elt list
val to_iter : t -> elt iter
val of_iter : elt iter -> t
val of_list_mult : (elt * int) list -> t
  • since 0.19
val to_list_mult : t -> (elt * int) list
  • since 0.19
val to_iter_mult : t -> (elt * int) iter
  • since 0.19
val of_iter_mult : (elt * int) iter -> t
  • since 0.19
\ No newline at end of file diff --git a/3.10/containers-data/CCMultiSet/index.html b/3.10/containers-data/CCMultiSet/index.html new file mode 100644 index 00000000..f55f2bbf --- /dev/null +++ b/3.10/containers-data/CCMultiSet/index.html @@ -0,0 +1,2 @@ + +CCMultiSet (containers-data.CCMultiSet)

Module CCMultiSet

Multiset

type 'a iter = ( 'a -> unit ) -> unit
module type S = sig ... end
module Make (O : Stdlib.Set.OrderedType) : S with type elt = O.t
\ No newline at end of file diff --git a/3.10/containers-data/CCMultiSet/module-type-S/index.html b/3.10/containers-data/CCMultiSet/module-type-S/index.html new file mode 100644 index 00000000..8e8fe1bc --- /dev/null +++ b/3.10/containers-data/CCMultiSet/module-type-S/index.html @@ -0,0 +1,2 @@ + +S (containers-data.CCMultiSet.S)

Module type CCMultiSet.S

type elt
type t
val empty : t
val is_empty : t -> bool
val mem : t -> elt -> bool
val count : t -> elt -> int
val singleton : elt -> t
val add : t -> elt -> t
val remove : t -> elt -> t
val add_mult : t -> elt -> int -> t

add_mult set x n adds n occurrences of x to set.

  • raises 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.

  • raises 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.

  • 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.

  • raises Invalid_argument

    if f n < 0.

  • since 0.6
val min : t -> elt

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 as count a x + count b x.

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).

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).

val diff : t -> t -> t

MultiSet difference. 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).

val compare : t -> t -> int
val equal : t -> t -> bool
val cardinal : t -> int

Number of distinct elements.

val iter : t -> ( int -> elt -> unit ) -> unit
val fold : t -> 'b -> ( 'b -> int -> elt -> 'b ) -> 'b
val of_list : elt list -> t
val to_list : t -> elt list
val to_iter : t -> elt iter
val of_iter : elt iter -> t
val of_list_mult : (elt * int) list -> t
  • since 0.19
val to_list_mult : t -> (elt * int) list
  • since 0.19
val to_iter_mult : t -> (elt * int) iter
  • since 0.19
val of_iter_mult : (elt * int) iter -> t
  • since 0.19
\ No newline at end of file diff --git a/3.10/containers-data/CCMutHeap/.dummy b/3.10/containers-data/CCMutHeap/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCMutHeap/Make/argument-1-X/index.html b/3.10/containers-data/CCMutHeap/Make/argument-1-X/index.html new file mode 100644 index 00000000..429c99f2 --- /dev/null +++ b/3.10/containers-data/CCMutHeap/Make/argument-1-X/index.html @@ -0,0 +1,2 @@ + +X (containers-data.CCMutHeap.Make.1-X)

Parameter Make.1-X

type t
val idx : t -> int

Index in heap. return -1 if never set

val set_idx : t -> int -> unit

Update index in heap

val lt : t -> t -> bool

cmp a b is true iff a < b

\ No newline at end of file diff --git a/3.10/containers-data/CCMutHeap/Make/index.html b/3.10/containers-data/CCMutHeap/Make/index.html new file mode 100644 index 00000000..b7e97cea --- /dev/null +++ b/3.10/containers-data/CCMutHeap/Make/index.html @@ -0,0 +1,2 @@ + +Make (containers-data.CCMutHeap.Make)

Module CCMutHeap.Make

Parameters

module X : RANKED

Signature

type elt = X.t

Type of elements

type t

Heap of elt, whose priority is increased or decreased incrementally (see decrease for instance)

val create : unit -> t

Create a heap

val decrease : t -> elt -> unit

decrease h x decreases the value associated to x within h

val increase : t -> elt -> unit

increase h x increases the value associated to x within h

val in_heap : elt -> bool
val size : t -> int

Number of integers within the heap

val is_empty : t -> bool
val clear : t -> unit

Clear the content of the heap

val insert : t -> elt -> unit

Insert a new element into the heap

val remove_min : t -> elt

Remove and return the integer that has the lowest value from the heap

  • raises Not_found

    if the heap is empty

val filter : t -> ( elt -> bool ) -> unit

Filter out values that don't satisfy the predicate

\ No newline at end of file diff --git a/3.10/containers-data/CCMutHeap/index.html b/3.10/containers-data/CCMutHeap/index.html new file mode 100644 index 00000000..4764d666 --- /dev/null +++ b/3.10/containers-data/CCMutHeap/index.html @@ -0,0 +1,2 @@ + +CCMutHeap (containers-data.CCMutHeap)

Module CCMutHeap

Mutable Heaps

The classic binary heap in a vector.

STATUS: experimental, this might change in breaking ways.

module type RANKED = CCMutHeap_intf.RANKED
module type S = CCMutHeap_intf.S
module Make (X : RANKED) : S with type elt = X.t
\ No newline at end of file diff --git a/3.10/containers-data/CCMutHeap_intf/.dummy b/3.10/containers-data/CCMutHeap_intf/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCMutHeap_intf/index.html b/3.10/containers-data/CCMutHeap_intf/index.html new file mode 100644 index 00000000..8e4e93a1 --- /dev/null +++ b/3.10/containers-data/CCMutHeap_intf/index.html @@ -0,0 +1,2 @@ + +CCMutHeap_intf (containers-data.CCMutHeap_intf)

Module CCMutHeap_intf

Imperative Heaps

module type RANKED = sig ... end
module type S = sig ... end
\ No newline at end of file diff --git a/3.10/containers-data/CCMutHeap_intf/module-type-RANKED/index.html b/3.10/containers-data/CCMutHeap_intf/module-type-RANKED/index.html new file mode 100644 index 00000000..ffae0e07 --- /dev/null +++ b/3.10/containers-data/CCMutHeap_intf/module-type-RANKED/index.html @@ -0,0 +1,2 @@ + +RANKED (containers-data.CCMutHeap_intf.RANKED)

Module type CCMutHeap_intf.RANKED

type t
val idx : t -> int

Index in heap. return -1 if never set

val set_idx : t -> int -> unit

Update index in heap

val lt : t -> t -> bool

cmp a b is true iff a < b

\ No newline at end of file diff --git a/3.10/containers-data/CCMutHeap_intf/module-type-S/index.html b/3.10/containers-data/CCMutHeap_intf/module-type-S/index.html new file mode 100644 index 00000000..47019477 --- /dev/null +++ b/3.10/containers-data/CCMutHeap_intf/module-type-S/index.html @@ -0,0 +1,2 @@ + +S (containers-data.CCMutHeap_intf.S)

Module type CCMutHeap_intf.S

type elt

Type of elements

type t

Heap of elt, whose priority is increased or decreased incrementally (see decrease for instance)

val create : unit -> t

Create a heap

val decrease : t -> elt -> unit

decrease h x decreases the value associated to x within h

val increase : t -> elt -> unit

increase h x increases the value associated to x within h

val in_heap : elt -> bool
val size : t -> int

Number of integers within the heap

val is_empty : t -> bool
val clear : t -> unit

Clear the content of the heap

val insert : t -> elt -> unit

Insert a new element into the heap

val remove_min : t -> elt

Remove and return the integer that has the lowest value from the heap

  • raises Not_found

    if the heap is empty

val filter : t -> ( elt -> bool ) -> unit

Filter out values that don't satisfy the predicate

\ No newline at end of file diff --git a/3.10/containers-data/CCPersistentArray/.dummy b/3.10/containers-data/CCPersistentArray/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCPersistentArray/index.html b/3.10/containers-data/CCPersistentArray/index.html new file mode 100644 index 00000000..b3c72b86 --- /dev/null +++ b/3.10/containers-data/CCPersistentArray/index.html @@ -0,0 +1,2 @@ + +CCPersistentArray (containers-data.CCPersistentArray)

Module CCPersistentArray

Persistent Arrays

From the paper by Jean-Christophe Filliâtre, "A persistent Union-Find data structure", see the ps version

type 'a t

The type of persistent arrays

val make : int -> 'a -> 'a t

make n x returns a persistent array of length n, with x. All the elements of this new array are initially physically equal to x (in the sense of the == predicate). Consequently, if x is mutable, it is shared among all elements of the array, and modifying x through one of the array entries will modify all other entries at the same time.

  • raises 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.

val init : int -> ( int -> 'a ) -> 'a t

init n f returns a persistent array of length n, with element i initialized to the result of f i.

  • raises 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.

val get : 'a t -> int -> 'a

get a i returns the element with index i from the array a.

  • raises Invalid_argument

    "index out of bounds" if n is outside the 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.

  • raises Invalid_argument

    "index out of bounds" if n is outside the range 0 to Array.length a - 1.

val length : 'a t -> int

Return the length of the persistent array.

val copy : 'a t -> 'a t

copy a returns a fresh copy of a. Both copies are independent.

val map : ( 'a -> 'b ) -> 'a t -> 'b t
val mapi : ( int -> 'a -> 'b ) -> 'a t -> 'b t

Apply the given function to all elements of the array, and return a persistent array initialized by the results of f. In the case of mapi, the function is also given the index of the element. It is equivalent to fun f t -> init (fun i -> f (get t i)).

val iter : ( '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.

  • since 0.13
val flatten : 'a t t -> 'a t

Concatenates all the sub-arrays.

  • since 0.13
val flat_map : ( 'a -> 'b t ) -> 'a t -> 'b t

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

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.

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.

  • since 0.13

Conversions

type 'a iter = ( 'a -> unit ) -> unit
type 'a gen = unit -> 'a option
val to_iter : 'a t -> 'a iter
val of_iter : 'a iter -> 'a t
val of_gen : 'a gen -> 'a t
  • since 0.13
val to_gen : 'a t -> 'a gen
  • since 0.13

IO

type 'a printer = Stdlib.Format.formatter -> 'a -> unit
val pp : 'a printer -> 'a t printer
  • since 0.13
\ No newline at end of file diff --git a/3.10/containers-data/CCPersistentHashtbl/.dummy b/3.10/containers-data/CCPersistentHashtbl/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCPersistentHashtbl/Make/argument-1-H/index.html b/3.10/containers-data/CCPersistentHashtbl/Make/argument-1-H/index.html new file mode 100644 index 00000000..0ad6c98d --- /dev/null +++ b/3.10/containers-data/CCPersistentHashtbl/Make/argument-1-H/index.html @@ -0,0 +1,2 @@ + +H (containers-data.CCPersistentHashtbl.Make.1-H)

Parameter Make.1-H

type t
val equal : t -> t -> bool
val hash : t -> int
\ No newline at end of file diff --git a/3.10/containers-data/CCPersistentHashtbl/Make/index.html b/3.10/containers-data/CCPersistentHashtbl/Make/index.html new file mode 100644 index 00000000..d6281c58 --- /dev/null +++ b/3.10/containers-data/CCPersistentHashtbl/Make/index.html @@ -0,0 +1,13 @@ + +Make (containers-data.CCPersistentHashtbl.Make)

Module CCPersistentHashtbl.Make

Parameters

module H : HashedType

Signature

type key = H.t
type 'a t
val empty : unit -> 'a t

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.

val is_empty : 'a t -> bool

Is the table empty?

val find : 'a t -> key -> 'a

Find the value for this key, or fails.

  • raises Not_found

    if the key is not present in the table.

val get_exn : key -> 'a t -> 'a

Synonym to find with flipped arguments.

val get : key -> 'a t -> 'a option

Safe version of get_exn.

val mem : 'a t -> key -> bool

Is the key bound?

val length : _ t -> int

Number of bindings.

val add : 'a t -> key -> 'a -> 'a t

Add the binding to the table, returning a new table. The old binding for this key, if it exists, is shadowed and will be restored upon remove tbl k.

  • since 0.14
val replace : 'a t -> key -> 'a -> 'a t

Add the binding to the table, returning a new table. This erases the current binding for key, if any.

val update : 'a t -> key -> ( 'a option -> 'a option ) -> 'a t

update tbl key f calls f None if key doesn't belong in tbl, f (Some v) if key -> v otherwise; If f returns None then key is removed, else it returns Some v' and key -> v' is added.

val remove : 'a t -> key -> 'a t

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.

val merge : + f:( key -> [ `Left of 'a | `Right of 'b | `Both of 'a * 'b ] -> 'c option ) -> + 'a t -> + 'b t -> + 'c t

Merge two tables together into a new table. The function's argument correspond to values associated with the key (if present); if the function returns None the key will not appear in the result.

val iter : 'a t -> ( key -> 'a -> unit ) -> unit

Iterate over bindings.

val fold : ( 'b -> key -> 'a -> 'b ) -> 'b -> 'a t -> 'b

Fold over bindings.

val map : ( key -> 'a -> 'b ) -> 'a t -> 'b t

Map all values.

val filter : ( key -> 'a -> bool ) -> 'a t -> 'a t
val filter_map : ( key -> 'a -> 'b option ) -> 'a t -> 'b t
val for_all : ( key -> 'a -> bool ) -> 'a t -> bool
val exists : ( key -> 'a -> bool ) -> 'a t -> bool

Conversions

val of_iter : (key * 'a) iter -> 'a t

Add (replace) bindings from the sequence to the table.

val of_list : (key * 'a) list -> 'a t
val add_iter : 'a t -> (key * 'a) iter -> 'a t
val add_list : 'a t -> (key * 'a) list -> 'a t
val to_iter : 'a t -> (key * 'a) iter

Iter of the bindings of the table.

val to_list : 'a t -> (key * 'a) list

Misc

val equal : 'a equal -> 'a t equal
val pp : + ?pp_start:unit printer -> + ?pp_stop:unit printer -> + ?pp_sep:unit printer -> + ?pp_arrow:unit printer -> + key printer -> + 'a printer -> + 'a t printer
val stats : _ t -> Stdlib.Hashtbl.statistics

Statistics on the internal table.

  • since 0.14
\ No newline at end of file diff --git a/3.10/containers-data/CCPersistentHashtbl/index.html b/3.10/containers-data/CCPersistentHashtbl/index.html new file mode 100644 index 00000000..9ad0c70a --- /dev/null +++ b/3.10/containers-data/CCPersistentHashtbl/index.html @@ -0,0 +1,2 @@ + +CCPersistentHashtbl (containers-data.CCPersistentHashtbl)

Module CCPersistentHashtbl

Persistent hash-table on top of OCaml's hashtables

Almost as efficient as the regular Hashtbl type, but with a persistent interface (rewinding changes to get back in the past history). This is mostly useful for backtracking-like uses, or forward uses (never using old values).

This module is not thread-safe.

type 'a iter = ( 'a -> unit ) -> unit
type 'a printer = Stdlib.Format.formatter -> 'a -> unit
type 'a equal = 'a -> 'a -> bool
module type HashedType = sig ... end

Signature of such a hashtable

module type S = sig ... end

Implementation

module Make (H : HashedType) : S with type key = H.t
\ No newline at end of file diff --git a/3.10/containers-data/CCPersistentHashtbl/module-type-HashedType/index.html b/3.10/containers-data/CCPersistentHashtbl/module-type-HashedType/index.html new file mode 100644 index 00000000..bca3880e --- /dev/null +++ b/3.10/containers-data/CCPersistentHashtbl/module-type-HashedType/index.html @@ -0,0 +1,2 @@ + +HashedType (containers-data.CCPersistentHashtbl.HashedType)

Module type CCPersistentHashtbl.HashedType

type t
val equal : t -> t -> bool
val hash : t -> int
\ No newline at end of file diff --git a/3.10/containers-data/CCPersistentHashtbl/module-type-S/index.html b/3.10/containers-data/CCPersistentHashtbl/module-type-S/index.html new file mode 100644 index 00000000..5eef96e0 --- /dev/null +++ b/3.10/containers-data/CCPersistentHashtbl/module-type-S/index.html @@ -0,0 +1,13 @@ + +S (containers-data.CCPersistentHashtbl.S)

Module type CCPersistentHashtbl.S

type key
type 'a t
val empty : unit -> 'a t

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.

val is_empty : 'a t -> bool

Is the table empty?

val find : 'a t -> key -> 'a

Find the value for this key, or fails.

  • raises Not_found

    if the key is not present in the table.

val get_exn : key -> 'a t -> 'a

Synonym to find with flipped arguments.

val get : key -> 'a t -> 'a option

Safe version of get_exn.

val mem : 'a t -> key -> bool

Is the key bound?

val length : _ t -> int

Number of bindings.

val add : 'a t -> key -> 'a -> 'a t

Add the binding to the table, returning a new table. The old binding for this key, if it exists, is shadowed and will be restored upon remove tbl k.

  • since 0.14
val replace : 'a t -> key -> 'a -> 'a t

Add the binding to the table, returning a new table. This erases the current binding for key, if any.

val update : 'a t -> key -> ( 'a option -> 'a option ) -> 'a t

update tbl key f calls f None if key doesn't belong in tbl, f (Some v) if key -> v otherwise; If f returns None then key is removed, else it returns Some v' and key -> v' is added.

val remove : 'a t -> key -> 'a t

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.

val merge : + f:( key -> [ `Left of 'a | `Right of 'b | `Both of 'a * 'b ] -> 'c option ) -> + 'a t -> + 'b t -> + 'c t

Merge two tables together into a new table. The function's argument correspond to values associated with the key (if present); if the function returns None the key will not appear in the result.

val iter : 'a t -> ( key -> 'a -> unit ) -> unit

Iterate over bindings.

val fold : ( 'b -> key -> 'a -> 'b ) -> 'b -> 'a t -> 'b

Fold over bindings.

val map : ( key -> 'a -> 'b ) -> 'a t -> 'b t

Map all values.

val filter : ( key -> 'a -> bool ) -> 'a t -> 'a t
val filter_map : ( key -> 'a -> 'b option ) -> 'a t -> 'b t
val for_all : ( key -> 'a -> bool ) -> 'a t -> bool
val exists : ( key -> 'a -> bool ) -> 'a t -> bool

Conversions

val of_iter : (key * 'a) iter -> 'a t

Add (replace) bindings from the sequence to the table.

val of_list : (key * 'a) list -> 'a t
val add_iter : 'a t -> (key * 'a) iter -> 'a t
val add_list : 'a t -> (key * 'a) list -> 'a t
val to_iter : 'a t -> (key * 'a) iter

Iter of the bindings of the table.

val to_list : 'a t -> (key * 'a) list

Misc

val equal : 'a equal -> 'a t equal
val pp : + ?pp_start:unit printer -> + ?pp_stop:unit printer -> + ?pp_sep:unit printer -> + ?pp_arrow:unit printer -> + key printer -> + 'a printer -> + 'a t printer
val stats : _ t -> Stdlib.Hashtbl.statistics

Statistics on the internal table.

  • since 0.14
\ No newline at end of file diff --git a/3.10/containers-data/CCRAL/.dummy b/3.10/containers-data/CCRAL/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCRAL/Infix/index.html b/3.10/containers-data/CCRAL/Infix/index.html new file mode 100644 index 00000000..545d3da9 --- /dev/null +++ b/3.10/containers-data/CCRAL/Infix/index.html @@ -0,0 +1,2 @@ + +Infix (containers-data.CCRAL.Infix)

Module CCRAL.Infix

val (@+) : 'a -> 'a t -> 'a t

Cons (alias to cons).

val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t

Alias to flat_map.

val (>|=) : 'a t -> ( 'a -> 'b ) -> 'b t

Alias to map.

val (<*>) : ( 'a -> 'b ) t -> 'a t -> 'b t

Alias to app.

val (--) : int -> int -> int t

Alias to range.

val (--^) : int -> int -> int t

a --^ b is the integer range from a to b, where b is excluded.

  • since 0.17
\ No newline at end of file diff --git a/3.10/containers-data/CCRAL/index.html b/3.10/containers-data/CCRAL/index.html new file mode 100644 index 00000000..eaca80dd --- /dev/null +++ b/3.10/containers-data/CCRAL/index.html @@ -0,0 +1,2 @@ + +CCRAL (containers-data.CCRAL)

Module CCRAL

Random-Access Lists

This is an OCaml implementation of Okasaki's paper "Purely Functional Random Access Lists". It defines a list-like data structure with O(1) cons/tail operations, and O(log(n)) lookup/modification operations.

This module used to be part of containers.misc

status: stable

type +'a t

List containing elements of type 'a

val empty : 'a t

Empty list.

val is_empty : _ t -> bool

Check whether the list is empty.

val cons : 'a -> 'a t -> 'a t

Add an element at the front of the list.

val return : 'a -> 'a t

Singleton.

val map : f:( 'a -> 'b ) -> 'a t -> 'b t

Map on elements.

val mapi : f:( int -> 'a -> 'b ) -> 'a t -> 'b t

Map with index.

val hd : 'a t -> 'a

First element of the list, or

  • raises Invalid_argument

    if the list is empty.

val tl : 'a t -> 'a t

Remove the first element from the list, or

  • raises Invalid_argument

    if the list is empty.

val front : 'a t -> ('a * 'a t) option

Remove and return the first element of the list.

val front_exn : 'a t -> 'a * 'a t

Unsafe version of front.

  • raises Invalid_argument

    if the list is empty.

val length : 'a t -> int

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)).

val get_exn : 'a t -> int -> 'a

Unsafe version of get.

  • raises 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)).

  • raises Invalid_argument

    if the list has less than i+1 elements.

val remove : 'a t -> int -> 'a t

remove l i removes the i-th element of l.

  • raises Invalid_argument

    if the list has less than i+1 elements.

val get_and_remove_exn : 'a t -> int -> 'a * 'a t

get_and_remove_exn l i accesses and removes the i-th element of l.

  • raises Invalid_argument

    if the list has less than i+1 elements.

val append : 'a t -> 'a t -> 'a t
val filter : f:( 'a -> bool ) -> 'a t -> 'a t
val filter_map : f:( 'a -> 'b option ) -> 'a t -> 'b t
val flat_map : ( 'a -> 'b t ) -> 'a t -> 'b t
val flatten : 'a t t -> 'a t
val app : ( 'a -> 'b ) t -> 'a t -> 'b t
val take : int -> 'a t -> 'a t
val take_while : f:( 'a -> bool ) -> 'a t -> 'a t
val drop : int -> 'a t -> 'a t
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.

val iter : f:( 'a -> unit ) -> 'a t -> unit

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.

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).

val rev_map : f:( 'a -> 'b ) -> 'a t -> 'b t

rev_map f l is the same as map f (rev l).

val rev : 'a t -> 'a t

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.

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.

val range : int -> int -> int t

range i j is i; i+1; ... ; j or j; j-1; ...; i.

Conversions

type 'a iter = ( 'a -> unit ) -> unit
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. 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.

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.

val add_iter : 'a t -> 'a iter -> 'a t
val of_iter : 'a iter -> 'a t
val to_iter : 'a t -> 'a iter
val add_gen : 'a t -> 'a gen -> 'a t
val of_gen : 'a gen -> 'a t
val to_gen : 'a t -> 'a gen

Infix

module Infix : sig ... end
include module type of Infix
val (@+) : 'a -> 'a t -> 'a t

Cons (alias to cons).

val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t

Alias to flat_map.

val (>|=) : 'a t -> ( 'a -> 'b ) -> 'b t

Alias to map.

val (<*>) : ( 'a -> 'b ) t -> 'a t -> 'b t

Alias to app.

val (--) : int -> int -> int t

Alias to range.

val (--^) : int -> int -> int t

a --^ b is the integer range from a to b, where b is excluded.

  • since 0.17

IO

type 'a printer = Stdlib.Format.formatter -> 'a -> unit
val pp : ?pp_sep:unit printer -> 'a printer -> 'a t printer
\ No newline at end of file diff --git a/3.10/containers-data/CCRingBuffer/.dummy b/3.10/containers-data/CCRingBuffer/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCRingBuffer/Array/Byte/index.html b/3.10/containers-data/CCRingBuffer/Array/Byte/index.html new file mode 100644 index 00000000..4d294348 --- /dev/null +++ b/3.10/containers-data/CCRingBuffer/Array/Byte/index.html @@ -0,0 +1,2 @@ + +Byte (containers-data.CCRingBuffer.Array.Byte)

Module Array.Byte

Efficient array version for the char type

type elt = char

The element type

type t = Stdlib.Bytes.t

The type of an array instance

val dummy : elt

A dummy element used for empty slots in the array

  • since 2.4
val create : int -> t

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.

val get : t -> int -> elt

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.

val sub : t -> int -> int -> t

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.

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.

val iter : ( elt -> unit ) -> t -> unit

iter f t iterates over the array t invoking f with the current element, in array order.

\ No newline at end of file diff --git a/3.10/containers-data/CCRingBuffer/Array/Make/argument-1-Elt/index.html b/3.10/containers-data/CCRingBuffer/Array/Make/argument-1-Elt/index.html new file mode 100644 index 00000000..e25de7fc --- /dev/null +++ b/3.10/containers-data/CCRingBuffer/Array/Make/argument-1-Elt/index.html @@ -0,0 +1,2 @@ + +Elt (containers-data.CCRingBuffer.Array.Make.1-Elt)

Parameter Make.1-Elt

type t
val dummy : t
\ No newline at end of file diff --git a/3.10/containers-data/CCRingBuffer/Array/Make/index.html b/3.10/containers-data/CCRingBuffer/Array/Make/index.html new file mode 100644 index 00000000..53f9a154 --- /dev/null +++ b/3.10/containers-data/CCRingBuffer/Array/Make/index.html @@ -0,0 +1,2 @@ + +Make (containers-data.CCRingBuffer.Array.Make)

Module Array.Make

Makes an array given an arbitrary element type

Parameters

module Elt : sig ... end

Signature

type elt = Elt.t

The element type

type t = Elt.t array

The type of an array instance

val dummy : elt

A dummy element used for empty slots in the array

  • since 2.4
val create : int -> t

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.

val get : t -> int -> elt

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.

val sub : t -> int -> int -> t

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.

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.

val iter : ( elt -> unit ) -> t -> unit

iter f t iterates over the array t invoking f with the current element, in array order.

\ No newline at end of file diff --git a/3.10/containers-data/CCRingBuffer/Array/index.html b/3.10/containers-data/CCRingBuffer/Array/index.html new file mode 100644 index 00000000..aefbddad --- /dev/null +++ b/3.10/containers-data/CCRingBuffer/Array/index.html @@ -0,0 +1,4 @@ + +Array (containers-data.CCRingBuffer.Array)

Module CCRingBuffer.Array

The abstract type for arrays

module type S = sig ... end
module Byte : S with type elt = char and type t = Stdlib.Bytes.t

Efficient array version for the char type

module Make + (Elt : sig ... end) : + S with type elt = Elt.t and type t = Elt.t array

Makes an array given an arbitrary element type

\ No newline at end of file diff --git a/3.10/containers-data/CCRingBuffer/Array/module-type-S/index.html b/3.10/containers-data/CCRingBuffer/Array/module-type-S/index.html new file mode 100644 index 00000000..901de18f --- /dev/null +++ b/3.10/containers-data/CCRingBuffer/Array/module-type-S/index.html @@ -0,0 +1,2 @@ + +S (containers-data.CCRingBuffer.Array.S)

Module type Array.S

type elt

The element type

type t

The type of an array instance

val dummy : elt

A dummy element used for empty slots in the array

  • since 2.4
val create : int -> t

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.

val get : t -> int -> elt

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.

val sub : t -> int -> int -> t

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.

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.

val iter : ( elt -> unit ) -> t -> unit

iter f t iterates over the array t invoking f with the current element, in array order.

\ No newline at end of file diff --git a/3.10/containers-data/CCRingBuffer/Byte/index.html b/3.10/containers-data/CCRingBuffer/Byte/index.html new file mode 100644 index 00000000..61c6f76e --- /dev/null +++ b/3.10/containers-data/CCRingBuffer/Byte/index.html @@ -0,0 +1,2 @@ + +Byte (containers-data.CCRingBuffer.Byte)

Module CCRingBuffer.Byte

An efficient byte based ring buffer

module Array = Array.Byte

The module type of Array for this ring buffer

type t

Defines the bounded ring buffer type

exception Empty

Raised in querying functions when the buffer is empty

val create : int -> t

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.

  • raises Invalid_argument

    if the argument is < 1.

val copy : t -> t

Make a fresh copy of the buffer.

val capacity : t -> int

Length of the inner buffer.

val length : t -> int

Number of elements currently stored in the buffer.

val is_full : t -> bool

true if pushing an element would erase another element.

  • since 1.3
val blit_from : t -> Array.t -> int -> int -> unit

blit_from buf from_buf o len copies the slice o, ... o + len - 1 from an 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.

  • raises 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 into to_buf starting at offset o in s.

  • returns

    the number of elements actually copied (min len (length buf)).

  • raises Invalid_argument

    if o,len is not a valid slice of s.

val append : t -> into:t -> unit

append b ~into copies all data from b and adds it at the 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.

val clear : t -> unit

Clear the content of the buffer

val is_empty : t -> bool

Is the buffer empty (i.e. contains no elements)?

val junk_front : t -> unit

Drop the front element from t.

  • raises Empty

    if the buffer is already empty.

val junk_back : t -> unit

Drop the back element from t.

  • raises Empty

    if the buffer is already empty.

val skip : t -> int -> unit

skip b len removes len elements from the front of b.

  • raises 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.

val iteri : t -> f:( int -> Array.elt -> unit ) -> unit

iteri b ~f calls f i t for each element t in buf, with i being its relative index within buf.

val get_front : t -> int -> Array.elt

get_front buf i returns the i-th element of buf from the front, i.e. the one returned by take_front buf after i-1 calls to junk_front buf.

  • raises 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, i.e. the one returned by take_back buf after i-1 calls to junk_back buf.

  • raises Invalid_argument

    if the index is invalid (> length buf).

val push_back : t -> Array.elt -> unit

Push value at the back of t. If t.bounded=false, the buffer will grow as needed, otherwise the oldest elements are replaced first.

val peek_front : t -> Array.elt option

First value from front of t, without modification.

val peek_front_exn : t -> Array.elt

First value from front of t, without modification.

  • raises Empty

    if buffer is empty.

  • since 1.3
val peek_back : t -> Array.elt option

Get the last value from back of t, without modification.

val peek_back_exn : t -> Array.elt

Get the last value from back of t, without modification.

  • raises Empty

    if buffer is empty.

  • since 1.3
val take_back : t -> Array.elt option

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.

  • raises 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.

val take_front_exn : t -> Array.elt

Take and remove the first value from front of t.

  • raises Empty

    if buffer is already empty.

val of_array : Array.t -> t

Create a buffer from an initial array, but doesn't take ownership of it (still allocates a new internal array).

  • since 0.11
val to_array : t -> Array.t

Create an array from the elements, in order.

  • since 0.11
\ No newline at end of file diff --git a/3.10/containers-data/CCRingBuffer/Make/Array/index.html b/3.10/containers-data/CCRingBuffer/Make/Array/index.html new file mode 100644 index 00000000..07f29914 --- /dev/null +++ b/3.10/containers-data/CCRingBuffer/Make/Array/index.html @@ -0,0 +1,2 @@ + +Array (containers-data.CCRingBuffer.Make.Array)

Module Make.Array

The module type of Array for this ring buffer

type elt = X.t

The element type

type t = X.t array

The type of an array instance

val dummy : elt

A dummy element used for empty slots in the array

  • since 2.4
val create : int -> t

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.

val get : t -> int -> elt

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.

val sub : t -> int -> int -> t

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.

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.

val iter : ( elt -> unit ) -> t -> unit

iter f t iterates over the array t invoking f with the current element, in array order.

\ No newline at end of file diff --git a/3.10/containers-data/CCRingBuffer/Make/argument-1-X/index.html b/3.10/containers-data/CCRingBuffer/Make/argument-1-X/index.html new file mode 100644 index 00000000..671817ca --- /dev/null +++ b/3.10/containers-data/CCRingBuffer/Make/argument-1-X/index.html @@ -0,0 +1,2 @@ + +X (containers-data.CCRingBuffer.Make.1-X)

Parameter Make.1-X

type t
val dummy : t
\ No newline at end of file diff --git a/3.10/containers-data/CCRingBuffer/Make/index.html b/3.10/containers-data/CCRingBuffer/Make/index.html new file mode 100644 index 00000000..6c33503c --- /dev/null +++ b/3.10/containers-data/CCRingBuffer/Make/index.html @@ -0,0 +1,2 @@ + +Make (containers-data.CCRingBuffer.Make)

Module CCRingBuffer.Make

Buffer using regular arrays

Parameters

module X : sig ... end

Signature

module Array : Array.S with type elt = X.t with type t = X.t array

The module type of Array for this ring buffer

type t

Defines the bounded ring buffer type

exception Empty

Raised in querying functions when the buffer is empty

val create : int -> t

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.

  • raises Invalid_argument

    if the argument is < 1.

val copy : t -> t

Make a fresh copy of the buffer.

val capacity : t -> int

Length of the inner buffer.

val length : t -> int

Number of elements currently stored in the buffer.

val is_full : t -> bool

true if pushing an element would erase another element.

  • since 1.3
val blit_from : t -> Array.t -> int -> int -> unit

blit_from buf from_buf o len copies the slice o, ... o + len - 1 from an 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.

  • raises 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 into to_buf starting at offset o in s.

  • returns

    the number of elements actually copied (min len (length buf)).

  • raises Invalid_argument

    if o,len is not a valid slice of s.

val append : t -> into:t -> unit

append b ~into copies all data from b and adds it at the 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.

val clear : t -> unit

Clear the content of the buffer

val is_empty : t -> bool

Is the buffer empty (i.e. contains no elements)?

val junk_front : t -> unit

Drop the front element from t.

  • raises Empty

    if the buffer is already empty.

val junk_back : t -> unit

Drop the back element from t.

  • raises Empty

    if the buffer is already empty.

val skip : t -> int -> unit

skip b len removes len elements from the front of b.

  • raises 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.

val iteri : t -> f:( int -> Array.elt -> unit ) -> unit

iteri b ~f calls f i t for each element t in buf, with i being its relative index within buf.

val get_front : t -> int -> Array.elt

get_front buf i returns the i-th element of buf from the front, i.e. the one returned by take_front buf after i-1 calls to junk_front buf.

  • raises 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, i.e. the one returned by take_back buf after i-1 calls to junk_back buf.

  • raises Invalid_argument

    if the index is invalid (> length buf).

val push_back : t -> Array.elt -> unit

Push value at the back of t. If t.bounded=false, the buffer will grow as needed, otherwise the oldest elements are replaced first.

val peek_front : t -> Array.elt option

First value from front of t, without modification.

val peek_front_exn : t -> Array.elt

First value from front of t, without modification.

  • raises Empty

    if buffer is empty.

  • since 1.3
val peek_back : t -> Array.elt option

Get the last value from back of t, without modification.

val peek_back_exn : t -> Array.elt

Get the last value from back of t, without modification.

  • raises Empty

    if buffer is empty.

  • since 1.3
val take_back : t -> Array.elt option

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.

  • raises 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.

val take_front_exn : t -> Array.elt

Take and remove the first value from front of t.

  • raises Empty

    if buffer is already empty.

val of_array : Array.t -> t

Create a buffer from an initial array, but doesn't take ownership of it (still allocates a new internal array).

  • since 0.11
val to_array : t -> Array.t

Create an array from the elements, in order.

  • since 0.11
\ No newline at end of file diff --git a/3.10/containers-data/CCRingBuffer/MakeFromArray/argument-1-A/index.html b/3.10/containers-data/CCRingBuffer/MakeFromArray/argument-1-A/index.html new file mode 100644 index 00000000..6210e9c1 --- /dev/null +++ b/3.10/containers-data/CCRingBuffer/MakeFromArray/argument-1-A/index.html @@ -0,0 +1,2 @@ + +A (containers-data.CCRingBuffer.MakeFromArray.1-A)

Parameter MakeFromArray.1-A

type elt

The element type

type t

The type of an array instance

val dummy : elt

A dummy element used for empty slots in the array

  • since 2.4
val create : int -> t

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.

val get : t -> int -> elt

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.

val sub : t -> int -> int -> t

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.

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.

val iter : ( elt -> unit ) -> t -> unit

iter f t iterates over the array t invoking f with the current element, in array order.

\ No newline at end of file diff --git a/3.10/containers-data/CCRingBuffer/MakeFromArray/index.html b/3.10/containers-data/CCRingBuffer/MakeFromArray/index.html new file mode 100644 index 00000000..20e63b81 --- /dev/null +++ b/3.10/containers-data/CCRingBuffer/MakeFromArray/index.html @@ -0,0 +1,2 @@ + +MakeFromArray (containers-data.CCRingBuffer.MakeFromArray)

Module CCRingBuffer.MakeFromArray

Makes a ring buffer module with the given array type

Parameters

module A : Array.S

Signature

module Array = A

The module type of Array for this ring buffer

type t

Defines the bounded ring buffer type

exception Empty

Raised in querying functions when the buffer is empty

val create : int -> t

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.

  • raises Invalid_argument

    if the argument is < 1.

val copy : t -> t

Make a fresh copy of the buffer.

val capacity : t -> int

Length of the inner buffer.

val length : t -> int

Number of elements currently stored in the buffer.

val is_full : t -> bool

true if pushing an element would erase another element.

  • since 1.3
val blit_from : t -> Array.t -> int -> int -> unit

blit_from buf from_buf o len copies the slice o, ... o + len - 1 from an 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.

  • raises 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 into to_buf starting at offset o in s.

  • returns

    the number of elements actually copied (min len (length buf)).

  • raises Invalid_argument

    if o,len is not a valid slice of s.

val append : t -> into:t -> unit

append b ~into copies all data from b and adds it at the 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.

val clear : t -> unit

Clear the content of the buffer

val is_empty : t -> bool

Is the buffer empty (i.e. contains no elements)?

val junk_front : t -> unit

Drop the front element from t.

  • raises Empty

    if the buffer is already empty.

val junk_back : t -> unit

Drop the back element from t.

  • raises Empty

    if the buffer is already empty.

val skip : t -> int -> unit

skip b len removes len elements from the front of b.

  • raises 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.

val iteri : t -> f:( int -> Array.elt -> unit ) -> unit

iteri b ~f calls f i t for each element t in buf, with i being its relative index within buf.

val get_front : t -> int -> Array.elt

get_front buf i returns the i-th element of buf from the front, i.e. the one returned by take_front buf after i-1 calls to junk_front buf.

  • raises 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, i.e. the one returned by take_back buf after i-1 calls to junk_back buf.

  • raises Invalid_argument

    if the index is invalid (> length buf).

val push_back : t -> Array.elt -> unit

Push value at the back of t. If t.bounded=false, the buffer will grow as needed, otherwise the oldest elements are replaced first.

val peek_front : t -> Array.elt option

First value from front of t, without modification.

val peek_front_exn : t -> Array.elt

First value from front of t, without modification.

  • raises Empty

    if buffer is empty.

  • since 1.3
val peek_back : t -> Array.elt option

Get the last value from back of t, without modification.

val peek_back_exn : t -> Array.elt

Get the last value from back of t, without modification.

  • raises Empty

    if buffer is empty.

  • since 1.3
val take_back : t -> Array.elt option

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.

  • raises 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.

val take_front_exn : t -> Array.elt

Take and remove the first value from front of t.

  • raises Empty

    if buffer is already empty.

val of_array : Array.t -> t

Create a buffer from an initial array, but doesn't take ownership of it (still allocates a new internal array).

  • since 0.11
val to_array : t -> Array.t

Create an array from the elements, in order.

  • since 0.11
\ No newline at end of file diff --git a/3.10/containers-data/CCRingBuffer/index.html b/3.10/containers-data/CCRingBuffer/index.html new file mode 100644 index 00000000..57842b6b --- /dev/null +++ b/3.10/containers-data/CCRingBuffer/index.html @@ -0,0 +1,4 @@ + +CCRingBuffer (containers-data.CCRingBuffer)

Module CCRingBuffer

Circular Buffer (Deque)

Useful for IO, or as a bounded-size alternative to Queue when batch operations are needed.

status: experimental

Change in the API to provide only a bounded buffer since 1.3

Underlying Array

module Array : sig ... end

The abstract type for arrays

module type S = sig ... end
module Byte : S with module Array = Array.Byte

An efficient byte based ring buffer

module MakeFromArray (A : Array.S) : S with module Array = A

Makes a ring buffer module with the given array type

module Make + (X : sig ... end) : + S with type Array.elt = X.t and type Array.t = X.t array

Buffer using regular arrays

\ No newline at end of file diff --git a/3.10/containers-data/CCRingBuffer/module-type-S/Array/index.html b/3.10/containers-data/CCRingBuffer/module-type-S/Array/index.html new file mode 100644 index 00000000..8566ef34 --- /dev/null +++ b/3.10/containers-data/CCRingBuffer/module-type-S/Array/index.html @@ -0,0 +1,2 @@ + +Array (containers-data.CCRingBuffer.S.Array)

Module S.Array

The module type of Array for this ring buffer

type elt

The element type

type t

The type of an array instance

val dummy : elt

A dummy element used for empty slots in the array

  • since 2.4
val create : int -> t

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.

val get : t -> int -> elt

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.

val sub : t -> int -> int -> t

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.

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.

val iter : ( elt -> unit ) -> t -> unit

iter f t iterates over the array t invoking f with the current element, in array order.

\ No newline at end of file diff --git a/3.10/containers-data/CCRingBuffer/module-type-S/index.html b/3.10/containers-data/CCRingBuffer/module-type-S/index.html new file mode 100644 index 00000000..bdfeb554 --- /dev/null +++ b/3.10/containers-data/CCRingBuffer/module-type-S/index.html @@ -0,0 +1,2 @@ + +S (containers-data.CCRingBuffer.S)

Module type CCRingBuffer.S

Ring Buffer

The abstract ring buffer type, made concrete by choice of ARRAY module implementation

module Array : Array.S

The module type of Array for this ring buffer

type t

Defines the bounded ring buffer type

exception Empty

Raised in querying functions when the buffer is empty

val create : int -> t

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.

  • raises Invalid_argument

    if the argument is < 1.

val copy : t -> t

Make a fresh copy of the buffer.

val capacity : t -> int

Length of the inner buffer.

val length : t -> int

Number of elements currently stored in the buffer.

val is_full : t -> bool

true if pushing an element would erase another element.

  • since 1.3
val blit_from : t -> Array.t -> int -> int -> unit

blit_from buf from_buf o len copies the slice o, ... o + len - 1 from an 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.

  • raises 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 into to_buf starting at offset o in s.

  • returns

    the number of elements actually copied (min len (length buf)).

  • raises Invalid_argument

    if o,len is not a valid slice of s.

val append : t -> into:t -> unit

append b ~into copies all data from b and adds it at the 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.

val clear : t -> unit

Clear the content of the buffer

val is_empty : t -> bool

Is the buffer empty (i.e. contains no elements)?

val junk_front : t -> unit

Drop the front element from t.

  • raises Empty

    if the buffer is already empty.

val junk_back : t -> unit

Drop the back element from t.

  • raises Empty

    if the buffer is already empty.

val skip : t -> int -> unit

skip b len removes len elements from the front of b.

  • raises 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.

val iteri : t -> f:( int -> Array.elt -> unit ) -> unit

iteri b ~f calls f i t for each element t in buf, with i being its relative index within buf.

val get_front : t -> int -> Array.elt

get_front buf i returns the i-th element of buf from the front, i.e. the one returned by take_front buf after i-1 calls to junk_front buf.

  • raises 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, i.e. the one returned by take_back buf after i-1 calls to junk_back buf.

  • raises Invalid_argument

    if the index is invalid (> length buf).

val push_back : t -> Array.elt -> unit

Push value at the back of t. If t.bounded=false, the buffer will grow as needed, otherwise the oldest elements are replaced first.

val peek_front : t -> Array.elt option

First value from front of t, without modification.

val peek_front_exn : t -> Array.elt

First value from front of t, without modification.

  • raises Empty

    if buffer is empty.

  • since 1.3
val peek_back : t -> Array.elt option

Get the last value from back of t, without modification.

val peek_back_exn : t -> Array.elt

Get the last value from back of t, without modification.

  • raises Empty

    if buffer is empty.

  • since 1.3
val take_back : t -> Array.elt option

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.

  • raises 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.

val take_front_exn : t -> Array.elt

Take and remove the first value from front of t.

  • raises Empty

    if buffer is already empty.

val of_array : Array.t -> t

Create a buffer from an initial array, but doesn't take ownership of it (still allocates a new internal array).

  • since 0.11
val to_array : t -> Array.t

Create an array from the elements, in order.

  • since 0.11
\ No newline at end of file diff --git a/3.10/containers-data/CCSimple_queue/.dummy b/3.10/containers-data/CCSimple_queue/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCSimple_queue/Infix/index.html b/3.10/containers-data/CCSimple_queue/Infix/index.html new file mode 100644 index 00000000..30e4f365 --- /dev/null +++ b/3.10/containers-data/CCSimple_queue/Infix/index.html @@ -0,0 +1,2 @@ + +Infix (containers-data.CCSimple_queue.Infix)

Module CCSimple_queue.Infix

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.

\ No newline at end of file diff --git a/3.10/containers-data/CCSimple_queue/index.html b/3.10/containers-data/CCSimple_queue/index.html new file mode 100644 index 00000000..dcacd281 --- /dev/null +++ b/3.10/containers-data/CCSimple_queue/index.html @@ -0,0 +1,2 @@ + +CCSimple_queue (containers-data.CCSimple_queue)

Module CCSimple_queue

Functional queues (fifo)

Simple implementation of functional queues

type 'a iter = ( 'a -> unit ) -> unit

Fast internal iterator.

  • since 2.8
type 'a printer = Stdlib.Format.formatter -> 'a -> unit
type 'a gen = unit -> 'a option
type +'a t

Queue containing elements of type 'a

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.

val snoc : 'a t -> 'a -> 'a t

Flip version of push.

val peek : 'a t -> 'a option

First element of the queue.

val peek_exn : 'a t -> 'a

Same as peek but

  • raises Invalid_argument

    if the queue is empty.

val pop : 'a t -> ('a * 'a t) option

Get and remove the first element.

val pop_exn : 'a t -> 'a * 'a t

Same as pop, but fails on empty queues.

  • raises Invalid_argument

    if the queue is empty.

val junk : 'a t -> 'a t

Remove first element. If the queue is empty, do nothing.

val append : 'a t -> 'a t -> 'a t

Append two queues. Elements from the second one come after elements of the first one. Linear in the size of the second queue.

val map : ( 'a -> 'b ) -> 'a t -> 'b t

Map values.

val rev : 'a t -> 'a t

Reverse the queue. Constant time.

val equal : ( 'a -> 'a -> bool ) -> 'a t -> 'a t -> bool
module Infix : sig ... end
include module type of Infix
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 length : 'a t -> int

Number of elements in the queue (linear in time).

val fold : ( 'b -> 'a -> 'b ) -> 'b -> 'a t -> 'b
val iter : ( 'a -> unit ) -> 'a t -> unit
val to_list : 'a t -> 'a list
val add_list : 'a t -> 'a list -> 'a t
val of_list : 'a list -> 'a t
val to_iter : 'a t -> 'a iter
val add_iter : 'a t -> 'a iter -> 'a t
val of_iter : 'a iter -> 'a t
val to_seq : 'a t -> 'a Stdlib.Seq.t

Renamed from to_std_seq since 3.0.

  • since 3.0
val add_seq : 'a t -> 'a Stdlib.Seq.t -> 'a t

Renamed from add_std_seq since 3.0.

  • since 3.0
val of_seq : 'a Stdlib.Seq.t -> 'a t

Renamed from of_std_seq since 3.0.

  • since 3.0
val of_gen : 'a gen -> 'a t
val add_gen : 'a t -> 'a gen -> 'a t
val to_gen : 'a t -> 'a gen

IO

val pp : ?sep:unit printer -> 'a printer -> 'a t printer
\ No newline at end of file diff --git a/3.10/containers-data/CCTrie/.dummy b/3.10/containers-data/CCTrie/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCTrie/Make/argument-1-W/index.html b/3.10/containers-data/CCTrie/Make/argument-1-W/index.html new file mode 100644 index 00000000..323ba129 --- /dev/null +++ b/3.10/containers-data/CCTrie/Make/argument-1-W/index.html @@ -0,0 +1,2 @@ + +W (containers-data.CCTrie.Make.1-W)

Parameter Make.1-W

type t
type char_
val compare : char_ -> char_ -> int
val to_iter : t -> char_ iter
val of_list : char_ list -> t
\ No newline at end of file diff --git a/3.10/containers-data/CCTrie/Make/index.html b/3.10/containers-data/CCTrie/Make/index.html new file mode 100644 index 00000000..a1bac417 --- /dev/null +++ b/3.10/containers-data/CCTrie/Make/index.html @@ -0,0 +1,2 @@ + +Make (containers-data.CCTrie.Make)

Module CCTrie.Make

Parameters

module W : WORD

Signature

type char_ = W.char_
type key = W.t
type 'a t
val empty : 'a t
val is_empty : _ t -> bool
val add : key -> 'a -> 'a t -> 'a t

Add a binding to the trie (possibly erasing the previous one).

val remove : key -> 'a t -> 'a t

Remove the key, if present.

val find : key -> 'a t -> 'a option

Find the value associated with the key, if any.

val find_exn : key -> 'a t -> 'a

Same as find but can fail.

  • raises 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 at least one path in m (it does not mean that the prefix is bound to a value.

Example: if m has keys "abc0" and "abcd", then longest_prefix "abc2" m will return "abc".

  • since 0.17
val update : key -> ( 'a option -> 'a option ) -> 'a t -> 'a t

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.

val fold : ( 'b -> key -> 'a -> 'b ) -> 'b -> 'a t -> 'b

Fold on key/value bindings. Will use WORD.of_list to rebuild keys.

val mapi : ( key -> 'a -> 'b ) -> 'a t -> 'b t

Map values, giving both key and value. Will use WORD.of_list to rebuild keys.

  • since 0.17
val map : ( 'a -> 'b ) -> 'a t -> 'b t

Map values, giving only the value.

  • since 0.17
val iter : ( key -> 'a -> unit ) -> 'a t -> unit

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.

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.

val size : _ t -> int

Number of bindings.

Conversions
val to_list : 'a t -> (key * 'a) list
val of_list : (key * 'a) list -> 'a t
val to_iter : 'a t -> (key * 'a) iter
val of_iter : (key * 'a) iter -> 'a t
val to_iter_values : 'a t -> 'a iter
val to_tree : 'a t -> [ `Char of char_ | `Val of 'a | `Switch ] ktree
Ranges
val above : key -> 'a t -> (key * 'a) iter

All bindings whose key is bigger or equal to the given key, in ascending order.

val below : key -> 'a t -> (key * 'a) iter

All bindings whose key is smaller or equal to the given key, in decreasing order.

\ No newline at end of file diff --git a/3.10/containers-data/CCTrie/MakeArray/argument-1-X/index.html b/3.10/containers-data/CCTrie/MakeArray/argument-1-X/index.html new file mode 100644 index 00000000..c3049047 --- /dev/null +++ b/3.10/containers-data/CCTrie/MakeArray/argument-1-X/index.html @@ -0,0 +1,2 @@ + +X (containers-data.CCTrie.MakeArray.1-X)

Parameter MakeArray.1-X

type t
val compare : t -> t -> int
\ No newline at end of file diff --git a/3.10/containers-data/CCTrie/MakeArray/index.html b/3.10/containers-data/CCTrie/MakeArray/index.html new file mode 100644 index 00000000..0a4355d3 --- /dev/null +++ b/3.10/containers-data/CCTrie/MakeArray/index.html @@ -0,0 +1,2 @@ + +MakeArray (containers-data.CCTrie.MakeArray)

Module CCTrie.MakeArray

Parameters

module X : ORDERED

Signature

type char_ = X.t
type key = X.t array
type 'a t
val empty : 'a t
val is_empty : _ t -> bool
val add : key -> 'a -> 'a t -> 'a t

Add a binding to the trie (possibly erasing the previous one).

val remove : key -> 'a t -> 'a t

Remove the key, if present.

val find : key -> 'a t -> 'a option

Find the value associated with the key, if any.

val find_exn : key -> 'a t -> 'a

Same as find but can fail.

  • raises 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 at least one path in m (it does not mean that the prefix is bound to a value.

Example: if m has keys "abc0" and "abcd", then longest_prefix "abc2" m will return "abc".

  • since 0.17
val update : key -> ( 'a option -> 'a option ) -> 'a t -> 'a t

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.

val fold : ( 'b -> key -> 'a -> 'b ) -> 'b -> 'a t -> 'b

Fold on key/value bindings. Will use WORD.of_list to rebuild keys.

val mapi : ( key -> 'a -> 'b ) -> 'a t -> 'b t

Map values, giving both key and value. Will use WORD.of_list to rebuild keys.

  • since 0.17
val map : ( 'a -> 'b ) -> 'a t -> 'b t

Map values, giving only the value.

  • since 0.17
val iter : ( key -> 'a -> unit ) -> 'a t -> unit

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.

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.

val size : _ t -> int

Number of bindings.

Conversions
val to_list : 'a t -> (key * 'a) list
val of_list : (key * 'a) list -> 'a t
val to_iter : 'a t -> (key * 'a) iter
val of_iter : (key * 'a) iter -> 'a t
val to_iter_values : 'a t -> 'a iter
val to_tree : 'a t -> [ `Char of char_ | `Val of 'a | `Switch ] ktree
Ranges
val above : key -> 'a t -> (key * 'a) iter

All bindings whose key is bigger or equal to the given key, in ascending order.

val below : key -> 'a t -> (key * 'a) iter

All bindings whose key is smaller or equal to the given key, in decreasing order.

\ No newline at end of file diff --git a/3.10/containers-data/CCTrie/MakeList/argument-1-X/index.html b/3.10/containers-data/CCTrie/MakeList/argument-1-X/index.html new file mode 100644 index 00000000..226a88b9 --- /dev/null +++ b/3.10/containers-data/CCTrie/MakeList/argument-1-X/index.html @@ -0,0 +1,2 @@ + +X (containers-data.CCTrie.MakeList.1-X)

Parameter MakeList.1-X

type t
val compare : t -> t -> int
\ No newline at end of file diff --git a/3.10/containers-data/CCTrie/MakeList/index.html b/3.10/containers-data/CCTrie/MakeList/index.html new file mode 100644 index 00000000..4180454e --- /dev/null +++ b/3.10/containers-data/CCTrie/MakeList/index.html @@ -0,0 +1,2 @@ + +MakeList (containers-data.CCTrie.MakeList)

Module CCTrie.MakeList

Parameters

module X : ORDERED

Signature

type char_ = X.t
type key = X.t list
type 'a t
val empty : 'a t
val is_empty : _ t -> bool
val add : key -> 'a -> 'a t -> 'a t

Add a binding to the trie (possibly erasing the previous one).

val remove : key -> 'a t -> 'a t

Remove the key, if present.

val find : key -> 'a t -> 'a option

Find the value associated with the key, if any.

val find_exn : key -> 'a t -> 'a

Same as find but can fail.

  • raises 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 at least one path in m (it does not mean that the prefix is bound to a value.

Example: if m has keys "abc0" and "abcd", then longest_prefix "abc2" m will return "abc".

  • since 0.17
val update : key -> ( 'a option -> 'a option ) -> 'a t -> 'a t

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.

val fold : ( 'b -> key -> 'a -> 'b ) -> 'b -> 'a t -> 'b

Fold on key/value bindings. Will use WORD.of_list to rebuild keys.

val mapi : ( key -> 'a -> 'b ) -> 'a t -> 'b t

Map values, giving both key and value. Will use WORD.of_list to rebuild keys.

  • since 0.17
val map : ( 'a -> 'b ) -> 'a t -> 'b t

Map values, giving only the value.

  • since 0.17
val iter : ( key -> 'a -> unit ) -> 'a t -> unit

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.

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.

val size : _ t -> int

Number of bindings.

Conversions
val to_list : 'a t -> (key * 'a) list
val of_list : (key * 'a) list -> 'a t
val to_iter : 'a t -> (key * 'a) iter
val of_iter : (key * 'a) iter -> 'a t
val to_iter_values : 'a t -> 'a iter
val to_tree : 'a t -> [ `Char of char_ | `Val of 'a | `Switch ] ktree
Ranges
val above : key -> 'a t -> (key * 'a) iter

All bindings whose key is bigger or equal to the given key, in ascending order.

val below : key -> 'a t -> (key * 'a) iter

All bindings whose key is smaller or equal to the given key, in decreasing order.

\ No newline at end of file diff --git a/3.10/containers-data/CCTrie/String/index.html b/3.10/containers-data/CCTrie/String/index.html new file mode 100644 index 00000000..1e7ba8d3 --- /dev/null +++ b/3.10/containers-data/CCTrie/String/index.html @@ -0,0 +1,2 @@ + +String (containers-data.CCTrie.String)

Module CCTrie.String

type char_ = char
type key = string
type 'a t
val empty : 'a t
val is_empty : _ t -> bool
val add : key -> 'a -> 'a t -> 'a t

Add a binding to the trie (possibly erasing the previous one).

val remove : key -> 'a t -> 'a t

Remove the key, if present.

val find : key -> 'a t -> 'a option

Find the value associated with the key, if any.

val find_exn : key -> 'a t -> 'a

Same as find but can fail.

  • raises 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 at least one path in m (it does not mean that the prefix is bound to a value.

Example: if m has keys "abc0" and "abcd", then longest_prefix "abc2" m will return "abc".

  • since 0.17
val update : key -> ( 'a option -> 'a option ) -> 'a t -> 'a t

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.

val fold : ( 'b -> key -> 'a -> 'b ) -> 'b -> 'a t -> 'b

Fold on key/value bindings. Will use WORD.of_list to rebuild keys.

val mapi : ( key -> 'a -> 'b ) -> 'a t -> 'b t

Map values, giving both key and value. Will use WORD.of_list to rebuild keys.

  • since 0.17
val map : ( 'a -> 'b ) -> 'a t -> 'b t

Map values, giving only the value.

  • since 0.17
val iter : ( key -> 'a -> unit ) -> 'a t -> unit

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.

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.

val size : _ t -> int

Number of bindings.

Conversions
val to_list : 'a t -> (key * 'a) list
val of_list : (key * 'a) list -> 'a t
val to_iter : 'a t -> (key * 'a) iter
val of_iter : (key * 'a) iter -> 'a t
val to_iter_values : 'a t -> 'a iter
val to_tree : 'a t -> [ `Char of char_ | `Val of 'a | `Switch ] ktree
Ranges
val above : key -> 'a t -> (key * 'a) iter

All bindings whose key is bigger or equal to the given key, in ascending order.

val below : key -> 'a t -> (key * 'a) iter

All bindings whose key is smaller or equal to the given key, in decreasing order.

\ No newline at end of file diff --git a/3.10/containers-data/CCTrie/index.html b/3.10/containers-data/CCTrie/index.html new file mode 100644 index 00000000..5a08592f --- /dev/null +++ b/3.10/containers-data/CCTrie/index.html @@ -0,0 +1,4 @@ + +CCTrie (containers-data.CCTrie)

Module CCTrie

Prefix Tree

type 'a iter = ( 'a -> unit ) -> unit
type 'a ktree = unit -> [ `Nil | `Node of 'a * 'a ktree list ]

Signatures

A Composite Word

Words are made of characters, who belong to a total order

module type WORD = sig ... end
module type S = sig ... end

Implementation

module Make (W : WORD) : S with type key = W.t and type char_ = W.char_
module type ORDERED = sig ... end
module MakeArray + (X : ORDERED) : + S with type key = X.t array and type char_ = X.t
module MakeList (X : ORDERED) : S with type key = X.t list and type char_ = X.t
module String : S with type key = string and type char_ = char
\ No newline at end of file diff --git a/3.10/containers-data/CCTrie/module-type-ORDERED/index.html b/3.10/containers-data/CCTrie/module-type-ORDERED/index.html new file mode 100644 index 00000000..e2110561 --- /dev/null +++ b/3.10/containers-data/CCTrie/module-type-ORDERED/index.html @@ -0,0 +1,2 @@ + +ORDERED (containers-data.CCTrie.ORDERED)

Module type CCTrie.ORDERED

type t
val compare : t -> t -> int
\ No newline at end of file diff --git a/3.10/containers-data/CCTrie/module-type-S/index.html b/3.10/containers-data/CCTrie/module-type-S/index.html new file mode 100644 index 00000000..146ffa82 --- /dev/null +++ b/3.10/containers-data/CCTrie/module-type-S/index.html @@ -0,0 +1,2 @@ + +S (containers-data.CCTrie.S)

Module type CCTrie.S

type char_
type key
type 'a t
val empty : 'a t
val is_empty : _ t -> bool
val add : key -> 'a -> 'a t -> 'a t

Add a binding to the trie (possibly erasing the previous one).

val remove : key -> 'a t -> 'a t

Remove the key, if present.

val find : key -> 'a t -> 'a option

Find the value associated with the key, if any.

val find_exn : key -> 'a t -> 'a

Same as find but can fail.

  • raises 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 at least one path in m (it does not mean that the prefix is bound to a value.

Example: if m has keys "abc0" and "abcd", then longest_prefix "abc2" m will return "abc".

  • since 0.17
val update : key -> ( 'a option -> 'a option ) -> 'a t -> 'a t

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.

val fold : ( 'b -> key -> 'a -> 'b ) -> 'b -> 'a t -> 'b

Fold on key/value bindings. Will use WORD.of_list to rebuild keys.

val mapi : ( key -> 'a -> 'b ) -> 'a t -> 'b t

Map values, giving both key and value. Will use WORD.of_list to rebuild keys.

  • since 0.17
val map : ( 'a -> 'b ) -> 'a t -> 'b t

Map values, giving only the value.

  • since 0.17
val iter : ( key -> 'a -> unit ) -> 'a t -> unit

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.

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.

val size : _ t -> int

Number of bindings.

Conversions
val to_list : 'a t -> (key * 'a) list
val of_list : (key * 'a) list -> 'a t
val to_iter : 'a t -> (key * 'a) iter
val of_iter : (key * 'a) iter -> 'a t
val to_iter_values : 'a t -> 'a iter
val to_tree : 'a t -> [ `Char of char_ | `Val of 'a | `Switch ] ktree
Ranges
val above : key -> 'a t -> (key * 'a) iter

All bindings whose key is bigger or equal to the given key, in ascending order.

val below : key -> 'a t -> (key * 'a) iter

All bindings whose key is smaller or equal to the given key, in decreasing order.

\ No newline at end of file diff --git a/3.10/containers-data/CCTrie/module-type-WORD/index.html b/3.10/containers-data/CCTrie/module-type-WORD/index.html new file mode 100644 index 00000000..339c4456 --- /dev/null +++ b/3.10/containers-data/CCTrie/module-type-WORD/index.html @@ -0,0 +1,2 @@ + +WORD (containers-data.CCTrie.WORD)

Module type CCTrie.WORD

type t
type char_
val compare : char_ -> char_ -> int
val to_iter : t -> char_ iter
val of_list : char_ list -> t
\ No newline at end of file diff --git a/3.10/containers-data/CCWBTree/.dummy b/3.10/containers-data/CCWBTree/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCWBTree/Make/argument-1-X/index.html b/3.10/containers-data/CCWBTree/Make/argument-1-X/index.html new file mode 100644 index 00000000..474b1ac5 --- /dev/null +++ b/3.10/containers-data/CCWBTree/Make/argument-1-X/index.html @@ -0,0 +1,2 @@ + +X (containers-data.CCWBTree.Make.1-X)

Parameter Make.1-X

type t
val compare : t -> t -> int
\ No newline at end of file diff --git a/3.10/containers-data/CCWBTree/Make/index.html b/3.10/containers-data/CCWBTree/Make/index.html new file mode 100644 index 00000000..017c071c --- /dev/null +++ b/3.10/containers-data/CCWBTree/Make/index.html @@ -0,0 +1,13 @@ + +Make (containers-data.CCWBTree.Make)

Module CCWBTree.Make

Parameters

module X : ORD

Signature

type key = X.t
type +'a t
val empty : 'a t
val is_empty : _ t -> bool
val singleton : key -> 'a -> 'a t
val mem : key -> _ t -> bool
val get : key -> 'a t -> 'a option
val get_exn : key -> 'a t -> 'a
  • raises 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)).

val nth_exn : int -> 'a t -> key * 'a
  • raises 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 of k in the sorted list of bindings of m. let (`At n) = get_rank k m in nth_exn n m = get m k should hold.

  • since 1.4
val add : key -> 'a -> 'a t -> 'a t
val remove : key -> 'a t -> 'a t
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.

val cardinal : _ t -> int
val weight : _ t -> int
val fold : f:( 'b -> key -> 'a -> 'b ) -> x:'b -> 'a t -> 'b
val mapi : f:( key -> 'a -> 'b ) -> 'a t -> 'b t

Map values, giving both key and value. Will use WORD.of_list to rebuild keys.

  • since 0.17
val map : f:( 'a -> 'b ) -> 'a t -> 'b t

Map values, giving only the value.

  • since 0.17
val iter : f:( key -> 'a -> unit ) -> 'a t -> unit
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.

val merge : + f:( key -> 'a option -> 'b option -> 'c option ) -> + 'a t -> + 'b t -> + 'c t

Like 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.

  • raises 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.

  • raises Not_found

    if the map is empty.

val choose : 'a t -> (key * 'a) option
val choose_exn : 'a t -> key * 'a
  • raises Not_found

    if the tree is empty.

val random_choose : Stdlib.Random.State.t -> 'a t -> key * 'a

Randomly choose a (key,value) pair within the tree, using weights as probability weights.

  • raises Not_found

    if the tree is empty.

val add_list : 'a t -> (key * 'a) list -> 'a t
val of_list : (key * 'a) list -> 'a t
val to_list : 'a t -> (key * 'a) list
val add_iter : 'a t -> (key * 'a) iter -> 'a t
val of_iter : (key * 'a) iter -> 'a t
val to_iter : 'a t -> (key * 'a) iter
val add_gen : 'a t -> (key * 'a) gen -> 'a t
val of_gen : (key * 'a) gen -> 'a t
val to_gen : 'a t -> (key * 'a) gen
val pp : + ?pp_start:unit printer -> + ?pp_stop:unit printer -> + ?pp_arrow:unit printer -> + ?pp_sep:unit printer -> + key printer -> + 'a printer -> + 'a t printer

Renamed from val print.

  • since 2.0
\ No newline at end of file diff --git a/3.10/containers-data/CCWBTree/MakeFull/argument-1-X/index.html b/3.10/containers-data/CCWBTree/MakeFull/argument-1-X/index.html new file mode 100644 index 00000000..d47a769e --- /dev/null +++ b/3.10/containers-data/CCWBTree/MakeFull/argument-1-X/index.html @@ -0,0 +1,2 @@ + +X (containers-data.CCWBTree.MakeFull.1-X)

Parameter MakeFull.1-X

include ORD
type t
val compare : t -> t -> int
val weight : t -> int
\ No newline at end of file diff --git a/3.10/containers-data/CCWBTree/MakeFull/index.html b/3.10/containers-data/CCWBTree/MakeFull/index.html new file mode 100644 index 00000000..9897b157 --- /dev/null +++ b/3.10/containers-data/CCWBTree/MakeFull/index.html @@ -0,0 +1,13 @@ + +MakeFull (containers-data.CCWBTree.MakeFull)

Module CCWBTree.MakeFull

Use the custom X.weight function

Parameters

module X : KEY

Signature

type key = X.t
type +'a t
val empty : 'a t
val is_empty : _ t -> bool
val singleton : key -> 'a -> 'a t
val mem : key -> _ t -> bool
val get : key -> 'a t -> 'a option
val get_exn : key -> 'a t -> 'a
  • raises 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)).

val nth_exn : int -> 'a t -> key * 'a
  • raises 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 of k in the sorted list of bindings of m. let (`At n) = get_rank k m in nth_exn n m = get m k should hold.

  • since 1.4
val add : key -> 'a -> 'a t -> 'a t
val remove : key -> 'a t -> 'a t
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.

val cardinal : _ t -> int
val weight : _ t -> int
val fold : f:( 'b -> key -> 'a -> 'b ) -> x:'b -> 'a t -> 'b
val mapi : f:( key -> 'a -> 'b ) -> 'a t -> 'b t

Map values, giving both key and value. Will use WORD.of_list to rebuild keys.

  • since 0.17
val map : f:( 'a -> 'b ) -> 'a t -> 'b t

Map values, giving only the value.

  • since 0.17
val iter : f:( key -> 'a -> unit ) -> 'a t -> unit
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.

val merge : + f:( key -> 'a option -> 'b option -> 'c option ) -> + 'a t -> + 'b t -> + 'c t

Like 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.

  • raises 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.

  • raises Not_found

    if the map is empty.

val choose : 'a t -> (key * 'a) option
val choose_exn : 'a t -> key * 'a
  • raises Not_found

    if the tree is empty.

val random_choose : Stdlib.Random.State.t -> 'a t -> key * 'a

Randomly choose a (key,value) pair within the tree, using weights as probability weights.

  • raises Not_found

    if the tree is empty.

val add_list : 'a t -> (key * 'a) list -> 'a t
val of_list : (key * 'a) list -> 'a t
val to_list : 'a t -> (key * 'a) list
val add_iter : 'a t -> (key * 'a) iter -> 'a t
val of_iter : (key * 'a) iter -> 'a t
val to_iter : 'a t -> (key * 'a) iter
val add_gen : 'a t -> (key * 'a) gen -> 'a t
val of_gen : (key * 'a) gen -> 'a t
val to_gen : 'a t -> (key * 'a) gen
val pp : + ?pp_start:unit printer -> + ?pp_stop:unit printer -> + ?pp_arrow:unit printer -> + ?pp_sep:unit printer -> + key printer -> + 'a printer -> + 'a t printer

Renamed from val print.

  • since 2.0
\ No newline at end of file diff --git a/3.10/containers-data/CCWBTree/index.html b/3.10/containers-data/CCWBTree/index.html new file mode 100644 index 00000000..4c937b69 --- /dev/null +++ b/3.10/containers-data/CCWBTree/index.html @@ -0,0 +1,2 @@ + +CCWBTree (containers-data.CCWBTree)

Module CCWBTree

Weight-Balanced Tree

status: experimental

type 'a iter = ( 'a -> unit ) -> unit
type 'a gen = unit -> 'a option
type 'a printer = Stdlib.Format.formatter -> 'a -> unit
module type ORD = sig ... end
module type KEY = sig ... end

Signature

module type S = sig ... end

Functor

module Make (X : ORD) : S with type key = X.t
module MakeFull (X : KEY) : S with type key = X.t

Use the custom X.weight function

\ No newline at end of file diff --git a/3.10/containers-data/CCWBTree/module-type-KEY/index.html b/3.10/containers-data/CCWBTree/module-type-KEY/index.html new file mode 100644 index 00000000..e23528a6 --- /dev/null +++ b/3.10/containers-data/CCWBTree/module-type-KEY/index.html @@ -0,0 +1,2 @@ + +KEY (containers-data.CCWBTree.KEY)

Module type CCWBTree.KEY

include ORD
type t
val compare : t -> t -> int
val weight : t -> int
\ No newline at end of file diff --git a/3.10/containers-data/CCWBTree/module-type-ORD/index.html b/3.10/containers-data/CCWBTree/module-type-ORD/index.html new file mode 100644 index 00000000..a70dfa4a --- /dev/null +++ b/3.10/containers-data/CCWBTree/module-type-ORD/index.html @@ -0,0 +1,2 @@ + +ORD (containers-data.CCWBTree.ORD)

Module type CCWBTree.ORD

type t
val compare : t -> t -> int
\ No newline at end of file diff --git a/3.10/containers-data/CCWBTree/module-type-S/index.html b/3.10/containers-data/CCWBTree/module-type-S/index.html new file mode 100644 index 00000000..83e1b79c --- /dev/null +++ b/3.10/containers-data/CCWBTree/module-type-S/index.html @@ -0,0 +1,13 @@ + +S (containers-data.CCWBTree.S)

Module type CCWBTree.S

type key
type +'a t
val empty : 'a t
val is_empty : _ t -> bool
val singleton : key -> 'a -> 'a t
val mem : key -> _ t -> bool
val get : key -> 'a t -> 'a option
val get_exn : key -> 'a t -> 'a
  • raises 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)).

val nth_exn : int -> 'a t -> key * 'a
  • raises 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 of k in the sorted list of bindings of m. let (`At n) = get_rank k m in nth_exn n m = get m k should hold.

  • since 1.4
val add : key -> 'a -> 'a t -> 'a t
val remove : key -> 'a t -> 'a t
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.

val cardinal : _ t -> int
val weight : _ t -> int
val fold : f:( 'b -> key -> 'a -> 'b ) -> x:'b -> 'a t -> 'b
val mapi : f:( key -> 'a -> 'b ) -> 'a t -> 'b t

Map values, giving both key and value. Will use WORD.of_list to rebuild keys.

  • since 0.17
val map : f:( 'a -> 'b ) -> 'a t -> 'b t

Map values, giving only the value.

  • since 0.17
val iter : f:( key -> 'a -> unit ) -> 'a t -> unit
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.

val merge : + f:( key -> 'a option -> 'b option -> 'c option ) -> + 'a t -> + 'b t -> + 'c t

Like 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.

  • raises 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.

  • raises Not_found

    if the map is empty.

val choose : 'a t -> (key * 'a) option
val choose_exn : 'a t -> key * 'a
  • raises Not_found

    if the tree is empty.

val random_choose : Stdlib.Random.State.t -> 'a t -> key * 'a

Randomly choose a (key,value) pair within the tree, using weights as probability weights.

  • raises Not_found

    if the tree is empty.

val add_list : 'a t -> (key * 'a) list -> 'a t
val of_list : (key * 'a) list -> 'a t
val to_list : 'a t -> (key * 'a) list
val add_iter : 'a t -> (key * 'a) iter -> 'a t
val of_iter : (key * 'a) iter -> 'a t
val to_iter : 'a t -> (key * 'a) iter
val add_gen : 'a t -> (key * 'a) gen -> 'a t
val of_gen : (key * 'a) gen -> 'a t
val to_gen : 'a t -> (key * 'a) gen
val pp : + ?pp_start:unit printer -> + ?pp_stop:unit printer -> + ?pp_arrow:unit printer -> + ?pp_sep:unit printer -> + key printer -> + 'a printer -> + 'a t printer

Renamed from val print.

  • since 2.0
\ No newline at end of file diff --git a/3.10/containers-data/CCZipper/.dummy b/3.10/containers-data/CCZipper/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/CCZipper/index.html b/3.10/containers-data/CCZipper/index.html new file mode 100644 index 00000000..2f905e7f --- /dev/null +++ b/3.10/containers-data/CCZipper/index.html @@ -0,0 +1,2 @@ + +CCZipper (containers-data.CCZipper)

Module CCZipper

List Zipper

type 'a t = 'a list * 'a list

The pair l, r represents the list List.rev_append l r, but with the focus on r

val empty : 'a t

Empty zipper.

val is_empty : _ t -> bool

Empty zipper? Returns true iff the two lists are empty.

val to_list : 'a t -> 'a list

Convert the zipper back to a list. to_list (l,r) is List.rev_append l r.

val to_rev_list : 'a t -> 'a list

Convert the zipper back to a reversed list. 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.

val left : 'a t -> 'a t

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

  • raises 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.

val right_exn : 'a t -> 'a t

Go to the right, or

  • raises 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.

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.

val remove : 'a t -> 'a t

remove l removes the current element, if any.

val is_focused : _ t -> bool

Is the zipper focused on some element? That is, will focused return a Some v?

val focused : 'a t -> 'a option

Return the focused element, if any. focused zip = Some _ iff empty zip = false.

val focused_exn : 'a t -> 'a

Return the focused element, or

  • raises 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).

val drop_after : 'a t -> 'a t

Drop every element on the "right" (calling right then will do nothing), keeping the focused element, if any.

val drop_after_and_focused : 'a t -> 'a t

Drop every element on the "right" (calling right then will do nothing), including the focused element if it is present.

\ No newline at end of file diff --git a/3.10/containers-data/Containers_data_top/.dummy b/3.10/containers-data/Containers_data_top/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-data/Containers_data_top/index.html b/3.10/containers-data/Containers_data_top/index.html new file mode 100644 index 00000000..a993de04 --- /dev/null +++ b/3.10/containers-data/Containers_data_top/index.html @@ -0,0 +1,2 @@ + +Containers_data_top (containers-data.Containers_data_top)

Module Containers_data_top

type 'a printer = Stdlib.Format.formatter -> 'a -> unit
val eval_exn : string -> bool
val install_printer : string -> unit
val install_printers : string list -> unit
\ No newline at end of file diff --git a/3.10/containers-data/index.html b/3.10/containers-data/index.html new file mode 100644 index 00000000..10000f15 --- /dev/null +++ b/3.10/containers-data/index.html @@ -0,0 +1,2 @@ + +index (containers-data.index)

containers-data index

Library containers-data

This library exposes the following toplevel modules:

Library containers-data.top

The entry point of this library is the module: Containers_data_top.

\ No newline at end of file diff --git a/3.10/containers-thread/CCBlockingQueue/.dummy b/3.10/containers-thread/CCBlockingQueue/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-thread/CCBlockingQueue/index.html b/3.10/containers-thread/CCBlockingQueue/index.html new file mode 100644 index 00000000..c221d8f1 --- /dev/null +++ b/3.10/containers-thread/CCBlockingQueue/index.html @@ -0,0 +1,2 @@ + +CCBlockingQueue (containers-thread.CCBlockingQueue)

Module CCBlockingQueue

Blocking Queue

This queue has a limited size. Pushing a value on the queue when it is full will block.

type 'a t

Safe-thread queue for values of type 'a

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.

  • raises Invalid_argument

    if n < 1.

val push : 'a t -> 'a -> unit

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.

val push_list : 'a t -> 'a list -> unit

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.

val try_take : 'a t -> 'a option

Take the first element if the queue is not empty, return None 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.

val peek : 'a t -> 'a option

peek q returns Some x if x is the first element of q, otherwise it returns None.

val size : _ t -> int

Number of elements currently in the queue.

val capacity : _ t -> int

Number of values the queue can hold.

\ No newline at end of file diff --git a/3.10/containers-thread/CCLock/.dummy b/3.10/containers-thread/CCLock/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-thread/CCLock/LockRef/index.html b/3.10/containers-thread/CCLock/LockRef/index.html new file mode 100644 index 00000000..58780373 --- /dev/null +++ b/3.10/containers-thread/CCLock/LockRef/index.html @@ -0,0 +1,2 @@ + +LockRef (containers-thread.CCLock.LockRef)

Module CCLock.LockRef

Type allowing to manipulate the lock as a reference.

type 'a t
val get : 'a t -> 'a
val set : 'a t -> 'a -> unit
val update : 'a t -> ( 'a -> 'a ) -> unit
\ No newline at end of file diff --git a/3.10/containers-thread/CCLock/index.html b/3.10/containers-thread/CCLock/index.html new file mode 100644 index 00000000..448a1893 --- /dev/null +++ b/3.10/containers-thread/CCLock/index.html @@ -0,0 +1,2 @@ + +CCLock (containers-thread.CCLock)

Module CCLock

Utils around Mutex

A value wrapped into a Mutex, for more safety.

type 'a t

A value surrounded with a lock

val create : 'a -> 'a t

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.

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.

  • since 0.22
module LockRef : sig ... end

Type allowing to manipulate the lock as a reference.

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.

  • since 0.13
val update : 'a t -> ( 'a -> 'a ) -> unit

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.

  • since 0.16
val mutex : _ t -> Mutex.t

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.

  • since 0.13
val incr : int t -> unit

Atomically increment the value.

  • since 0.13
val decr : int t -> unit

Atomically decrement the value.

  • since 0.13
val incr_then_get : int t -> int

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 returns its previous value.

  • since 0.16
val decr_then_get : int t -> int

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 returns its previous value.

  • since 0.16
val get_then_set : bool t -> bool

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 returns the old value.

  • since 0.16
\ No newline at end of file diff --git a/3.10/containers-thread/CCPool/.dummy b/3.10/containers-thread/CCPool/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-thread/CCPool/Make/Fut/Infix/index.html b/3.10/containers-thread/CCPool/Make/Fut/Infix/index.html new file mode 100644 index 00000000..813806d4 --- /dev/null +++ b/3.10/containers-thread/CCPool/Make/Fut/Infix/index.html @@ -0,0 +1,2 @@ + +Infix (containers-thread.CCPool.Make.Fut.Infix)

Module Fut.Infix

val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t
val (>>) : 'a t -> ( unit -> 'b t ) -> 'b t
val (>|=) : 'a t -> ( 'a -> 'b ) -> 'b t
val (<*>) : ( 'a -> 'b ) t -> 'a t -> 'b t

Let operators on OCaml >= 4.08.0, nothing otherwise

  • since 2.8
include CCShims_syntax.LET with type 'a t := 'a t
val let+ : 'a t -> ( 'a -> 'b ) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ( 'a -> 'b t ) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t
\ No newline at end of file diff --git a/3.10/containers-thread/CCPool/Make/Fut/index.html b/3.10/containers-thread/CCPool/Make/Fut/index.html new file mode 100644 index 00000000..469c5eff --- /dev/null +++ b/3.10/containers-thread/CCPool/Make/Fut/index.html @@ -0,0 +1,2 @@ + +Fut (containers-thread.CCPool.Make.Fut)

Module Make.Fut

Futures

The futures are registration points for callbacks, storing a state, that are executed in the pool using run.

type 'a t

A future value of type 'a

type 'a future = 'a t

Constructors

val return : 'a -> 'a t

Future that is already computed.

val fail : exn -> 'a t

Future that fails immediately.

val make : ( unit -> 'a ) -> 'a t

Create a future, representing a value that will be computed by the function. If the function raises, the future will fail.

val make1 : ( 'a -> 'b ) -> 'a -> 'b t
val make2 : ( 'a -> 'b -> 'c ) -> 'a -> 'b -> 'c t

Basics

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.

val state : 'a t -> 'a state

State of the future.

val is_done : 'a t -> bool

Is the future evaluated (success/failure)?

Combinators

val on_success : 'a t -> ( 'a -> unit ) -> unit

Attach a handler to be called upon success. The handler should not call functions on the future. Might be evaluated now if the future is already done.

val on_failure : _ t -> ( exn -> unit ) -> unit

Attach a handler to be called upon failure. The handler should not call any function on the future. Might be evaluated now if the future is already done.

val on_finish : 'a t -> ( 'a state -> unit ) -> unit

Attach a handler to be called when the future is evaluated. The handler should not call functions on the future. Might be evaluated now if the future is already done.

val flat_map : ( 'a -> 'b t ) -> 'a t -> 'b t

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.

val sequence_a : 'a t array -> 'a array t

Future that waits for all previous futures to terminate. If any future in the array fails, sequence_a l fails too.

val map_a : ( 'a -> 'b t ) -> 'a array -> 'b array t

map_a f a maps f on every element of a, and will return the array of every result if all calls succeed, or an error otherwise.

val sequence_l : 'a t list -> 'a list t

Future that waits for all previous futures to terminate. If any future in the list fails, sequence_l l fails too.

val map_l : ( 'a -> 'b t ) -> 'a list -> 'b list t

map_l f l maps f on every element of l, and will return the list of every result if all calls succeed, or an error otherwise.

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.

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.

val map : ( 'a -> 'b ) -> 'a t -> 'b t

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

Map the value inside the future, to be computed in a separated job.

val monoid_product : ( 'a -> 'b -> 'c ) -> 'a t -> 'b t -> 'c t

Cartesian product of the content of these futures.

  • since 2.8
val app : ( 'a -> 'b ) t -> 'a t -> 'b t

app f x applies the result of f to the result of x.

val app_async : ( 'a -> 'b ) t -> 'a t -> 'b t

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 the thread! If you need to wait on many events, consider using CCTimer.

module Infix : sig ... end
include module type of Infix
val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t
val (>>) : 'a t -> ( unit -> 'b t ) -> 'b t
val (>|=) : 'a t -> ( 'a -> 'b ) -> 'b t
val (<*>) : ( 'a -> 'b ) t -> 'a t -> 'b t

Let operators on OCaml >= 4.08.0, nothing otherwise

  • since 2.8
include CCShims_syntax.LET with type 'a t := 'a t
val let+ : 'a t -> ( 'a -> 'b ) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ( 'a -> 'b t ) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t
\ No newline at end of file diff --git a/3.10/containers-thread/CCPool/Make/argument-1-P/index.html b/3.10/containers-thread/CCPool/Make/argument-1-P/index.html new file mode 100644 index 00000000..d2da4f22 --- /dev/null +++ b/3.10/containers-thread/CCPool/Make/argument-1-P/index.html @@ -0,0 +1,2 @@ + +P (containers-thread.CCPool.Make.1-P)

Parameter Make.1-P

val max_size : int

Maximum number of threads in the pool.

\ No newline at end of file diff --git a/3.10/containers-thread/CCPool/Make/index.html b/3.10/containers-thread/CCPool/Make/index.html new file mode 100644 index 00000000..9e85e022 --- /dev/null +++ b/3.10/containers-thread/CCPool/Make/index.html @@ -0,0 +1,2 @@ + +Make (containers-thread.CCPool.Make)

Module CCPool.Make

Create a new Pool

Parameters

module P : PARAM

Signature

val run : ( unit -> _ ) -> unit

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).

val run2 : ( 'a -> 'b -> _ ) -> 'a -> 'b -> unit
val run3 : ( 'a -> 'b -> 'c -> _ ) -> 'a -> 'b -> 'c -> unit
val set_exn_handler : ( exn -> unit ) -> unit
val active : unit -> bool

active () is true as long as stop() has not been called yet.

val stop : unit -> unit

After calling stop (), most functions will raise Stopped. This has the effect of preventing new tasks from being executed.

module Fut : sig ... end
\ No newline at end of file diff --git a/3.10/containers-thread/CCPool/index.html b/3.10/containers-thread/CCPool/index.html new file mode 100644 index 00000000..d5271442 --- /dev/null +++ b/3.10/containers-thread/CCPool/index.html @@ -0,0 +1,2 @@ + +CCPool (containers-thread.CCPool)

Module CCPool

Thread Pool, and Futures

Renamed and heavily updated from CCFuture.

type +'a state =
| Done of 'a
| Waiting
| Failed of exn
module type PARAM = sig ... end
exception Stopped
module Make (P : PARAM) : sig ... end
\ No newline at end of file diff --git a/3.10/containers-thread/CCPool/module-type-PARAM/index.html b/3.10/containers-thread/CCPool/module-type-PARAM/index.html new file mode 100644 index 00000000..c32d8382 --- /dev/null +++ b/3.10/containers-thread/CCPool/module-type-PARAM/index.html @@ -0,0 +1,2 @@ + +PARAM (containers-thread.CCPool.PARAM)

Module type CCPool.PARAM

val max_size : int

Maximum number of threads in the pool.

\ No newline at end of file diff --git a/3.10/containers-thread/CCSemaphore/.dummy b/3.10/containers-thread/CCSemaphore/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-thread/CCSemaphore/index.html b/3.10/containers-thread/CCSemaphore/index.html new file mode 100644 index 00000000..f73ea746 --- /dev/null +++ b/3.10/containers-thread/CCSemaphore/index.html @@ -0,0 +1,2 @@ + +CCSemaphore (containers-thread.CCSemaphore)

Module CCSemaphore

Semaphores

type t

A semaphore

val create : int -> t

create n creates a semaphore with initial value n.

  • raises Invalid_argument

    if n <= 0.

val get : t -> int

Current value.

val acquire : int -> t -> unit

acquire n s blocks until get s >= n, then atomically sets s := !s - n.

val release : int -> t -> unit

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 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 () and returns its result. Doesn't modify the semaphore.

\ No newline at end of file diff --git a/3.10/containers-thread/CCThread/.dummy b/3.10/containers-thread/CCThread/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-thread/CCThread/Arr/index.html b/3.10/containers-thread/CCThread/Arr/index.html new file mode 100644 index 00000000..77482421 --- /dev/null +++ b/3.10/containers-thread/CCThread/Arr/index.html @@ -0,0 +1,2 @@ + +Arr (containers-thread.CCThread.Arr)

Module CCThread.Arr

Array of threads

val spawn : int -> ( int -> 'a ) -> t array

Arr.spawn n f creates an array res of length n, such that res.(i) = spawn (fun () -> f i).

val join : t array -> unit

Arr.join a joins every thread in a.

\ No newline at end of file diff --git a/3.10/containers-thread/CCThread/Barrier/index.html b/3.10/containers-thread/CCThread/Barrier/index.html new file mode 100644 index 00000000..17509dba --- /dev/null +++ b/3.10/containers-thread/CCThread/Barrier/index.html @@ -0,0 +1,2 @@ + +Barrier (containers-thread.CCThread.Barrier)

Module CCThread.Barrier

type t

Barrier, used to synchronize threads

val create : unit -> t

Create a barrier.

val reset : t -> unit

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.

val activate : t -> unit

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 was not called since. In other words, activated b = true means wait b will not block.

\ No newline at end of file diff --git a/3.10/containers-thread/CCThread/index.html b/3.10/containers-thread/CCThread/index.html new file mode 100644 index 00000000..cc3ad4b5 --- /dev/null +++ b/3.10/containers-thread/CCThread/index.html @@ -0,0 +1,2 @@ + +CCThread (containers-thread.CCThread)

Module CCThread

Threads

status: unstable

type t = Thread.t
val spawn : ( unit -> _ ) -> t

spawn f creates a new thread that runs f ().

val spawn1 : ( 'a -> _ ) -> 'a -> t

spawn1 f x is like spawn (fun () -> f x).

  • since 0.16
val spawn2 : ( 'a -> 'b -> _ ) -> 'a -> 'b -> t

spawn2 f x y is like spawn (fun () -> f x y).

  • since 0.16
val detach : ( unit -> 'a ) -> unit

detach f is the same as ignore (spawn f).

module Arr : sig ... end

Single-Use Barrier

module Barrier : sig ... end
\ No newline at end of file diff --git a/3.10/containers-thread/CCTimer/.dummy b/3.10/containers-thread/CCTimer/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers-thread/CCTimer/index.html b/3.10/containers-thread/CCTimer/index.html new file mode 100644 index 00000000..9fc88193 --- /dev/null +++ b/3.10/containers-thread/CCTimer/index.html @@ -0,0 +1,2 @@ + +CCTimer (containers-thread.CCTimer)

Module CCTimer

Event timer

Used to be part of CCFuture.

type t

A scheduler for events. It runs in its own thread.

val create : unit -> t

A new timer.

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.

exception Stopped
val after : t -> float -> f:( unit -> _ ) -> unit

Call the callback f after the given number of seconds.

  • raises Stopped

    if the timer was stopped.

val at : t -> float -> f:( unit -> _ ) -> unit

Create a future that evaluates to () at the given Unix timestamp.

  • raises Stopped

    if the timer was stopped.

exception ExitEvery
val every : ?delay:float -> t -> float -> f:( unit -> _ ) -> unit

every timer n ~f calls f () every n seconds. f() can raise ExitEvery to stop the cycle.

  • parameter delay

    if provided, the first call to f () is delayed by that many seconds.

  • raises 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

Return true until stop t has been called.

\ No newline at end of file diff --git a/3.10/containers-thread/index.html b/3.10/containers-thread/index.html new file mode 100644 index 00000000..1aef78ae --- /dev/null +++ b/3.10/containers-thread/index.html @@ -0,0 +1,2 @@ + +index (containers-thread.index)

containers-thread index

Library containers-thread

This library exposes the following toplevel modules:

\ No newline at end of file diff --git a/3.10/containers/CCArray/.dummy b/3.10/containers/CCArray/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCArray/Floatarray/index.html b/3.10/containers/CCArray/Floatarray/index.html new file mode 100644 index 00000000..598fd2b0 --- /dev/null +++ b/3.10/containers/CCArray/Floatarray/index.html @@ -0,0 +1,2 @@ + +Floatarray (containers.CCArray.Floatarray)

Module CCArray.Floatarray

val create : int -> floatarray
val length : floatarray -> int
val get : floatarray -> int -> float
val set : floatarray -> int -> float -> unit
val unsafe_get : floatarray -> int -> float
val unsafe_set : floatarray -> int -> float -> unit
\ No newline at end of file diff --git a/3.10/containers/CCArray/Infix/index.html b/3.10/containers/CCArray/Infix/index.html new file mode 100644 index 00000000..4394e751 --- /dev/null +++ b/3.10/containers/CCArray/Infix/index.html @@ -0,0 +1,2 @@ + +Infix (containers.CCArray.Infix)

Module CCArray.Infix

val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t

a >>= f is the infix version of flat_map.

val (>>|) : 'a t -> ( 'a -> 'b ) -> 'b t

a >>| f is the infix version of map.

  • since 0.8
val (>|=) : 'a t -> ( 'a -> 'b ) -> 'b t

a >|= f is the infix version of map.

  • since 0.8
val (--) : int -> int -> int t

x -- y creates an array containing integers in the range x .. y. Bounds included.

val (--^) : int -> int -> int t

x --^ y creates an array containing integers in the range x .. y. Right bound excluded.

  • since 0.17

Let operators on OCaml >= 4.08.0, nothing otherwise

  • since 2.8
val let+ : 'a array -> ( 'a -> 'b ) -> 'b array
val and+ : 'a array -> 'b array -> ('a * 'b) array
val let* : 'a array -> ( 'a -> 'b array ) -> 'b array
val and* : 'a array -> 'b array -> ('a * 'b) array
\ No newline at end of file diff --git a/3.10/containers/CCArray/index.html b/3.10/containers/CCArray/index.html new file mode 100644 index 00000000..29c1d6ea --- /dev/null +++ b/3.10/containers/CCArray/index.html @@ -0,0 +1,20 @@ + +CCArray (containers.CCArray)

Module CCArray

Array utils

type 'a iter = ( 'a -> unit ) -> unit

Fast internal iterator.

  • since 2.8
type 'a gen = unit -> 'a option
type 'a equal = 'a -> 'a -> bool
type 'a ord = 'a -> 'a -> int
type 'a random_gen = Stdlib.Random.State.t -> 'a
type 'a printer = Stdlib.Format.formatter -> 'a -> unit

Arrays

type !'a t = 'a array
val length : 'a array -> int
val get : 'a array -> int -> 'a
val set : 'a array -> int -> 'a -> unit
val make : int -> 'a -> 'a array
val create : int -> 'a -> 'a array
val create_float : int -> float array
val make_float : int -> float array
val init : int -> ( int -> 'a ) -> 'a array
val make_matrix : int -> int -> 'a -> 'a array array
val create_matrix : int -> int -> 'a -> 'a array array
val append : 'a array -> 'a array -> 'a array
val concat : 'a array list -> 'a array
val sub : 'a array -> int -> int -> 'a array
val copy : 'a array -> 'a array
val fill : 'a array -> int -> int -> 'a -> unit
val blit : 'a array -> int -> 'a array -> int -> int -> unit
val to_list : 'a array -> 'a list
val of_list : 'a list -> 'a array
val iter : ( 'a -> unit ) -> 'a array -> unit
val iteri : ( int -> 'a -> unit ) -> 'a array -> unit
val map : ( 'a -> 'b ) -> 'a array -> 'b array
val mapi : ( int -> 'a -> 'b ) -> 'a array -> 'b array
val fold_left : ( 'a -> 'b -> 'a ) -> 'a -> 'b array -> 'a
val fold_left_map : ( 'a -> 'b -> 'a * 'c ) -> 'a -> 'b array -> 'a * 'c array
val fold_right : ( 'b -> 'a -> 'a ) -> 'b array -> 'a -> 'a
val iter2 : ( 'a -> 'b -> unit ) -> 'a array -> 'b array -> unit
val map2 : ( 'a -> 'b -> 'c ) -> 'a array -> 'b array -> 'c array
val for_all : ( 'a -> bool ) -> 'a array -> bool
val exists : ( 'a -> bool ) -> 'a array -> bool
val memq : 'a -> 'a array -> bool
val find_opt : ( 'a -> bool ) -> 'a array -> 'a option
val split : ('a * 'b) array -> 'a array * 'b array
val combine : 'a array -> 'b array -> ('a * 'b) array
val sort : ( 'a -> 'a -> int ) -> 'a array -> unit
val stable_sort : ( 'a -> 'a -> int ) -> 'a array -> unit
val fast_sort : ( 'a -> 'a -> int ) -> 'a array -> unit
val to_seqi : 'a array -> (int * 'a) Stdlib.Seq.t
val of_seq : 'a Stdlib.Seq.t -> 'a array
val unsafe_get : 'a array -> int -> 'a
val unsafe_set : 'a array -> int -> 'a -> unit
module Floatarray : sig ... end
val empty : 'a t

empty is the empty array, physically equal to [||].

val equal : 'a equal -> 'a t equal

equal eq a1 a2 is true if the lengths of a1 and a2 are the same and if their corresponding elements test equal, using eq.

val compare : 'a ord -> 'a t ord

compare cmp a1 a2 compares arrays a1 and a2 using the function comparison cmp.

val swap : 'a t -> int -> int -> unit

swap a i j swaps elements at indices i and j.

  • since 1.4
val get_safe : 'a t -> int -> 'a option

get_safe a i returns Some a.(i) if i is a valid index.

  • since 0.18
val map_inplace : ( 'a -> 'a ) -> 'a t -> unit

map_inplace f a replace all elements of a by its image by f.

  • since 3.8
val mapi_inplace : ( int -> 'a -> 'a ) -> 'a t -> unit

mapi_inplace f a replace all elements of a by its image by f.

  • since NEXT_RELEASE
val fold : ( 'a -> 'b -> 'a ) -> 'a -> 'b t -> 'a

fold f init a computes f (… (f (f init a.(0)) a.(1)) …) a.(n-1), where n is the length of the array a. Same as Array.fold_left

val foldi : ( 'a -> int -> 'b -> 'a ) -> 'a -> 'b t -> 'a

foldi f init a is just like fold, but it also passes in the index of each element as the second argument to the folded function f.

val fold_while : ( 'a -> 'b -> 'a * [ `Stop | `Continue ] ) -> 'a -> 'b t -> 'a

fold_while f init a folds left on array a until a stop condition via ('a, `Stop) is indicated by the accumulator.

  • since 0.8
val fold_map : ( 'acc -> 'a -> 'acc * 'b ) -> 'acc -> 'a t -> 'acc * 'b t

fold_map f init a is a fold_left-like function, but it also maps the array to another array.

  • since 1.2, but only
  • since 2.1 with labels
val scan_left : ( 'acc -> 'a -> 'acc ) -> 'acc -> 'a t -> 'acc t

scan_left f init a returns the array [|init; f init x0; f (f init a.(0)) a.(1); …|] .

  • since 1.2, but only
  • since 2.1 with labels
val reverse_in_place : 'a t -> unit

reverse_in_place a reverses the array a in place.

val sorted : ( 'a -> 'a -> int ) -> 'a t -> 'a array

sorted f a makes a copy of a and sorts it with f.

  • since 1.0
val sort_indices : ( 'a -> 'a -> int ) -> 'a t -> int array

sort_indices f a returns a new array b, with the same length as a, such that b.(i) is the index at which the i-th element of sorted f a appears in a. a is not modified.

In other words, map (fun i -> a.(i)) (sort_indices f a) = sorted f a. sort_indices yields the inverse permutation of sort_ranking.

  • since 1.0
val sort_ranking : ( 'a -> 'a -> int ) -> 'a t -> int array

sort_ranking f a returns a new array b, with the same length as a, such that b.(i) is the index at which the i-th element of a appears in sorted f a. a is not modified.

In other words, map (fun i -> (sorted f a).(i)) (sort_ranking f a) = a. sort_ranking yields the inverse permutation of sort_indices.

In the absence of duplicate elements in a, we also have lookup_exn a.(i) (sorted a) = (sorted_ranking a).(i).

  • since 1.0
val mem : ?eq:( 'a -> 'a -> bool ) -> 'a -> 'a t -> bool

mem ~eq x a return true if x is present in a. Linear time.

  • since 3.0
val find_map : ( 'a -> 'b option ) -> 'a t -> 'b option

find_map f a returns Some y if there is an element x such that f x = Some y. Otherwise returns None.

  • since 1.3, but only
  • since 2.1 with labels
val find_map_i : ( int -> 'a -> 'b option ) -> 'a t -> 'b option

find_map_i f a is like find_map, but the index of the element is also passed to the predicate function f.

  • since 1.3, but only
  • since 2.1 with labels
val find_idx : ( 'a -> bool ) -> 'a t -> (int * 'a) option

find_idx f a returns Some (i,x) where x is the i-th element of a, and f x holds. Otherwise returns None.

  • since 0.3.4
val lookup : cmp:'a ord -> 'a -> 'a t -> int option

lookup ~cmp key a lookups the index of some key key in a sorted array a. Undefined behavior if the array a is not sorted wrt ~cmp. Complexity: O(log (n)) (dichotomic search).

  • returns

    None if the key key is not present, or Some i (i the index of the key) otherwise.

val lookup_exn : cmp:'a ord -> 'a -> 'a t -> int

lookup_exn ~cmp key a is like lookup, but

  • raises Not_found

    if the key key is not present.

val bsearch : + cmp:( 'a -> 'a -> int ) -> + 'a -> + 'a t -> + [ `All_lower | `All_bigger | `Just_after of int | `Empty | `At of int ]

bsearch ~cmp key a finds the index of the object key in the array a, provided a is sorted using cmp. If the array is not sorted, the result is not specified (may raise Invalid_argument).

Complexity: O(log n) where n is the length of the array a (dichotomic search).

  • returns
    • `At i if cmp a.(i) key = 0 (for some i).
    • `All_lower if all elements of a are lower than key.
    • `All_bigger if all elements of a are bigger than key.
    • `Just_after i if a.(i) < key < a.(i+1).
    • `Empty if the array a is empty.
  • raises Invalid_argument

    if the array is found to be unsorted w.r.t cmp.

  • since 0.13
val for_all2 : ( 'a -> 'b -> bool ) -> 'a t -> 'b t -> bool

for_all2 f [|a1; …; an|] [|b1; …; bn|] is true if each pair of elements ai bi satisfies the predicate f. That is, it returns (f a1 b1) && (f a2 b2) && … && (f an bn).

  • raises Invalid_argument

    if arrays have distinct lengths. Allow different types.

  • since 0.20
val exists2 : ( 'a -> 'b -> bool ) -> 'a t -> 'b t -> bool

exists2 f [|a1; …; an|] [|b1; …; bn|] is true if any pair of elements ai bi satisfies the predicate f. That is, it returns (f a1 b1) || (f a2 b2) || … || (f an bn).

  • raises Invalid_argument

    if arrays have distinct lengths. Allow different types.

  • since 0.20
val fold2 : ( 'acc -> 'a -> 'b -> 'acc ) -> 'acc -> 'a t -> 'b t -> 'acc

fold2 f init a b fold on two arrays a and b stepwise. It computes f (… (f init a1 b1) …) an bn.

  • raises Invalid_argument

    if a and b have distinct lengths.

  • since 0.20
val shuffle : 'a t -> unit

shuffle a randomly shuffles the array a, in place.

val shuffle_with : Stdlib.Random.State.t -> 'a t -> unit

shuffle_with rs a randomly shuffles the array a (like shuffle) but a specialized random state rs is used to control the random numbers being produced during shuffling (for reproducibility).

val random_choose : 'a t -> 'a random_gen

random_choose a rs randomly chooses an element of a.

  • raises Not_found

    if the array/slice is empty.

val to_string : ?sep:string -> ( 'a -> string ) -> 'a array -> string

to_string ~sep item_to_string a print a to a string using sep as a separator between elements of a.

  • since 2.7
val to_iter : 'a t -> 'a iter

to_iter a returns an iter of the elements of an array a. The input array a is shared with the sequence and modification of it will result in modification of the iterator.

  • since 2.8
val to_seq : 'a t -> 'a Stdlib.Seq.t

to_seq a returns a Seq.t of the elements of an array a. The input array a is shared with the sequence and modification of it will result in modification of the sequence. Renamed from to_std_seq since 3.0.

  • since 3.0
val to_gen : 'a t -> 'a gen

to_gen a returns a gen of the elements of an array a.

IO

val pp : + ?pp_start:unit printer -> + ?pp_stop:unit printer -> + ?pp_sep:unit printer -> + 'a printer -> + 'a t printer

pp ~pp_start ~pp_stop ~pp_sep pp_item ppf a formats the array a on ppf. Each element is formatted with pp_item, pp_start is called at the beginning, pp_stop is called at the end, pp_sep is called between each elements. By defaults pp_start and pp_stop does nothing and pp_sep defaults to (fun out -> Format.fprintf out ",@ ").

val pp_i : + ?pp_start:unit printer -> + ?pp_stop:unit printer -> + ?pp_sep:unit printer -> + ( int -> 'a printer ) -> + 'a t printer

pp_i ~pp_start ~pp_stop ~pp_sep pp_item ppf a prints the array a on ppf. The printing function pp_item is giving both index and element. pp_start is called at the beginning, pp_stop is called at the end, pp_sep is called between each elements. By defaults pp_start and pp_stop does nothing and pp_sep defaults to (fun out -> Format.fprintf out ",@ ").

val rev : 'a t -> 'a t

rev a copies the array a and reverses it in place.

  • since 0.20
val filter : ( 'a -> bool ) -> 'a t -> 'a t

filter f a filters elements out of the array a. Only the elements satisfying the given predicate f will be kept.

val filter_map : ( 'a -> 'b option ) -> 'a t -> 'b t

filter_map f [|a1; …; an|] calls (f a1) … (f an) and returns an array b consisting of all elements bi such as f ai = Some bi. When f returns None, the corresponding element of a is discarded.

val monoid_product : ( 'a -> 'b -> 'c ) -> 'a t -> 'b t -> 'c t

monoid_product f a b passes all combinaisons of tuples from the two arrays a and b to the function f.

  • since 2.8
val flat_map : ( 'a -> 'b t ) -> 'a t -> 'b array

flat_map f a transforms each element of a into an array, then flattens.

val except_idx : 'a t -> int -> 'a list

except_idx a i removes the element of a at given index i, and returns the list of the other elements.

val random : 'a random_gen -> 'a t random_gen
val random_non_empty : 'a random_gen -> 'a t random_gen
val random_len : int -> 'a random_gen -> 'a t random_gen

Generic Functions

module type MONO_ARRAY = sig ... end
val sort_generic : + (module MONO_ARRAY with type elt = 'elt and type t = 'arr) -> + cmp:( 'elt -> 'elt -> int ) -> + 'arr -> + unit

sort_generic (module M) ~cmp a sorts the array a, without allocating (eats stack space though). Performance might be lower than Array.sort.

  • since 0.14

Infix Operators

It is convenient to openCCArray.Infix to access the infix operators without cluttering the scope too much.

module Infix : sig ... end
include module type of Infix
val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t

a >>= f is the infix version of flat_map.

val (>>|) : 'a t -> ( 'a -> 'b ) -> 'b t

a >>| f is the infix version of map.

  • since 0.8
val (>|=) : 'a t -> ( 'a -> 'b ) -> 'b t

a >|= f is the infix version of map.

  • since 0.8
val (--) : int -> int -> int t

x -- y creates an array containing integers in the range x .. y. Bounds included.

val (--^) : int -> int -> int t

x --^ y creates an array containing integers in the range x .. y. Right bound excluded.

  • since 0.17

Let operators on OCaml >= 4.08.0, nothing otherwise

  • since 2.8
val let+ : 'a array -> ( 'a -> 'b ) -> 'b array
val and+ : 'a array -> 'b array -> ('a * 'b) array
val let* : 'a array -> ( 'a -> 'b array ) -> 'b array
val and* : 'a array -> 'b array -> ('a * 'b) array
\ No newline at end of file diff --git a/3.10/containers/CCArray/module-type-MONO_ARRAY/index.html b/3.10/containers/CCArray/module-type-MONO_ARRAY/index.html new file mode 100644 index 00000000..9860323f --- /dev/null +++ b/3.10/containers/CCArray/module-type-MONO_ARRAY/index.html @@ -0,0 +1,2 @@ + +MONO_ARRAY (containers.CCArray.MONO_ARRAY)

Module type CCArray.MONO_ARRAY

type elt
type t
val length : t -> int
val get : t -> int -> elt
val set : t -> int -> elt -> unit
\ No newline at end of file diff --git a/3.10/containers/CCArrayLabels/.dummy b/3.10/containers/CCArrayLabels/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCArrayLabels/Floatarray/index.html b/3.10/containers/CCArrayLabels/Floatarray/index.html new file mode 100644 index 00000000..20049907 --- /dev/null +++ b/3.10/containers/CCArrayLabels/Floatarray/index.html @@ -0,0 +1,2 @@ + +Floatarray (containers.CCArrayLabels.Floatarray)

Module CCArrayLabels.Floatarray

val create : int -> floatarray
val length : floatarray -> int
val get : floatarray -> int -> float
val set : floatarray -> int -> float -> unit
val unsafe_get : floatarray -> int -> float
val unsafe_set : floatarray -> int -> float -> unit
\ No newline at end of file diff --git a/3.10/containers/CCArrayLabels/Infix/index.html b/3.10/containers/CCArrayLabels/Infix/index.html new file mode 100644 index 00000000..bf98021b --- /dev/null +++ b/3.10/containers/CCArrayLabels/Infix/index.html @@ -0,0 +1,2 @@ + +Infix (containers.CCArrayLabels.Infix)

Module CCArrayLabels.Infix

val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t

a >>= f is the infix version of flat_map.

val (>>|) : 'a t -> ( 'a -> 'b ) -> 'b t

a >>| f is the infix version of map.

  • since 0.8
val (>|=) : 'a t -> ( 'a -> 'b ) -> 'b t

a >|= f is the infix version of map.

  • since 0.8
val (--) : int -> int -> int t

x -- y creates an array containing integers in the range x .. y. Bounds included.

val (--^) : int -> int -> int t

x --^ y creates an array containing integers in the range x .. y. Right bound excluded.

  • since 0.17

Let operators on OCaml >= 4.08.0, nothing otherwise

  • since 2.8
val let+ : 'a array -> ( 'a -> 'b ) -> 'b array
val and+ : 'a array -> 'b array -> ('a * 'b) array
val let* : 'a array -> ( 'a -> 'b array ) -> 'b array
val and* : 'a array -> 'b array -> ('a * 'b) array
\ No newline at end of file diff --git a/3.10/containers/CCArrayLabels/index.html b/3.10/containers/CCArrayLabels/index.html new file mode 100644 index 00000000..b8d4734c --- /dev/null +++ b/3.10/containers/CCArrayLabels/index.html @@ -0,0 +1,38 @@ + +CCArrayLabels (containers.CCArrayLabels)

Module CCArrayLabels

Array utils (Labeled version of CCArray)

type 'a iter = ( 'a -> unit ) -> unit

Fast internal iterator.

  • since 2.8
type 'a gen = unit -> 'a option
type 'a equal = 'a -> 'a -> bool
type 'a ord = 'a -> 'a -> int
type 'a random_gen = Stdlib.Random.State.t -> 'a
type 'a printer = Stdlib.Format.formatter -> 'a -> unit

Arrays

type !'a t = 'a array
val length : 'a array -> int
val get : 'a array -> int -> 'a
val set : 'a array -> int -> 'a -> unit
val make : int -> 'a -> 'a array
val create : int -> 'a -> 'a array
val create_float : int -> float array
val make_float : int -> float array
val init : int -> f:( int -> 'a ) -> 'a array
val make_matrix : dimx:int -> dimy:int -> 'a -> 'a array array
val create_matrix : dimx:int -> dimy:int -> 'a -> 'a array array
val append : 'a array -> 'a array -> 'a array
val concat : 'a array list -> 'a array
val sub : 'a array -> pos:int -> len:int -> 'a array
val copy : 'a array -> 'a array
val fill : 'a array -> pos:int -> len:int -> 'a -> unit
val blit : + src:'a array -> + src_pos:int -> + dst:'a array -> + dst_pos:int -> + len:int -> + unit
val to_list : 'a array -> 'a list
val of_list : 'a list -> 'a array
val iter : f:( 'a -> unit ) -> 'a array -> unit
val iteri : f:( int -> 'a -> unit ) -> 'a array -> unit
val map : f:( 'a -> 'b ) -> 'a array -> 'b array
val mapi : f:( int -> 'a -> 'b ) -> 'a array -> 'b array
val fold_left : f:( 'a -> 'b -> 'a ) -> init:'a -> 'b array -> 'a
val fold_left_map : + f:( 'a -> 'b -> 'a * 'c ) -> + init:'a -> + 'b array -> + 'a * 'c array
val fold_right : f:( 'b -> 'a -> 'a ) -> 'b array -> init:'a -> 'a
val for_all : f:( 'a -> bool ) -> 'a array -> bool
val exists : f:( 'a -> bool ) -> 'a array -> bool
val memq : 'a -> set:'a array -> bool
val find_opt : f:( 'a -> bool ) -> 'a array -> 'a option
val split : ('a * 'b) array -> 'a array * 'b array
val combine : 'a array -> 'b array -> ('a * 'b) array
val sort : cmp:( 'a -> 'a -> int ) -> 'a array -> unit
val stable_sort : cmp:( 'a -> 'a -> int ) -> 'a array -> unit
val fast_sort : cmp:( 'a -> 'a -> int ) -> 'a array -> unit
val to_seqi : 'a array -> (int * 'a) Stdlib.Seq.t
val of_seq : 'a Stdlib.Seq.t -> 'a array
val unsafe_get : 'a array -> int -> 'a
val unsafe_set : 'a array -> int -> 'a -> unit
module Floatarray : sig ... end
val empty : 'a t

empty is the empty array, physically equal to [||].

val equal : 'a equal -> 'a t equal

equal eq a1 a2 is true if the lengths of a1 and a2 are the same and if their corresponding elements test equal, using eq.

val compare : 'a ord -> 'a t ord

compare cmp a1 a2 compares arrays a1 and a2 using the function comparison cmp.

val swap : 'a t -> int -> int -> unit

swap a i j swaps elements at indices i and j.

  • since 1.4
val get_safe : 'a t -> int -> 'a option

get_safe a i returns Some a.(i) if i is a valid index.

  • since 0.18
val map_inplace : f:( 'a -> 'a ) -> 'a t -> unit

map_inplace ~f a replace all elements of a by its image by f.

  • since 3.8
val mapi_inplace : f:( int -> 'a -> 'a ) -> 'a t -> unit

mapi_inplace ~f a replace all elements of a by its image by f.

  • since NEXT_RELEASE
val fold : f:( 'a -> 'b -> 'a ) -> init:'a -> 'b t -> 'a

fold ~f ~init a computes f (… (f (f init a.(0)) a.(1)) …) a.(n-1), where n is the length of the array a. Same as ArrayLabels.fold_left

val foldi : f:( 'a -> int -> 'b -> 'a ) -> init:'a -> 'b t -> 'a

foldi ~f ~init a is just like fold, but it also passes in the index of each element as the second argument to the folded function f.

val fold_while : + f:( 'a -> 'b -> 'a * [ `Stop | `Continue ] ) -> + init:'a -> + 'b t -> + 'a

fold_while ~f ~init a folds left on array a until a stop condition via ('a, `Stop) is indicated by the accumulator.

  • since 0.8
val fold_map : + f:( 'acc -> 'a -> 'acc * 'b ) -> + init:'acc -> + 'a t -> + 'acc * 'b t

fold_map ~f ~init a is a fold_left-like function, but it also maps the array to another array.

  • since 1.2, but only
  • since 2.1 with labels
val scan_left : f:( 'acc -> 'a -> 'acc ) -> init:'acc -> 'a t -> 'acc t

scan_left ~f ~init a returns the array [|init; f init x0; f (f init a.(0)) a.(1); …|] .

  • since 1.2, but only
  • since 2.1 with labels
val reverse_in_place : 'a t -> unit

reverse_in_place a reverses the array a in place.

val sorted : f:( 'a -> 'a -> int ) -> 'a t -> 'a array

sorted ~f a makes a copy of a and sorts it with f.

  • since 1.0
val sort_indices : f:( 'a -> 'a -> int ) -> 'a t -> int array

sort_indices ~f a returns a new array b, with the same length as a, such that b.(i) is the index at which the i-th element of sorted f a appears in a. a is not modified.

In other words, map (fun i -> a.(i)) (sort_indices f a) = sorted f a. sort_indices yields the inverse permutation of sort_ranking.

  • since 1.0
val sort_ranking : f:( 'a -> 'a -> int ) -> 'a t -> int array

sort_ranking ~f a returns a new array b, with the same length as a, such that b.(i) is the index at which the i-th element of a appears in sorted f a. a is not modified.

In other words, map (fun i -> (sorted f a).(i)) (sort_ranking f a) = a. sort_ranking yields the inverse permutation of sort_indices.

In the absence of duplicate elements in a, we also have lookup_exn a.(i) (sorted a) = (sorted_ranking a).(i).

  • since 1.0
val mem : ?eq:( 'a -> 'a -> bool ) -> 'a -> 'a t -> bool

mem ~eq x a return true if x is present in a. Linear time.

  • since 3.0
val find_map : f:( 'a -> 'b option ) -> 'a t -> 'b option

find_map ~f a returns Some y if there is an element x such that f x = Some y. Otherwise returns None.

  • since 1.3, but only
  • since 2.1 with labels
val find_map_i : f:( int -> 'a -> 'b option ) -> 'a t -> 'b option

find_map_i ~f a is like find_map, but the index of the element is also passed to the predicate function f.

  • since 1.3, but only
  • since 2.1 with labels
val find_idx : f:( 'a -> bool ) -> 'a t -> (int * 'a) option

find_idx ~f a returns Some (i,x) where x is the i-th element of a, and f x holds. Otherwise returns None.

  • since 0.3.4
val lookup : cmp:'a ord -> key:'a -> 'a t -> int option

lookup ~cmp ~key a lookups the index of some key key in a sorted array a. Undefined behavior if the array a is not sorted wrt cmp. Complexity: O(log (n)) (dichotomic search).

  • returns

    None if the key key is not present, or Some i (i the index of the key) otherwise.

val lookup_exn : cmp:'a ord -> key:'a -> 'a t -> int

lookup_exn ~cmp ~key a is like lookup, but

  • raises Not_found

    if the key key is not present.

val bsearch : + cmp:( 'a -> 'a -> int ) -> + key:'a -> + 'a t -> + [ `All_lower | `All_bigger | `Just_after of int | `Empty | `At of int ]

bsearch ~cmp ~key a finds the index of the object key in the array a, provided a is sorted using cmp. If the array is not sorted, the result is not specified (may raise Invalid_argument).

Complexity: O(log n) where n is the length of the array a (dichotomic search).

  • returns
    • `At i if cmp a.(i) key = 0 (for some i).
    • `All_lower if all elements of a are lower than key.
    • `All_bigger if all elements of a are bigger than key.
    • `Just_after i if a.(i) < key < a.(i+1).
    • `Empty if the array a is empty.
  • raises Invalid_argument

    if the array is found to be unsorted w.r.t cmp.

  • since 0.13
val for_all2 : f:( 'a -> 'b -> bool ) -> 'a t -> 'b t -> bool

for_all2 ~f [|a1; …; an|] [|b1; …; bn|] is true if each pair of elements ai bi satisfies the predicate f. That is, it returns (f a1 b1) && (f a2 b2) && … && (f an bn).

  • raises Invalid_argument

    if arrays have distinct lengths. Allow different types.

  • since 0.20
val exists2 : f:( 'a -> 'b -> bool ) -> 'a t -> 'b t -> bool

exists2 ~f [|a1; …; an|] [|b1; …; bn|] is true if any pair of elements ai bi satisfies the predicate f. That is, it returns (f a1 b1) || (f a2 b2) || … || (f an bn).

  • raises Invalid_argument

    if arrays have distinct lengths. Allow different types.

  • since 0.20
val fold2 : f:( 'acc -> 'a -> 'b -> 'acc ) -> init:'acc -> 'a t -> 'b t -> 'acc

fold2 ~f ~init a b fold on two arrays a and b stepwise. It computes f (… (f init a1 b1) …) an bn.

  • raises Invalid_argument

    if a and b have distinct lengths.

  • since 0.20
val iter2 : f:( 'a -> 'b -> unit ) -> 'a t -> 'b t -> unit

iter2 ~f a b iterates on the two arrays a and b stepwise. It is equivalent to f a0 b0; …; f a.(length a - 1) b.(length b - 1); ().

  • raises Invalid_argument

    if a and b have distinct lengths.

  • since 0.20
val shuffle : 'a t -> unit

shuffle a randomly shuffles the array a, in place.

val shuffle_with : Stdlib.Random.State.t -> 'a t -> unit

shuffle_with rs a randomly shuffles the array a (like shuffle) but a specialized random state rs is used to control the random numbers being produced during shuffling (for reproducibility).

val random_choose : 'a t -> 'a random_gen

random_choose a rs randomly chooses an element of a.

  • raises Not_found

    if the array/slice is empty.

val to_string : ?sep:string -> ( 'a -> string ) -> 'a array -> string

to_string ~sep item_to_string a print a to a string using sep as a separator between elements of a.

  • since 2.7
val to_iter : 'a t -> 'a iter

to_iter a returns an iter of the elements of an array a. The input array a is shared with the sequence and modification of it will result in modification of the iterator.

  • since 2.8
val to_seq : 'a t -> 'a Stdlib.Seq.t

to_seq a returns a Seq.t of the elements of an array a. The input array a is shared with the sequence and modification of it will result in modification of the sequence. Renamed from to_std_seq since 3.0.

  • since 3.0
val to_gen : 'a t -> 'a gen

to_gen a returns a gen of the elements of an array a.

IO

val pp : + ?pp_start:unit printer -> + ?pp_stop:unit printer -> + ?pp_sep:unit printer -> + 'a printer -> + 'a t printer

pp ~pp_start ~pp_stop ~pp_sep pp_item ppf a formats the array a on ppf. Each element is formatted with pp_item, pp_start is called at the beginning, pp_stop is called at the end, pp_sep is called between each elements. By defaults pp_start and pp_stop does nothing and pp_sep defaults to (fun out -> Format.fprintf out ",@ ").

val pp_i : + ?pp_start:unit printer -> + ?pp_stop:unit printer -> + ?pp_sep:unit printer -> + ( int -> 'a printer ) -> + 'a t printer

pp_i ~pp_start ~pp_stop ~pp_sep pp_item ppf a prints the array a on ppf. The printing function pp_item is giving both index and element. pp_start is called at the beginning, pp_stop is called at the end, pp_sep is called between each elements. By defaults pp_start and pp_stop does nothing and pp_sep defaults to (fun out -> Format.fprintf out ",@ ").

val map2 : f:( 'a -> 'b -> 'c ) -> 'a t -> 'b t -> 'c t

map2 ~f a b applies function f to all elements of a and b, and builds an array with the results returned by f: [| f a.(0) b.(0); …; f a.(length a - 1) b.(length b - 1)|].

  • raises Invalid_argument

    if a and b have distinct lengths.

  • since 0.20
val rev : 'a t -> 'a t

rev a copies the array a and reverses it in place.

  • since 0.20
val filter : f:( 'a -> bool ) -> 'a t -> 'a t

filter ~f a filters elements out of the array a. Only the elements satisfying the given predicate f will be kept.

val filter_map : f:( 'a -> 'b option ) -> 'a t -> 'b t

filter_map ~f [|a1; …; an|] calls (f a1) … (f an) and returns an array b consisting of all elements bi such as f ai = Some bi. When f returns None, the corresponding element of a is discarded.

val monoid_product : f:( 'a -> 'b -> 'c ) -> 'a t -> 'b t -> 'c t

monoid_product ~f a b passes all combinaisons of tuples from the two arrays a and b to the function f.

  • since 2.8
val flat_map : f:( 'a -> 'b t ) -> 'a t -> 'b array

flat_map ~f a transforms each element of a into an array, then flattens.

val except_idx : 'a t -> int -> 'a list

except_idx a i removes the element of a at given index i, and returns the list of the other elements.

val random : 'a random_gen -> 'a t random_gen
val random_non_empty : 'a random_gen -> 'a t random_gen
val random_len : int -> 'a random_gen -> 'a t random_gen

Generic Functions

module type MONO_ARRAY = sig ... end
val sort_generic : + (module MONO_ARRAY with type elt = 'elt and type t = 'arr) -> + cmp:( 'elt -> 'elt -> int ) -> + 'arr -> + unit

sort_generic (module M) ~cmp a sorts the array a, without allocating (eats stack space though). Performance might be lower than Array.sort.

  • since 0.14

Infix Operators

It is convenient to openCCArray.Infix to access the infix operators without cluttering the scope too much.

module Infix : sig ... end
include module type of Infix
val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t

a >>= f is the infix version of flat_map.

val (>>|) : 'a t -> ( 'a -> 'b ) -> 'b t

a >>| f is the infix version of map.

  • since 0.8
val (>|=) : 'a t -> ( 'a -> 'b ) -> 'b t

a >|= f is the infix version of map.

  • since 0.8
val (--) : int -> int -> int t

x -- y creates an array containing integers in the range x .. y. Bounds included.

val (--^) : int -> int -> int t

x --^ y creates an array containing integers in the range x .. y. Right bound excluded.

  • since 0.17

Let operators on OCaml >= 4.08.0, nothing otherwise

  • since 2.8
val let+ : 'a array -> ( 'a -> 'b ) -> 'b array
val and+ : 'a array -> 'b array -> ('a * 'b) array
val let* : 'a array -> ( 'a -> 'b array ) -> 'b array
val and* : 'a array -> 'b array -> ('a * 'b) array
\ No newline at end of file diff --git a/3.10/containers/CCArrayLabels/module-type-MONO_ARRAY/index.html b/3.10/containers/CCArrayLabels/module-type-MONO_ARRAY/index.html new file mode 100644 index 00000000..4c27dd6c --- /dev/null +++ b/3.10/containers/CCArrayLabels/module-type-MONO_ARRAY/index.html @@ -0,0 +1,2 @@ + +MONO_ARRAY (containers.CCArrayLabels.MONO_ARRAY)

Module type CCArrayLabels.MONO_ARRAY

type elt
type t
val length : t -> int
val get : t -> int -> elt
val set : t -> int -> elt -> unit
\ No newline at end of file diff --git a/3.10/containers/CCAtomic/.dummy b/3.10/containers/CCAtomic/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCAtomic/index.html b/3.10/containers/CCAtomic/index.html new file mode 100644 index 00000000..e1e260b9 --- /dev/null +++ b/3.10/containers/CCAtomic/index.html @@ -0,0 +1,2 @@ + +CCAtomic (containers.CCAtomic)

Module CCAtomic

include module type of struct include Stdlib.Atomic end
type !'a t = 'a Stdlib__Atomic.t
val make : 'a -> 'a t
val get : 'a t -> 'a
val set : 'a t -> 'a -> unit
val exchange : 'a t -> 'a -> 'a
val compare_and_set : 'a t -> 'a -> 'a -> bool
val fetch_and_add : int t -> int -> int
val incr : int t -> unit
val decr : int t -> unit
\ No newline at end of file diff --git a/3.10/containers/CCBool/.dummy b/3.10/containers/CCBool/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCBool/index.html b/3.10/containers/CCBool/index.html new file mode 100644 index 00000000..3462bd04 --- /dev/null +++ b/3.10/containers/CCBool/index.html @@ -0,0 +1,2 @@ + +CCBool (containers.CCBool)

Module CCBool

Basic Bool functions

type t = bool
val compare : t -> t -> int

compare b1 b2 is the total ordering on booleans b1 and b2, similar to Stdlib.compare.

val equal : t -> t -> bool

equal b1 b2 is true if b1 and b2 are the same.

val to_int : t -> int

to_int true = 1, to_int false = 0.

  • since 2.7
val of_int : int -> t

of_int i is the same as i <> 0

  • since 2.7
type 'a printer = Stdlib.Format.formatter -> 'a -> unit
val pp : t printer
\ No newline at end of file diff --git a/3.10/containers/CCByte_buffer/.dummy b/3.10/containers/CCByte_buffer/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCByte_buffer/index.html b/3.10/containers/CCByte_buffer/index.html new file mode 100644 index 00000000..d790ea70 --- /dev/null +++ b/3.10/containers/CCByte_buffer/index.html @@ -0,0 +1,2 @@ + +CCByte_buffer (containers.CCByte_buffer)

Module CCByte_buffer

Byte buffer.

A dynamic vector of bytes.

type t
type 'a iter = ( 'a -> unit ) -> unit
val create : ?cap:int -> unit -> t

Create a new buffer with given initial capacity.

val length : t -> int

Current length.

val is_empty : t -> bool

is_empty b is length b=0

val capacity : t -> int

Current capacity (size of the array returned by bytes)

val bytes : t -> bytes

Access the underlying byte buffer. This buffer can change after operations that affect the capacity (e.g. add_char).

val clear : t -> unit
val ensure_cap : t -> int -> unit

ensure_cap self n ensures that capacity self >= n.

val shrink_to : t -> int -> unit

shrink_to buf n reduces length buf to at most n. Does nothing if the length is already <= n.

val add_char : t -> char -> unit

Push a character at the end.

val append_bytes : t -> bytes -> unit
val append_subbytes : t -> bytes -> int -> int -> unit
val append_string : t -> string -> unit
val append_substring : t -> string -> int -> int -> unit
val append_buf : t -> Stdlib.Buffer.t -> unit
val append_iter : t -> char iter -> unit
val append_seq : t -> char Stdlib.Seq.t -> unit
val get : t -> int -> char
val unsafe_get : t -> int -> char
val set : t -> int -> char -> unit
val unsafe_set : t -> int -> char -> unit
val contents : t -> string

Copy the internal data to a string

val contents_bytes : t -> bytes

Copy the internal data to a byte buffer

val iter : ( char -> unit ) -> t -> unit
val fold_left : ( 'a -> char -> 'a ) -> 'a -> t -> 'a
val of_iter : char iter -> t
val of_seq : char Stdlib.Seq.t -> t
val to_iter : t -> char iter
val to_seq : t -> char Stdlib.Seq.t
\ No newline at end of file diff --git a/3.10/containers/CCCanonical_sexp/.dummy b/3.10/containers/CCCanonical_sexp/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCCanonical_sexp/Make/argument-1-Sexp/index.html b/3.10/containers/CCCanonical_sexp/Make/argument-1-Sexp/index.html new file mode 100644 index 00000000..78e48f4c --- /dev/null +++ b/3.10/containers/CCCanonical_sexp/Make/argument-1-Sexp/index.html @@ -0,0 +1,2 @@ + +Sexp (containers.CCCanonical_sexp.Make.1-Sexp)

Parameter Make.1-Sexp

type t
val atom : string -> t
val list : t list -> t
val match_ : t -> atom:( string -> 'a ) -> list:( t list -> 'a ) -> 'a
\ No newline at end of file diff --git a/3.10/containers/CCCanonical_sexp/Make/index.html b/3.10/containers/CCCanonical_sexp/Make/index.html new file mode 100644 index 00000000..3b7ef440 --- /dev/null +++ b/3.10/containers/CCCanonical_sexp/Make/index.html @@ -0,0 +1,4 @@ + +Make (containers.CCCanonical_sexp.Make)

Module CCCanonical_sexp.Make

Parser and printer

Parameters

module Sexp : SEXP

Signature

type t = Sexp.t
type sexp = t

Re-exports

val atom : string -> t

Make an atom out of this string.

  • since 2.8
val list : t list -> t

Make a Sexpr of this list.

  • since 2.8

Constructors

val of_int : int -> t
val of_bool : bool -> t
val of_list : t list -> t
val of_rev_list : t list -> t

Reverse the list.

val of_float : float -> t
val of_unit : t
val of_pair : (t * t) -> t
val of_triple : (t * t * t) -> t
val of_quad : (t * t * t * t) -> t
val of_variant : string -> t list -> t

of_variant name args is used to encode algebraic variants into a S-expr. For instance of_variant "some" [of_int 1] represents the value Some 1.

val of_field : string -> t -> t

Used to represent one record field.

val of_record : (string * t) list -> t

Represent a record by its named fields.

Printing

val to_buf : Stdlib.Buffer.t -> t -> unit
val to_string : t -> string
val to_file : string -> t -> unit
val to_file_iter : string -> t CCSexp_intf.iter -> unit

Print the given iter of expressions to a file.

val to_chan : Stdlib.out_channel -> t -> unit
val pp : Stdlib.Format.formatter -> t -> unit

Pretty-printer nice on human eyes (including indentation).

val pp_noindent : Stdlib.Format.formatter -> t -> unit

Raw, direct printing as compact as possible.

Parsing

val parse_string : string -> t CCSexp_intf.or_error

Parse a string.

val parse_string_list : string -> t list CCSexp_intf.or_error

Parse a string into a list of S-exprs.

  • since 2.8
val parse_chan : Stdlib.in_channel -> t CCSexp_intf.or_error

Parse a S-expression from the given channel. Can read more data than necessary, so don't use this if you need finer-grained control (e.g. to read something else after the S-exp).

val parse_chan_gen : + Stdlib.in_channel -> + t CCSexp_intf.or_error CCSexp_intf.gen

Parse a channel into a generator of S-expressions.

val parse_chan_list : Stdlib.in_channel -> t list CCSexp_intf.or_error
val parse_file : string -> t CCSexp_intf.or_error

Open the file and read a S-exp from it.

val parse_file_list : string -> t list CCSexp_intf.or_error

Open the file and read a S-exp from it.

\ No newline at end of file diff --git a/3.10/containers/CCCanonical_sexp/index.html b/3.10/containers/CCCanonical_sexp/index.html new file mode 100644 index 00000000..79a03ed0 --- /dev/null +++ b/3.10/containers/CCCanonical_sexp/index.html @@ -0,0 +1,4 @@ + +CCCanonical_sexp (containers.CCCanonical_sexp)

Module CCCanonical_sexp

Canonical S-expressions

See wikipedia. These S-expressions are binary safe.

type 'a or_error = ( 'a, string ) Stdlib.result
type 'a gen = unit -> 'a option
module type SEXP = CCSexp_intf.BASIC_SEXP
module type S = CCSexp_intf.S0
module Make (Sexp : SEXP) : S with type t = Sexp.t

Basics

type t = [
| `Atom of string
| `List of t list
]

A simple, structural representation of S-expressions. Compatible with CCSexp.

include S with type t := t
type sexp = t

Re-exports

val list : t list -> t

Make a Sexpr of this list.

  • since 2.8

Constructors

val of_int : int -> t
val of_bool : bool -> t
val of_list : t list -> t
val of_rev_list : t list -> t

Reverse the list.

val of_float : float -> t
val of_unit : t
val of_pair : (t * t) -> t
val of_triple : (t * t * t) -> t
val of_quad : (t * t * t * t) -> t
val of_variant : string -> t list -> t

of_variant name args is used to encode algebraic variants into a S-expr. For instance of_variant "some" [of_int 1] represents the value Some 1.

val of_field : string -> t -> t

Used to represent one record field.

val of_record : (string * t) list -> t

Represent a record by its named fields.

Printing

val to_buf : Stdlib.Buffer.t -> t -> unit
val to_string : t -> string
val to_file : string -> t -> unit
val to_file_iter : string -> t CCSexp_intf.iter -> unit

Print the given iter of expressions to a file.

val to_chan : Stdlib.out_channel -> t -> unit
val pp : Stdlib.Format.formatter -> t -> unit

Pretty-printer nice on human eyes (including indentation).

val pp_noindent : Stdlib.Format.formatter -> t -> unit

Raw, direct printing as compact as possible.

Parsing

val parse_string : string -> t CCSexp_intf.or_error

Parse a string.

val parse_string_list : string -> t list CCSexp_intf.or_error

Parse a string into a list of S-exprs.

  • since 2.8
val parse_chan : Stdlib.in_channel -> t CCSexp_intf.or_error

Parse a S-expression from the given channel. Can read more data than necessary, so don't use this if you need finer-grained control (e.g. to read something else after the S-exp).

val parse_chan_gen : + Stdlib.in_channel -> + t CCSexp_intf.or_error CCSexp_intf.gen

Parse a channel into a generator of S-expressions.

val parse_chan_list : Stdlib.in_channel -> t list CCSexp_intf.or_error
val parse_file : string -> t CCSexp_intf.or_error

Open the file and read a S-exp from it.

val parse_file_list : string -> t list CCSexp_intf.or_error

Open the file and read a S-exp from it.

val equal : t -> t -> bool
val compare : t -> t -> int
val atom : string -> t
\ No newline at end of file diff --git a/3.10/containers/CCChar/.dummy b/3.10/containers/CCChar/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCChar/Infix/index.html b/3.10/containers/CCChar/Infix/index.html new file mode 100644 index 00000000..ee26f7f3 --- /dev/null +++ b/3.10/containers/CCChar/Infix/index.html @@ -0,0 +1,2 @@ + +Infix (containers.CCChar.Infix)

Module CCChar.Infix

val (=) : t -> t -> bool
  • since 3.3
val (<>) : t -> t -> bool
  • since 3.3
val (<) : t -> t -> bool
  • since 3.3
val (>) : t -> t -> bool
  • since 3.3
val (<=) : t -> t -> bool
  • since 3.3
val (>=) : t -> t -> bool
  • since 3.3
\ No newline at end of file diff --git a/3.10/containers/CCChar/index.html b/3.10/containers/CCChar/index.html new file mode 100644 index 00000000..6433e484 --- /dev/null +++ b/3.10/containers/CCChar/index.html @@ -0,0 +1,2 @@ + +CCChar (containers.CCChar)

Module CCChar

Utils around char

include module type of struct include Stdlib.Char end
val code : char -> int
val chr : int -> char
val escaped : char -> string
val lowercase : char -> char
val uppercase : char -> char
val lowercase_ascii : char -> char
val uppercase_ascii : char -> char
type t = char
val equal : t -> t -> bool
val unsafe_chr : int -> char
val compare : t -> t -> int

The comparison function for characters, with the same specification as Stdlib.compare. Along with the type t, this function compare allows the module Char to be passed as argument to the functors Set.Make and Map.Make.

val of_int_exn : int -> t

Alias to Char.chr. Return the character with the given ASCII code.

  • raises Invalid_argument

    if the int is not within 0 … 255.

  • since 1.0
val of_int : int -> t option

Safe version of of_int_exn.

  • since 1.0
val to_int : t -> int

Alias to Char.code. Return the ASCII code of the argument.

  • since 1.0
val to_string : t -> string

to_string c returns a string containing c

  • since 2.7
val pp_buf : Stdlib.Buffer.t -> t -> unit

Renamed from pp since 2.0.

val pp : Stdlib.Format.formatter -> t -> unit

Renamed from print since 2.0.

Infix Operators

module Infix : sig ... end
include module type of Infix
val (=) : t -> t -> bool
  • since 3.3
val (<>) : t -> t -> bool
  • since 3.3
val (<) : t -> t -> bool
  • since 3.3
val (>) : t -> t -> bool
  • since 3.3
val (<=) : t -> t -> bool
  • since 3.3
val (>=) : t -> t -> bool
  • since 3.3
\ No newline at end of file diff --git a/3.10/containers/CCEither/.dummy b/3.10/containers/CCEither/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCEither/index.html b/3.10/containers/CCEither/index.html new file mode 100644 index 00000000..ec735569 --- /dev/null +++ b/3.10/containers/CCEither/index.html @@ -0,0 +1,20 @@ + +CCEither (containers.CCEither)

Module CCEither

Either Monad

Module that is compatible with Either form OCaml 4.12 but can be use with any ocaml version compatible with container

type 'a iter = ( 'a -> unit ) -> unit
type 'a equal = 'a -> 'a -> bool
type 'a ord = 'a -> 'a -> int
type 'a printer = Stdlib.Format.formatter -> 'a -> unit

Basics

type ('a, 'b) t = ( 'a, 'b ) Either.t =
| Left of 'a
| Right of 'b
val left : 'a -> ( 'a, 'b ) t

left l is Left l

val right : 'b -> ( 'a, 'b ) t

right r is Right r

val is_left : ( 'a, 'b ) t -> bool

is_left x checks if x = Left _

val is_right : ( 'a, 'b ) t -> bool

is_right x checks if x = Right _

val find_left : ( 'a, 'b ) t -> 'a option

find_left x returns l if x = Left l and None otherwise.

val find_right : ( 'a, 'b ) t -> 'b option

find_right x returns r if x = Left r and None otherwise.

val map_left : ( 'a1 -> 'a2 ) -> ( 'a1, 'b ) t -> ( 'a2, 'b ) t

Map of the Left variant.

val map_right : ( 'b1 -> 'b2 ) -> ( 'a, 'b1 ) t -> ( 'a, 'b2 ) t

Map of the Right variant.

val map : + left:( 'a1 -> 'a2 ) -> + right:( 'b1 -> 'b2 ) -> + ( 'a1, 'b1 ) t -> + ( 'a2, 'b2 ) t

Map using left or right.

val fold : left:( 'a -> 'c ) -> right:( 'b -> 'c ) -> ( 'a, 'b ) t -> 'c

Fold using left or right.

val iter : left:( 'a -> unit ) -> right:( 'b -> unit ) -> ( 'a, 'b ) t -> unit

Iter using left or right.

val for_all : + left:( 'a -> bool ) -> + right:( 'b -> bool ) -> + ( 'a, 'b ) t -> + bool

Check some property on Left or Right variant.

val equal : + left:( 'a -> 'a -> bool ) -> + right:( 'b -> 'b -> bool ) -> + ( 'a, 'b ) t -> + ( 'a, 'b ) t -> + bool
val compare : + left:( 'a -> 'a -> int ) -> + right:( 'b -> 'b -> int ) -> + ( 'a, 'b ) t -> + ( 'a, 'b ) t -> + int

IO

val pp : left:'a printer -> right:'b printer -> ( 'a, 'b ) t printer

Pretty printer.

\ No newline at end of file diff --git a/3.10/containers/CCEqual/.dummy b/3.10/containers/CCEqual/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCEqual/Infix/index.html b/3.10/containers/CCEqual/Infix/index.html new file mode 100644 index 00000000..465d90ce --- /dev/null +++ b/3.10/containers/CCEqual/Infix/index.html @@ -0,0 +1,2 @@ + +Infix (containers.CCEqual.Infix)

Module CCEqual.Infix

val (>|=) : 'b t -> ( 'a -> 'b ) -> 'a t

Infix equivalent of map.

\ No newline at end of file diff --git a/3.10/containers/CCEqual/index.html b/3.10/containers/CCEqual/index.html new file mode 100644 index 00000000..324a35f7 --- /dev/null +++ b/3.10/containers/CCEqual/index.html @@ -0,0 +1,2 @@ + +CCEqual (containers.CCEqual)

Module CCEqual

Equality Combinators

type 'a t = 'a -> 'a -> bool

Equality function. Must be transitive, symmetric, and reflexive.

val poly : 'a t

Standard polymorphic equality.

val physical : 'a t

Standard physical equality.

  • since 2.0
val int : int t
val string : string t
val bool : bool t
val float : float t
val unit : unit t
val list : 'a t -> 'a list t
val array : 'a t -> 'a array t
val option : 'a t -> 'a option t
val pair : 'a t -> 'b t -> ('a * 'b) t
val triple : 'a t -> 'b t -> 'c t -> ('a * 'b * 'c) t
val map : ( 'a -> 'b ) -> 'b t -> 'a t

map f eq is the equality function that, given objects x and y, projects x and y using f (e.g. using a record field) and then compares those projections with eq. Example: map fst int compares values of type (int * 'a) by their first component.

val always_eq : _ t

Always returns true. All values are equal.

  • since 3.0
val never_eq : _ t

Always returns false. No values are, so this is not even reflexive (i.e. x=x is false). Be careful!

  • since 3.0
module Infix : sig ... end
include module type of Infix
val (>|=) : 'b t -> ( 'a -> 'b ) -> 'a t

Infix equivalent of map.

\ No newline at end of file diff --git a/3.10/containers/CCEqualLabels/.dummy b/3.10/containers/CCEqualLabels/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCEqualLabels/Infix/index.html b/3.10/containers/CCEqualLabels/Infix/index.html new file mode 100644 index 00000000..b68f9e7b --- /dev/null +++ b/3.10/containers/CCEqualLabels/Infix/index.html @@ -0,0 +1,2 @@ + +Infix (containers.CCEqualLabels.Infix)

Module CCEqualLabels.Infix

val (>|=) : 'b t -> ( 'a -> 'b ) -> 'a t

Infix equivalent of map.

\ No newline at end of file diff --git a/3.10/containers/CCEqualLabels/index.html b/3.10/containers/CCEqualLabels/index.html new file mode 100644 index 00000000..ee9b2a54 --- /dev/null +++ b/3.10/containers/CCEqualLabels/index.html @@ -0,0 +1,2 @@ + +CCEqualLabels (containers.CCEqualLabels)

Module CCEqualLabels

Equality Combinators (Labeled version of CCEqual)

type 'a t = 'a -> 'a -> bool

Equality function. Must be transitive, symmetric, and reflexive.

val poly : 'a t

Standard polymorphic equality.

val physical : 'a t

Standard physical equality.

  • since 2.0
val int : int t
val string : string t
val bool : bool t
val float : float t
val unit : unit t
val list : 'a t -> 'a list t
val array : 'a t -> 'a array t
val option : 'a t -> 'a option t
val pair : 'a t -> 'b t -> ('a * 'b) t
val triple : 'a t -> 'b t -> 'c t -> ('a * 'b * 'c) t
val map : f:( 'a -> 'b ) -> 'b t -> 'a t

map f eq is the equality function that, given objects x and y, projects x and y using f (e.g. using a record field) and then compares those projections with eq. Example: map fst int compares values of type (int * 'a) by their first component.

val always_eq : _ t

Always returns true. All values are equal.

  • since 3.9
val never_eq : _ t

Always returns false. No values are, so this is not even reflexive (i.e. x=x is false). Be careful!

  • since 3.9
module Infix : sig ... end
include module type of Infix
val (>|=) : 'b t -> ( 'a -> 'b ) -> 'a t

Infix equivalent of map.

\ No newline at end of file diff --git a/3.10/containers/CCFloat/.dummy b/3.10/containers/CCFloat/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCFloat/Infix/index.html b/3.10/containers/CCFloat/Infix/index.html new file mode 100644 index 00000000..ebea54a7 --- /dev/null +++ b/3.10/containers/CCFloat/Infix/index.html @@ -0,0 +1,2 @@ + +Infix (containers.CCFloat.Infix)

Module CCFloat.Infix

val (=) : t -> t -> bool
  • since 0.17
val (<>) : t -> t -> bool
  • since 0.17
val (<) : t -> t -> bool
  • since 0.17
val (>) : t -> t -> bool
  • since 0.17
val (<=) : t -> t -> bool
  • since 0.17
val (>=) : t -> t -> bool
  • since 0.17
val (+) : t -> t -> t

Addition.

  • since 2.1
val (-) : t -> t -> t

Subtraction.

  • since 2.1
val (~-) : t -> t

Unary negation.

  • since 2.1
val (*) : t -> t -> t

Multiplication.

  • since 2.1
val (/) : t -> t -> t

Division.

  • since 2.1
\ No newline at end of file diff --git a/3.10/containers/CCFloat/index.html b/3.10/containers/CCFloat/index.html new file mode 100644 index 00000000..d0faa8c8 --- /dev/null +++ b/3.10/containers/CCFloat/index.html @@ -0,0 +1,2 @@ + +CCFloat (containers.CCFloat)

Module CCFloat

Basic operations on floating-point numbers

type t = float
type fpclass = CCShims_.Stdlib.fpclass =
| FP_normal
| FP_subnormal
| FP_zero
| FP_infinite
| FP_nan
val nan : t

nan is Not a Number (NaN). Equal to Stdlib.nan.

val max_value : t

max_value is Positive infinity. Equal to Stdlib.infinity.

val min_value : t

min_value is Negative infinity. Equal to Stdlib.neg_infinity.

val max_finite_value : t

max_finite_value is the largest finite float value. Equal to Stdlib.max_float.

val epsilon : t

epsilon is the smallest positive float x such that 1.0 +. x <> 1.0. Equal to Stdlib.epsilon_float.

val pi : t

pi is the constant pi. The ratio of a circumference to its diameter.

  • since 3.0
val is_nan : t -> bool

is_nan f returns true if f is NaN, false otherwise.

val add : t -> t -> t

add x y is equal to x +. y.

val sub : t -> t -> t

sub x y is equal to x -. y.

val neg : t -> t

neg x is equal to ~-. x.

val abs : t -> t

abs x is the absolute value of the floating-point number x. Equal to Stdlib.abs_float.

val scale : t -> t -> t

scale x y is equal to x *. y.

val min : t -> t -> t

min x y returns the min of the two given values x and y.

val max : t -> t -> t

max x y returns the max of the two given values x and y.

val equal : t -> t -> bool

equal x y is true if x and y are the same.

val compare : t -> t -> int

compare x y is Stdlib.comparexy.

type 'a printer = Stdlib.Format.formatter -> 'a -> unit
type 'a random_gen = Stdlib.Random.State.t -> 'a
val pp : t printer
val hash : t -> int
val random : t -> t random_gen
val random_small : t random_gen
val random_range : t -> t -> t random_gen
val fsign : t -> t

fsign x is one of -1., -0., +0., +1., or nan if x is NaN.

  • since 0.7
val round : t -> t

round x returns the closest integer value, either above or below. For n + 0.5, round returns n.

  • since 0.20
exception TrapNaN of string
val sign_exn : t -> int

sign_exn x will return the sign of x as 1, 0 or -1, or raise an exception TrapNaN if x is NaN. Note that infinities have defined signs in OCaml.

  • since 0.7
val to_int : t -> int

Alias to int_of_float. Unspecified if outside of the range of integers.

val of_int : int -> t

Alias to float_of_int.

val to_string : t -> string
val of_string_exn : string -> t

Alias to float_of_string.

  • raises Failure

    in case of failure.

  • since 1.2
val of_string_opt : string -> t option
  • since 3.0
val equal_precision : epsilon:t -> t -> t -> bool

Equality with allowed error up to a non negative epsilon value.

val classify : t -> fpclass

classify x returns the class of the given floating-point number x: normal, subnormal, zero, infinite or nan (not a number).

Infix Operators

module Infix : sig ... end
include module type of Infix
val (=) : t -> t -> bool
  • since 0.17
val (<>) : t -> t -> bool
  • since 0.17
val (<) : t -> t -> bool
  • since 0.17
val (>) : t -> t -> bool
  • since 0.17
val (<=) : t -> t -> bool
  • since 0.17
val (>=) : t -> t -> bool
  • since 0.17
val (+) : t -> t -> t

Addition.

  • since 2.1
val (-) : t -> t -> t

Subtraction.

  • since 2.1
val (~-) : t -> t

Unary negation.

  • since 2.1
val (*) : t -> t -> t

Multiplication.

  • since 2.1
val (/) : t -> t -> t

Division.

  • since 2.1
\ No newline at end of file diff --git a/3.10/containers/CCFormat/.dummy b/3.10/containers/CCFormat/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCFormat/ANSI_codes/index.html b/3.10/containers/CCFormat/ANSI_codes/index.html new file mode 100644 index 00000000..20bbefbd --- /dev/null +++ b/3.10/containers/CCFormat/ANSI_codes/index.html @@ -0,0 +1,3 @@ + +ANSI_codes (containers.CCFormat.ANSI_codes)

Module CCFormat.ANSI_codes

ANSI escape codes. This contains lower level functions for them.

type color = [
| `Black
| `Red
| `Yellow
| `Green
| `Blue
| `Magenta
| `Cyan
| `White
]

An ANSI color

type style = [
| `FG of color(*

foreground

*)
| `BG of color(*

background

*)
| `Bold
| `Reset
]

A style. Styles can be composed in a list.

val clear_line : string

clear_line is an escape code to clear the current line. It is very useful for progress bars; for example:

let pp_progress i =
+  Printf.printf "%sprogress at %d%!" ANSI_codes.clear_line i

if called repeatedly this will print successive progress messages on a single line.

val reset : string

The escape code to reset style (colors, bold, etc.)

val string_of_style : style -> string

string_of_style st is an escape code to set the current style to st. It can be printed as is on any output that is a compatible terminal.

val string_of_style_list : style list -> string

string_of_style_list styles is an escape code for multiple styles at once. For example string_of_style_list ANSI_codes.([`FG `Red; `BG `Green; `Bold]) is a very shiny style.

\ No newline at end of file diff --git a/3.10/containers/CCFormat/Dump/index.html b/3.10/containers/CCFormat/Dump/index.html new file mode 100644 index 00000000..8fe65078 --- /dev/null +++ b/3.10/containers/CCFormat/Dump/index.html @@ -0,0 +1,2 @@ + +Dump (containers.CCFormat.Dump)

Module CCFormat.Dump

type 'a t = 'a printer
val unit : unit t
val int : int t
val string : string t
val bool : bool t
val float : float t
val char : char t
val int32 : int32 t
val int64 : int64 t
val nativeint : nativeint t
val list : 'a t -> 'a list t
val array : 'a t -> 'a array t
val option : 'a t -> 'a option t
val pair : 'a t -> 'b t -> ('a * 'b) t
val triple : 'a t -> 'b t -> 'c t -> ('a * 'b * 'c) t
val quad : 'a t -> 'b t -> 'c t -> 'd t -> ('a * 'b * 'c * 'd) t
val result : 'a t -> ( 'a, string ) Stdlib.result t
val result' : 'a t -> 'e t -> ( 'a, 'e ) Stdlib.result t
val to_string : 'a t -> 'a -> string
\ No newline at end of file diff --git a/3.10/containers/CCFormat/Infix/index.html b/3.10/containers/CCFormat/Infix/index.html new file mode 100644 index 00000000..bcd5d175 --- /dev/null +++ b/3.10/containers/CCFormat/Infix/index.html @@ -0,0 +1,2 @@ + +Infix (containers.CCFormat.Infix)

Module CCFormat.Infix

val (++) : unit printer -> unit printer -> unit printer

Alias to append.

  • since 3.2
\ No newline at end of file diff --git a/3.10/containers/CCFormat/index.html b/3.10/containers/CCFormat/index.html new file mode 100644 index 00000000..749b1ba5 --- /dev/null +++ b/3.10/containers/CCFormat/index.html @@ -0,0 +1,159 @@ + +CCFormat (containers.CCFormat)

Module CCFormat

Helpers for Format

type 'a iter = ( 'a -> unit ) -> unit
include module type of struct include Stdlib.Format end
type formatter = Stdlib__Format.formatter
val pp_open_box : formatter -> int -> unit
val open_box : int -> unit
val pp_close_box : formatter -> unit -> unit
val close_box : unit -> unit
val pp_open_hbox : formatter -> unit -> unit
val open_hbox : unit -> unit
val pp_open_vbox : formatter -> int -> unit
val open_vbox : int -> unit
val pp_open_hvbox : formatter -> int -> unit
val open_hvbox : int -> unit
val pp_open_hovbox : formatter -> int -> unit
val open_hovbox : int -> unit
val pp_print_string : formatter -> string -> unit
val print_string : string -> unit
val pp_print_bytes : formatter -> bytes -> unit
val print_bytes : bytes -> unit
val pp_print_as : formatter -> int -> string -> unit
val print_as : int -> string -> unit
val pp_print_int : formatter -> int -> unit
val print_int : int -> unit
val pp_print_float : formatter -> float -> unit
val print_float : float -> unit
val pp_print_char : formatter -> char -> unit
val print_char : char -> unit
val pp_print_bool : formatter -> bool -> unit
val print_bool : bool -> unit
val pp_print_space : formatter -> unit -> unit
val print_space : unit -> unit
val pp_print_cut : formatter -> unit -> unit
val print_cut : unit -> unit
val pp_print_break : formatter -> int -> int -> unit
val print_break : int -> int -> unit
val pp_print_custom_break : + formatter -> + fits:(string * int * string) -> + breaks:(string * int * string) -> + unit
val pp_force_newline : formatter -> unit -> unit
val force_newline : unit -> unit
val pp_print_if_newline : formatter -> unit -> unit
val print_if_newline : unit -> unit
val pp_print_flush : formatter -> unit -> unit
val print_flush : unit -> unit
val pp_print_newline : formatter -> unit -> unit
val print_newline : unit -> unit
val pp_set_margin : formatter -> int -> unit
val set_margin : int -> unit
val pp_get_margin : formatter -> unit -> int
val get_margin : unit -> int
val pp_set_max_indent : formatter -> int -> unit
val set_max_indent : int -> unit
val pp_get_max_indent : formatter -> unit -> int
val get_max_indent : unit -> int
type geometry = Stdlib__Format.geometry = {
max_indent : int;
margin : int;
}
val check_geometry : geometry -> bool
val pp_set_geometry : formatter -> max_indent:int -> margin:int -> unit
val set_geometry : max_indent:int -> margin:int -> unit
val pp_safe_set_geometry : formatter -> max_indent:int -> margin:int -> unit
val safe_set_geometry : max_indent:int -> margin:int -> unit
val pp_update_geometry : formatter -> ( geometry -> geometry ) -> unit
val update_geometry : ( geometry -> geometry ) -> unit
val pp_get_geometry : formatter -> unit -> geometry
val get_geometry : unit -> geometry
val pp_set_max_boxes : formatter -> int -> unit
val set_max_boxes : int -> unit
val pp_get_max_boxes : formatter -> unit -> int
val get_max_boxes : unit -> int
val pp_over_max_boxes : formatter -> unit -> bool
val over_max_boxes : unit -> bool
val pp_open_tbox : formatter -> unit -> unit
val open_tbox : unit -> unit
val pp_close_tbox : formatter -> unit -> unit
val close_tbox : unit -> unit
val pp_set_tab : formatter -> unit -> unit
val set_tab : unit -> unit
val pp_print_tab : formatter -> unit -> unit
val print_tab : unit -> unit
val pp_print_tbreak : formatter -> int -> int -> unit
val print_tbreak : int -> int -> unit
val pp_set_ellipsis_text : formatter -> string -> unit
val set_ellipsis_text : string -> unit
val pp_get_ellipsis_text : formatter -> unit -> string
val get_ellipsis_text : unit -> string
type stag = Stdlib__Format.stag = ..
type tag = string
type stag +=
| String_tag of tag
val pp_open_stag : formatter -> stag -> unit
val open_stag : stag -> unit
val pp_close_stag : formatter -> unit -> unit
val close_stag : unit -> unit
val pp_set_tags : formatter -> bool -> unit
val set_tags : bool -> unit
val pp_set_print_tags : formatter -> bool -> unit
val set_print_tags : bool -> unit
val pp_set_mark_tags : formatter -> bool -> unit
val set_mark_tags : bool -> unit
val pp_get_print_tags : formatter -> unit -> bool
val get_print_tags : unit -> bool
val pp_get_mark_tags : formatter -> unit -> bool
val get_mark_tags : unit -> bool
val pp_set_formatter_out_channel : formatter -> Stdlib.out_channel -> unit
val set_formatter_out_channel : Stdlib.out_channel -> unit
val pp_set_formatter_output_functions : + formatter -> + ( string -> int -> int -> unit ) -> + ( unit -> unit ) -> + unit
val set_formatter_output_functions : + ( string -> int -> int -> unit ) -> + ( unit -> unit ) -> + unit
val pp_get_formatter_output_functions : + formatter -> + unit -> + ( string -> int -> int -> unit ) * ( unit -> unit )
val get_formatter_output_functions : + unit -> + ( string -> int -> int -> unit ) * ( unit -> unit )
type formatter_out_functions = Stdlib__Format.formatter_out_functions = {
out_string : string -> int -> int -> unit;
out_flush : unit -> unit;
out_newline : unit -> unit;
out_spaces : int -> unit;
out_indent : int -> unit;
}
val pp_set_formatter_out_functions : + formatter -> + formatter_out_functions -> + unit
val set_formatter_out_functions : formatter_out_functions -> unit
val pp_get_formatter_out_functions : + formatter -> + unit -> + formatter_out_functions
val get_formatter_out_functions : unit -> formatter_out_functions
type formatter_stag_functions = Stdlib__Format.formatter_stag_functions = {
mark_open_stag : stag -> string;
mark_close_stag : stag -> string;
print_open_stag : stag -> unit;
print_close_stag : stag -> unit;
}
val pp_set_formatter_stag_functions : + formatter -> + formatter_stag_functions -> + unit
val set_formatter_stag_functions : formatter_stag_functions -> unit
val pp_get_formatter_stag_functions : + formatter -> + unit -> + formatter_stag_functions
val get_formatter_stag_functions : unit -> formatter_stag_functions
val formatter_of_out_channel : Stdlib.out_channel -> formatter
val std_formatter : formatter
val err_formatter : formatter
val formatter_of_buffer : Stdlib.Buffer.t -> formatter
val stdbuf : Stdlib.Buffer.t
val str_formatter : formatter
val flush_str_formatter : unit -> string
val make_formatter : + ( string -> int -> int -> unit ) -> + ( unit -> unit ) -> + formatter
val formatter_of_out_functions : formatter_out_functions -> formatter
type symbolic_output_item = Stdlib__Format.symbolic_output_item =
| Output_flush
| Output_newline
| Output_string of string
| Output_spaces of int
| Output_indent of int
type symbolic_output_buffer = Stdlib__Format.symbolic_output_buffer
val make_symbolic_output_buffer : unit -> symbolic_output_buffer
val clear_symbolic_output_buffer : symbolic_output_buffer -> unit
val get_symbolic_output_buffer : + symbolic_output_buffer -> + symbolic_output_item list
val flush_symbolic_output_buffer : + symbolic_output_buffer -> + symbolic_output_item list
val add_symbolic_output_item : + symbolic_output_buffer -> + symbolic_output_item -> + unit
val formatter_of_symbolic_output_buffer : symbolic_output_buffer -> formatter
val pp_print_list : + ?pp_sep:( formatter -> unit -> unit ) -> + ( formatter -> 'a -> unit ) -> + formatter -> + 'a list -> + unit
val pp_print_seq : + ?pp_sep:( formatter -> unit -> unit ) -> + ( formatter -> 'a -> unit ) -> + formatter -> + 'a Stdlib.Seq.t -> + unit
val pp_print_text : formatter -> string -> unit
val pp_print_option : + ?none:( formatter -> unit -> unit ) -> + ( formatter -> 'a -> unit ) -> + formatter -> + 'a option -> + unit
val pp_print_result : + ok:( formatter -> 'a -> unit ) -> + error:( formatter -> 'e -> unit ) -> + formatter -> + ( 'a, 'e ) Stdlib.result -> + unit
val pp_print_either : + left:( formatter -> 'a -> unit ) -> + right:( formatter -> 'b -> unit ) -> + formatter -> + ( 'a, 'b ) Stdlib.Either.t -> + unit
val printf : ( 'a, formatter, unit ) Stdlib.format -> 'a
val eprintf : ( 'a, formatter, unit ) Stdlib.format -> 'a
val asprintf : ( 'a, formatter, unit, string ) Stdlib.format4 -> 'a
val dprintf : ( 'a, formatter, unit, formatter -> unit ) Stdlib.format4 -> 'a
val ifprintf : formatter -> ( 'a, formatter, unit ) Stdlib.format -> 'a
val kfprintf : + ( formatter -> 'a ) -> + formatter -> + ( 'b, formatter, unit, 'a ) Stdlib.format4 -> + 'b
val kdprintf : + ( ( formatter -> unit ) -> 'a ) -> + ( 'b, formatter, unit, 'a ) Stdlib.format4 -> + 'b
val ikfprintf : + ( formatter -> 'a ) -> + formatter -> + ( 'b, formatter, unit, 'a ) Stdlib.format4 -> + 'b
val kasprintf : + ( string -> 'a ) -> + ( 'b, formatter, unit, 'a ) Stdlib.format4 -> + 'b
val bprintf : Stdlib.Buffer.t -> ( 'a, formatter, unit ) Stdlib.format -> 'a
val kprintf : ( string -> 'a ) -> ( 'b, unit, string, 'a ) Stdlib.format4 -> 'b
val set_all_formatter_output_functions : + out:( string -> int -> int -> unit ) -> + flush:( unit -> unit ) -> + newline:( unit -> unit ) -> + spaces:( int -> unit ) -> + unit
val get_all_formatter_output_functions : + unit -> + ( string -> + int -> + int -> + unit ) + * ( unit -> + unit ) + * ( unit -> + unit ) + * ( int -> + unit )
val pp_set_all_formatter_output_functions : + formatter -> + out:( string -> int -> int -> unit ) -> + flush:( unit -> unit ) -> + newline:( unit -> unit ) -> + spaces:( int -> unit ) -> + unit
val pp_get_all_formatter_output_functions : + formatter -> + unit -> + ( string -> + int -> + int -> + unit ) + * ( unit -> + unit ) + * ( unit -> + unit ) + * ( int -> + unit )
val pp_open_tag : formatter -> tag -> unit
val open_tag : tag -> unit
val pp_close_tag : formatter -> unit -> unit
val close_tag : unit -> unit
type formatter_tag_functions = Stdlib__Format.formatter_tag_functions = {
mark_open_tag : tag -> string;
mark_close_tag : tag -> string;
print_open_tag : tag -> unit;
print_close_tag : tag -> unit;
}
val pp_set_formatter_tag_functions : + formatter -> + formatter_tag_functions -> + unit
val set_formatter_tag_functions : formatter_tag_functions -> unit
val pp_get_formatter_tag_functions : + formatter -> + unit -> + formatter_tag_functions
val get_formatter_tag_functions : unit -> formatter_tag_functions
type t = Stdlib.Format.formatter
type -'a printer = t -> 'a -> unit

Combinators

val silent : 'a printer

Prints nothing.

val unit : unit printer

Prints "()".

val int : int printer
val string : string printer
val bool : bool printer
val float3 : float printer
val float : float printer
val exn : exn printer

Printer using Printexc.to_string.

  • since 3.0
val space : unit printer

Alias to pp_print_space.

  • since 3.2
val cut : unit printer

Alias to pp_print_cut.

  • since 3.2
val break : (int * int) printer

Tuple-ized printer form of pp_print_break.

  • since 3.2
val newline : unit printer

Force newline (see Format.pp_force_newline).

  • since 1.2
val substring : (string * int * int) printer

substring (s,i,len) prints the substring (s,i,len), where i is the offset in s and len the number of bytes in the substring.

  • raises Invalid_argument

    if the triple (s,i,len) does not describe a proper substring.

  • since 1.2
val text : string printer

Print string, but replacing spaces with breaks and newlines with newline. See pp_print_text on recent versions of OCaml.

  • since 1.2
val string_lines : string printer

string_lines out s prints s with all newlines ('\n') replaced by a cut, in a vertical box. It does NOT insert breakable spaces in place of spaces, unlike text. This means an already formatted string can be displayed inside another formatter without mangling the indentation.

  • since 3.3
val char : char printer
  • since 0.14
val int32 : int32 printer
  • since 0.14
val int64 : int64 printer
  • since 0.14
val nativeint : nativeint printer
  • since 0.14
val flush : unit printer

Alias to Format.pp_print_flush.

  • since 1.2
val string_quoted : string printer

Similar to CCString.print.

  • since 0.14
val list : ?sep:unit printer -> 'a printer -> 'a list printer
val array : ?sep:unit printer -> 'a printer -> 'a array printer
val arrayi : ?sep:unit printer -> (int * 'a) printer -> 'a array printer
val seq : ?sep:unit printer -> 'a printer -> 'a Stdlib.Seq.t printer
val iter : ?sep:unit printer -> 'a printer -> 'a iter printer
val opt : 'a printer -> 'a option printer

opt pp prints options as follows:

  • Some x will become "some foo" if pp x ---> "foo".
  • None will become "none".

In the tuple printers, the sep argument is only available.

val pair : ?sep:unit printer -> 'a printer -> 'b printer -> ('a * 'b) printer
val triple : + ?sep:unit printer -> + 'a printer -> + 'b printer -> + 'c printer -> + ('a * 'b * 'c) printer
val quad : + ?sep:unit printer -> + 'a printer -> + 'b printer -> + 'c printer -> + 'd printer -> + ('a * 'b * 'c * 'd) printer
val append : unit printer -> unit printer -> unit printer

append ppa ppb first prints ppa (), then prints ppb ().

  • since 3.2
val append_l : unit printer list -> unit printer

append_l pps runs the printers in pps sequentially.

  • since 3.2
val within : string -> string -> 'a printer -> 'a printer

within a b p wraps p inside the strings a and b. Convenient, for instances, for brackets, parenthesis, quotes, etc.

  • since 0.17
val map : ( 'a -> 'b ) -> 'b printer -> 'a printer
val vbox : ?i:int -> 'a printer -> 'a printer

Wrap the printer in a vertical box.

  • parameter i

    level of indentation within the box (default 0).

  • since 0.16
val hvbox : ?i:int -> 'a printer -> 'a printer

Wrap the printer in a horizontal/vertical box.

  • parameter i

    level of indentation within the box (default 0).

  • since 0.16
val hovbox : ?i:int -> 'a printer -> 'a printer

Wrap the printer in a horizontal or vertical box.

  • parameter i

    level of indentation within the box (default 0).

  • since 0.16
val hbox : 'a printer -> 'a printer

Wrap the printer in an horizontal box.

  • since 0.16
val return : ( 'a, _, _, 'a ) Stdlib.format4 -> unit printer

return "some_format_string" takes a argument-less format string and returns a printer actionable by (). Examples:

  • return ",@ "
  • return "@{<Red>and then@}@,"
  • return "@[<v>a@ b@]"
  • since 1.0
val of_to_string : ( 'a -> string ) -> 'a printer

of_to_string f converts its input to a string using f, then prints the string.

  • since 1.0
val const : 'a printer -> 'a -> unit printer

const pp x is a unit printer that uses pp on x.

  • since 1.0
val some : 'a printer -> 'a option printer

some pp will print options as follows:

  • Some x is printed using pp on x
  • None is not printed at all
  • since 1.0
val const_string : string -> 'a printer

const_string s is a printer that ignores its input and always prints s.

  • since 3.5
val opaque : 'a printer

opaque is const_string "opaque". The exact string used is not stable.

  • since 3.5
val lazy_force : 'a printer -> 'a lazy_t printer

lazy_force pp out x forces x and prints the result with pp.

  • since 2.0
val lazy_or : ?default:unit printer -> 'a printer -> 'a lazy_t printer

lazy_or ?default pp out x prints default if x is not evaluated yet, or uses pp otherwise.

  • since 2.0

ANSI codes

Use ANSI escape codes https://en.wikipedia.org/wiki/ANSI_escape_code to put some colors on the terminal.

This uses tags in format strings to specify the style. Current styles are the following:

Example:

set_color_default true;;
+
+Format.printf
+  "what is your @{<White>favorite color@}? @{<blue>blue@}! No, @{<red>red@}! Ahhhhhhh@.";;

status: unstable

val set_color_tag_handling : t -> unit

Add functions to support color tags to the given formatter.

  • since 0.15
val set_color_default : bool -> unit

set_color_default b enables color handling on the standard formatters (stdout, stderr) if b = true as well as on sprintf formatters; it disables the color handling if b = false.

val with_color : string -> 'a printer -> 'a printer

with_color "Blue" pp behaves like the printer pp, but with the given style.

status: unstable

  • since 0.16
val with_colorf : string -> t -> ( 'a, t, unit, unit ) Stdlib.format4 -> 'a

with_colorf "Blue" out "%s %d" "yolo" 42 will behave like Format.fprintf, but wrapping the content with the given style.

status: unstable

  • since 0.16
val with_color_sf : string -> ( 'a, t, unit, string ) Stdlib.format4 -> 'a

with_color_sf "Blue" out "%s %d" "yolo" 42 will behave like sprintf, but wrapping the content with the given style.

Example:

CCFormat.with_color_sf "red" "%a" CCFormat.Dump.(list int) [1;2;3] |> print_endline;;

status: unstable

  • since 0.21
val with_color_ksf : + f:( string -> 'b ) -> + string -> + ( 'a, t, unit, 'b ) Stdlib.format4 -> + 'a

with_color_ksf "Blue" ~f "%s %d" "yolo" 42 will behave like ksprintf, but wrapping the content with the given style.

Example: the following with raise Failure with a colored message

CCFormat.with_color_ksf "red" ~f:failwith "%a" CCFormat.Dump.(list int) [1;2;3];;
  • since 1.2
module ANSI_codes : sig ... end

ANSI escape codes. This contains lower level functions for them.

val styling : ANSI_codes.style list -> 'a printer -> 'a printer

styling st p is the same printer as p, except it locally sets the style st.

Example:

open CCFormat;
+set_color_default true;
+sprintf
+  "what is your %a? %a! No, %a! Ahhhhhhh@."
+  (styling [`FG `White; `Bold] string) "favorite color"
+  (styling [`FG `Blue] string) "blue"
+  (styling [`FG `Red] string) "red"

Available only on OCaml >= 4.08.

  • since 3.7
val with_styling : ANSI_codes.style list -> t -> ( unit -> 'a ) -> 'a

with_styling style fmt f sets the given style on fmt, calls f(), then restores the previous style. It is useful in imperative-style printers (a sequence of "print a; print b; …").

Available only on OCaml >= 4.08.

  • since 3.7

IO

val output : t -> 'a printer -> 'a -> unit
val to_string : 'a printer -> 'a -> string
val of_chan : Stdlib.out_channel -> t

Alias to Format.formatter_of_out_channel.

  • since 1.2
val with_out_chan : Stdlib.out_channel -> ( t -> 'a ) -> 'a

with_out_chan oc f turns oc into a formatter fmt, and call f fmt. Behaves like f fmt from then on, but whether the call to f fails or returns, fmt is flushed before the call terminates.

  • since 1.2
val stdout : t
val stderr : t
val tee : t -> t -> t

tee a b makes a new formatter that writes in both a and b.

  • since 1.0
val sprintf : ( 'a, t, unit, string ) Stdlib.format4 -> 'a

Print into a string any format string that would usually be compatible with fprintf. Like Format.asprintf.

val sprintf_no_color : ( 'a, t, unit, string ) Stdlib.format4 -> 'a

Like sprintf but never prints colors.

  • since 0.16
val sprintf_dyn_color : + colors:bool -> + ( 'a, t, unit, string ) Stdlib.format4 -> + 'a

Like sprintf but enable/disable colors depending on colors.

Example:

(* with colors *)
+CCFormat.sprintf_dyn_color ~colors:true "@{<Red>%a@}"
+  CCFormat.Dump.(list int) [1;2;3] |> print_endline;;
+
+(* without colors *)
+CCFormat.sprintf_dyn_color ~colors:false "@{<Red>%a@}"
+  CCFormat.Dump.(list int) [1;2;3] |> print_endline;;
  • since 0.21
val fprintf : t -> ( 'a, t, unit ) Stdlib.format -> 'a

Alias to Format.fprintf.

  • since 0.14
val fprintf_dyn_color : colors:bool -> t -> ( 'a, t, unit ) Stdlib.format -> 'a

Like fprintf but enable/disable colors depending on colors.

  • since 0.21
val ksprintf : + ?margin:int -> + f:( string -> 'b ) -> + ( 'a, Stdlib.Format.formatter, unit, 'b ) Stdlib.format4 -> + 'a

ksprintf fmt ~f formats using fmt, in a way similar to sprintf, and then calls f on the resulting string.

  • parameter margin

    set margin (since 2.1)

  • since 0.14
val to_file : string -> ( 'a, t, unit, unit ) Stdlib.format4 -> 'a

Print to the given file.

Dump

Print structures as OCaml values, so that they can be parsed back by OCaml (typically, in the toplevel, for debugging).

Example:

Format.printf "%a@." CCFormat.Dump.(list int) CCList.(1 -- 200);;
+
+Format.printf "%a@." CCFormat.Dump.(array (list (pair int bool)))
+  [| [1, true; 2, false]; []; [42, false] |];;
module Dump : sig ... end
module Infix : sig ... end
include module type of Infix
val (++) : unit printer -> unit printer -> unit printer

Alias to append.

  • since 3.2
\ No newline at end of file diff --git a/3.10/containers/CCFun/.dummy b/3.10/containers/CCFun/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCFun/Infix/index.html b/3.10/containers/CCFun/Infix/index.html new file mode 100644 index 00000000..d0db4a09 --- /dev/null +++ b/3.10/containers/CCFun/Infix/index.html @@ -0,0 +1,2 @@ + +Infix (containers.CCFun.Infix)

Module CCFun.Infix

val (|>) : 'a -> ( 'a -> 'b ) -> 'b

x |> f is the same as f x. A 'pipe' operator.

val (@@) : ( 'a -> 'b ) -> 'a -> 'b

f @@ x is the same as f x, but right-associative.

  • since 0.5
val (%>) : ( 'a -> 'b ) -> ( 'b -> 'c ) -> 'a -> 'c

(f %> g) x or (%>) f g x is g (f x). Alias to compose.

val (%) : ( 'b -> 'c ) -> ( 'a -> 'b ) -> 'a -> 'c

(f % g) x or (%) f g x is f (g x). Mathematical composition.

\ No newline at end of file diff --git a/3.10/containers/CCFun/Monad/argument-1-X/index.html b/3.10/containers/CCFun/Monad/argument-1-X/index.html new file mode 100644 index 00000000..d1fee256 --- /dev/null +++ b/3.10/containers/CCFun/Monad/argument-1-X/index.html @@ -0,0 +1,2 @@ + +X (containers.CCFun.Monad.1-X)

Parameter Monad.1-X

type t
\ No newline at end of file diff --git a/3.10/containers/CCFun/Monad/index.html b/3.10/containers/CCFun/Monad/index.html new file mode 100644 index 00000000..50ce200f --- /dev/null +++ b/3.10/containers/CCFun/Monad/index.html @@ -0,0 +1,2 @@ + +Monad (containers.CCFun.Monad)

Module CCFun.Monad

Parameters

module X : sig ... end

Signature

type 'a t = X.t -> 'a
val return : 'a -> 'a t

Monadic return.

val (>|=) : 'a t -> ( 'a -> 'b ) -> 'b t
val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t

Monadic bind.

\ No newline at end of file diff --git a/3.10/containers/CCFun/index.html b/3.10/containers/CCFun/index.html new file mode 100644 index 00000000..bdd28b42 --- /dev/null +++ b/3.10/containers/CCFun/index.html @@ -0,0 +1,9 @@ + +CCFun (containers.CCFun)

Module CCFun

Basic operations on Functions

val id : 'a -> 'a
val const : 'a -> 'b -> 'a
val flip : ( 'a -> 'b -> 'c ) -> 'b -> 'a -> 'c
val negate : ( 'a -> bool ) -> 'a -> bool
val protect : finally:( unit -> unit ) -> ( unit -> 'a ) -> 'a
exception Finally_raised of exn
val compose : ( 'a -> 'b ) -> ( 'b -> 'c ) -> 'a -> 'c

compose f g x is g (f x). Composition.

val compose_binop : ( 'a -> 'b ) -> ( 'b -> 'b -> 'c ) -> 'a -> 'a -> 'c

compose_binop f g is fun x y -> g (f x) (f y). Example (partial order): List.sort (compose_binop fst CCInt.compare) [1, true; 2, false; 1, false].

  • since 0.6
val curry : ( ('a * 'b) -> 'c ) -> 'a -> 'b -> 'c

curry f x y is f (x,y). Convert a function which accepts a pair of arguments into a function which accepts two arguments.

val uncurry : ( 'a -> 'b -> 'c ) -> ('a * 'b) -> 'c

uncurry f (x,y) is f x y. Convert a function which accepts a two arguments into a function which accepts a pair of arguments.

val tap : ( 'a -> _ ) -> 'a -> 'a

tap f x evaluates f x, discards it, then returns x. Useful in a pipeline, for instance:

CCArray.(1 -- 10)
+|> tap CCArray.shuffle
+|> tap @@ CCArray.sort Stdlib.compare
val lexicographic : + ( 'a -> 'a -> int ) -> + ( 'a -> 'a -> int ) -> + 'a -> + 'a -> + int

Lexicographic combination of comparison functions.

val finally : h:( unit -> _ ) -> f:( unit -> 'a ) -> 'a

finally ~h f calls f () and returns its result. If it raises, the same exception is raised; in any case, h () is called after f () terminates. If h () raises an exception, then this exception will be passed on and any exception that may have been raised by f () is lost.

val finally1 : h:( unit -> _ ) -> ( 'a -> 'b ) -> 'a -> 'b

finally1 ~h f x is the same as f x, but after the computation, h () is called whether f x rose an exception or not. If h () raises an exception, then this exception will be passed on and any exception that may have been raised by f () is lost.

  • since 0.16
val finally2 : h:( unit -> _ ) -> ( 'a -> 'b -> 'c ) -> 'a -> 'b -> 'c

finally2 ~h f x y is the same as f x y, but after the computation, h () is called whether f x y rose an exception or not. If h () raises an exception, then this exception will be passed on and any exception that may have been raised by f () is lost.

  • since 0.16
val opaque_identity : 'a -> 'a

opaque_identity x is like x, but prevents Flambda from using x's definition for optimizing it. (flambda is an optimization/inlining pass in OCaml >= 4.03).

  • since 0.18
val iterate : int -> ( 'a -> 'a ) -> 'a -> 'a

iterate n f is f iterated n times. That is to say, iterate 0 f x is x, iterate 1 f x is f x, iterate 2 f x is f (f x), etc.

  • since 2.1

Infix

Infix operators.

module Infix : sig ... end
include module type of Infix
val (|>) : 'a -> ( 'a -> 'b ) -> 'b

x |> f is the same as f x. A 'pipe' operator.

val (@@) : ( 'a -> 'b ) -> 'a -> 'b

f @@ x is the same as f x, but right-associative.

  • since 0.5
val (%>) : ( 'a -> 'b ) -> ( 'b -> 'c ) -> 'a -> 'c

(f %> g) x or (%>) f g x is g (f x). Alias to compose.

val (%) : ( 'b -> 'c ) -> ( 'a -> 'b ) -> 'a -> 'c

(f % g) x or (%) f g x is f (g x). Mathematical composition.

Monad

Functions with a fixed domain are monads in their codomain.

module Monad (X : sig ... end) : sig ... end
\ No newline at end of file diff --git a/3.10/containers/CCHash/.dummy b/3.10/containers/CCHash/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCHash/index.html b/3.10/containers/CCHash/index.html new file mode 100644 index 00000000..c3e4c95b --- /dev/null +++ b/3.10/containers/CCHash/index.html @@ -0,0 +1,4 @@ + +CCHash (containers.CCHash)

Module CCHash

Hash combinators

The API of this module is stable as per semantic versioning, like the rest of containers. However the exact implementation of hashing function can change and should not be relied on (i.e. hashing a value always returns the same integer within a run of a program, not across versions of OCaml and Containers).

Definitions

type hash = int

A hash value is a positive integer.

type 'a t = 'a -> hash

A hash function for values of type 'a.

val const : hash -> _ t

const h hashes any value into h. Use with caution!.

val const0 : _ t

Always return 0. Useful for ignoring elements. Example: Hash.(pair string const0) will map pairs ("a", 1) and ("a", 2) to the same hash, but not the same as ("b", 1).

  • since 1.5
val int : int t
val bool : bool t
val char : char t
val int32 : int32 t
val int64 : int64 t
val nativeint : nativeint t
val slice : string -> int -> int t

slice s i len state hashes the slice i, …, i+len-1 of s into state.

val bytes : bytes t

Hash a byte array.

  • since 3.5
val string : string t
val list : 'a t -> 'a list t
val array : 'a t -> 'a array t
val opt : 'a t -> 'a option t
val pair : 'a t -> 'b t -> ('a * 'b) t
val triple : 'a t -> 'b t -> 'c t -> ('a * 'b * 'c) t
val quad : 'a t -> 'b t -> 'c t -> 'd t -> ('a * 'b * 'c * 'd) t
val map : ( 'a -> 'b ) -> 'b t -> 'a t

map f h is the hasher that takes x, and uses h to hash f x.

For example:

module Str_set = Set.Make(String)
+
+let hash_str_set : Str_set.t CCHash.t = CCHash.(map Str_set.to_seq @@ seq string)
  • since 3.5
val if_ : bool -> 'a t -> 'a t -> 'a t

Decide which hash function to use depending on the boolean.

val poly : 'a t

poly x is Hashtbl.hash x. The regular polymorphic hash function.

val list_comm : 'a t -> 'a list t

Commutative version of list. Lists that are equal up to permutation will have the same hash.

  • since 1.0
val array_comm : 'a t -> 'a array t

Commutative version of array. Arrays that are equal up to permutation will have the same hash.

  • since 1.0

Base hash combinators

val combine : 'a t -> hash -> 'a -> hash
val combine2 : hash -> hash -> hash
val combine3 : hash -> hash -> hash -> hash
val combine4 : hash -> hash -> hash -> hash -> hash
val combine5 : hash -> hash -> hash -> hash -> hash -> hash
  • since 2.1
val combine6 : hash -> hash -> hash -> hash -> hash -> hash -> hash
  • since 2.1

Iterators

type 'a iter = ( 'a -> unit ) -> unit
type 'a gen = unit -> 'a option
val seq : 'a t -> 'a Stdlib.Seq.t t
val iter : 'a t -> 'a iter t
val gen : 'a t -> 'a gen t
\ No newline at end of file diff --git a/3.10/containers/CCHashtbl/.dummy b/3.10/containers/CCHashtbl/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCHashtbl/Make/index.html b/3.10/containers/CCHashtbl/Make/index.html new file mode 100644 index 00000000..c4342245 --- /dev/null +++ b/3.10/containers/CCHashtbl/Make/index.html @@ -0,0 +1,22 @@ + +Make (containers.CCHashtbl.Make)

Module CCHashtbl.Make

Parameters

module X : Stdlib.Hashtbl.HashedType

Signature

include Stdlib.Hashtbl.S + with type key = X.t + with type 'a t = 'a Stdlib.Hashtbl.Make(X).t
type key = X.t
type 'a t = 'a Stdlib.Hashtbl.Make(X).t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : ( key -> 'a -> unit ) -> 'a t -> unit
val filter_map_inplace : ( key -> 'a -> 'a option ) -> 'a t -> unit
val fold : ( key -> 'a -> 'b -> 'b ) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> Stdlib__Hashtbl.statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val get : 'a t -> key -> 'a option

get tbl k finds a binding for the key k if present, or returns None if no value is found. Safe version of Hashtbl.find.

val get_or : 'a t -> key -> default:'a -> 'a

get_or tbl k ~default returns the value associated to k if present, and returns default otherwise (if k doesn't belong in tbl).

  • since 0.16
val add_list : 'a list t -> key -> 'a -> unit

add_list tbl x y adds y to the list x is bound to. If x is not bound, it becomes bound to y.

  • since 0.16
val incr : ?by:int -> int t -> key -> unit

incr ?by tbl x increments or initializes the counter associated with x. If get tbl x = None, then after update, get tbl x = Some 1; otherwise, if get tbl x = Some n, now get tbl x = Some (n+1).

  • parameter by

    if specified, the int value is incremented by by rather than 1.

  • since 0.16
val decr : ?by:int -> int t -> key -> unit

decr ?by tbl x is like incr but subtract 1 (or the value of by). If the value reaches 0, the key is removed from the table. This does nothing if the key is not already present in the table.

  • since 0.16
val keys : 'a t -> key iter

keys tbl f iterates on keys (similar order as Hashtbl.iter).

val values : 'a t -> 'a iter

values tbl f iterates on values in the table.

val keys_list : _ t -> key list

keys_list tbl is the list of keys in tbl. If the key is in the Hashtable multiple times, all occurrences will be returned.

  • since 0.8
val values_list : 'a t -> 'a list

values_list t is the list of values in t.

  • since 0.8
val map_list : ( key -> 'a -> 'b ) -> 'a t -> 'b list

Map on a hashtable's items, collect into a list.

val to_iter : 'a t -> (key * 'a) iter

Iterate on bindings in the table.

  • since 2.8
val add_iter : 'a t -> (key * 'a) iter -> unit

Add the corresponding pairs to the table, using Hashtbl.add.

  • since 2.8
val add_iter_with : + f:( key -> 'a -> 'a -> 'a ) -> + 'a t -> + (key * 'a) iter -> + unit

Add the corresponding pairs to the table, using Hashtbl.add. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit

Add the corresponding pairs to the table, using Hashtbl.add. Renamed from add_std_seq since 3.0.

  • since 3.0
val add_seq_with : + f:( key -> 'a -> 'a -> 'a ) -> + 'a t -> + (key * 'a) Stdlib.Seq.t -> + unit

Add the corresponding pairs to the table, using Hashtbl.add. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val of_iter : (key * 'a) iter -> 'a t

From the given bindings, added in order.

  • since 2.8
val of_iter_with : f:( key -> 'a -> 'a -> 'a ) -> (key * 'a) iter -> 'a t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

From the given bindings, added in order. Renamed from of_std_seq since 3.0.

  • since 3.0
val of_seq_with : + f:( key -> 'a -> 'a -> 'a ) -> + (key * 'a) Stdlib.Seq.t -> + 'a t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val add_iter_count : int t -> key iter -> unit

add_iter_count tbl i increments the count of each element of i by calling incr. This is useful for counting how many times each element of i occurs.

  • since 2.8
val add_seq_count : int t -> key Stdlib.Seq.t -> unit

add_seq_count tbl seq increments the count of each element of seq by calling incr. This is useful for counting how many times each element of seq occurs. Renamed from of_std_seq_count since 3.0.

  • since 3.0
val of_iter_count : key iter -> int t

Like add_seq_count, but allocates a new table and returns it.

  • since 2.8
val of_seq_count : key Stdlib.Seq.t -> int t

Like add_seq_count, but allocates a new table and returns it. Renamed from of_std_seq_count since 3.0.

  • since 3.0
val to_list : 'a t -> (key * 'a) list

to_list tbl returns the list of (key,value) bindings (order unspecified).

val of_list : (key * 'a) list -> 'a t

of_list l builds a table from the given list l of bindings k_i -> v_i, added in order using add. If a key occurs several times, it will be added several times, and the visible binding will be the last one.

val of_list_with : f:( key -> 'a -> 'a -> 'a ) -> (key * 'a) list -> 'a t

of_list l builds a table from the given list l of bindings k_i -> v_i. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val update : 'a t -> f:( key -> 'a option -> 'a option ) -> k:key -> unit

update tbl ~f ~k updates key k by calling f k (Some v) if k was mapped to v, or f k None otherwise; if the call returns None then k is removed/stays removed, if the call returns Some v' then the binding k -> v' is inserted using Hashtbl.replace.

  • since 0.14
val get_or_add : 'a t -> f:( key -> 'a ) -> k:key -> 'a

get_or_add tbl ~k ~f finds and returns the binding of k in tbl, if it exists. If it does not exist, then f k is called to obtain a new binding v; k -> v is added to tbl and v is returned.

  • since 1.0
val pp : + ?pp_start:unit printer -> + ?pp_stop:unit printer -> + ?pp_sep:unit printer -> + ?pp_arrow:unit printer -> + key printer -> + 'a printer -> + 'a t printer

pp ~pp_start ~pp_stop ~pp_sep ~pp arrow pp_k pp_v returns a table printer given a pp_k printer for individual key and a pp_v printer for individual value. pp_start and pp_stop control the opening and closing delimiters, by default print nothing. pp_sep control the separator between binding. pp_arrow control the arrow between the key and value. Renamed from print since 2.0.

  • since 0.13
\ No newline at end of file diff --git a/3.10/containers/CCHashtbl/Poly/index.html b/3.10/containers/CCHashtbl/Poly/index.html new file mode 100644 index 00000000..a6abfb61 --- /dev/null +++ b/3.10/containers/CCHashtbl/Poly/index.html @@ -0,0 +1,30 @@ + +Poly (containers.CCHashtbl.Poly)

Module CCHashtbl.Poly

val get : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'a -> 'b option

get tbl k finds a binding for the key k if present, or returns None if no value is found. Safe version of Hashtbl.find.

val get_or : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'a -> default:'b -> 'b

get_or tbl k ~default returns the value associated to k if present, and returns default otherwise (if k doesn't belong in tbl).

  • since 0.16
val keys : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'a iter

keys tbl f iterates on keys (similar order as Hashtbl.iter).

val values : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'b iter

values tbl f iterates on values in the table tbl.

val keys_list : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'a list

keys_list tbl is the list of keys in tbl. If the key is in the Hashtable multiple times, all occurrences will be returned.

  • since 0.8
val values_list : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'b list

values_list tbl is the list of values in tbl.

  • since 0.8
val map_list : ( 'a -> 'b -> 'c ) -> ( 'a, 'b ) Stdlib.Hashtbl.t -> 'c list

map_list f tbl maps on a tbl's items. Collect into a list.

val incr : ?by:int -> ( 'a, int ) Stdlib.Hashtbl.t -> 'a -> unit

incr ?by tbl x increments or initializes the counter associated with x. If get tbl x = None, then after update, get tbl x = Some 1; otherwise, if get tbl x = Some n, now get tbl x = Some (n+1).

  • parameter by

    if specified, the int value is incremented by by rather than 1.

  • since 0.16
val decr : ?by:int -> ( 'a, int ) Stdlib.Hashtbl.t -> 'a -> unit

decr ?by tbl x is like incr but subtract 1 (or the value of by). If the value reaches 0, the key is removed from the table. This does nothing if the key is not already present in the table.

  • since 0.16
val to_iter : ( 'a, 'b ) Stdlib.Hashtbl.t -> ('a * 'b) iter

Iterate on bindings in the table.

  • since 2.8
val add_list : ( 'a, 'b list ) Stdlib.Hashtbl.t -> 'a -> 'b -> unit

add_list tbl x y adds y to the list x is bound to. If x is not bound, it becomes bound to y.

  • since 0.16
val add_iter : ( 'a, 'b ) Stdlib.Hashtbl.t -> ('a * 'b) iter -> unit

Add the corresponding pairs to the table, using Hashtbl.add.

  • since 2.8
val add_iter_with : + f:( 'a -> 'b -> 'b -> 'b ) -> + ( 'a, 'b ) Stdlib.Hashtbl.t -> + ('a * 'b) iter -> + unit

Add the corresponding pairs to the table, using Hashtbl.add. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val add_seq : ( 'a, 'b ) Stdlib.Hashtbl.t -> ('a * 'b) Stdlib.Seq.t -> unit

Add the corresponding pairs to the table, using Hashtbl.add. Renamed from add_std_seq since 3.0.

  • since 3.0
val add_seq_with : + f:( 'a -> 'b -> 'b -> 'b ) -> + ( 'a, 'b ) Stdlib.Hashtbl.t -> + ('a * 'b) Stdlib.Seq.t -> + unit

Add the corresponding pairs to the table. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val of_iter : ('a * 'b) iter -> ( 'a, 'b ) Stdlib.Hashtbl.t

From the given bindings, added in order.

  • since 2.8
val of_iter_with : + f:( 'a -> 'b -> 'b -> 'b ) -> + ('a * 'b) iter -> + ( 'a, 'b ) Stdlib.Hashtbl.t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val of_seq : ('a * 'b) Stdlib.Seq.t -> ( 'a, 'b ) Stdlib.Hashtbl.t

From the given bindings, added in order. Renamed from of_std_seq since 3.0.

  • since 3.0
val of_seq_with : + f:( 'a -> 'b -> 'b -> 'b ) -> + ('a * 'b) Stdlib.Seq.t -> + ( 'a, 'b ) Stdlib.Hashtbl.t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val add_iter_count : ( 'a, int ) Stdlib.Hashtbl.t -> 'a iter -> unit

add_iter_count tbl i increments the count of each element of i by calling incr. This is useful for counting how many times each element of i occurs.

  • since 2.8
val add_seq_count : ( 'a, int ) Stdlib.Hashtbl.t -> 'a Stdlib.Seq.t -> unit

add_seq_count tbl seq increments the count of each element of seq by calling incr. This is useful for counting how many times each element of seq occurs. Renamed from add_std_seq_count since 3.0.

  • since 3.0
val of_iter_count : 'a iter -> ( 'a, int ) Stdlib.Hashtbl.t

Like add_seq_count, but allocates a new table and returns it.

  • since 2.8
val of_seq_count : 'a Stdlib.Seq.t -> ( 'a, int ) Stdlib.Hashtbl.t

Like add_seq_count, but allocates a new table and returns it. Renamed from of_std_seq_count since 3.0.

  • since 3.0
val to_list : ( 'a, 'b ) Stdlib.Hashtbl.t -> ('a * 'b) list

to_list tbl returns the list of (key,value) bindings (order unspecified).

val of_list : ('a * 'b) list -> ( 'a, 'b ) Stdlib.Hashtbl.t

of_list l builds a table from the given list l of bindings k_i -> v_i, added in order using add. If a key occurs several times, it will be added several times, and the visible binding will be the last one.

val of_list_with : + f:( 'a -> 'b -> 'b -> 'b ) -> + ('a * 'b) list -> + ( 'a, 'b ) Stdlib.Hashtbl.t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val update : + ( 'a, 'b ) Stdlib.Hashtbl.t -> + f:( 'a -> 'b option -> 'b option ) -> + k:'a -> + unit

update tbl ~f ~k updates key k by calling f k (Some v) if k was mapped to v, or f k None otherwise; if the call returns None then k is removed/stays removed, if the call returns Some v' then the binding k -> v' is inserted using Hashtbl.replace.

  • since 0.14
val get_or_add : ( 'a, 'b ) Stdlib.Hashtbl.t -> f:( 'a -> 'b ) -> k:'a -> 'b

get_or_add tbl ~k ~f finds and returns the binding of k in tbl, if it exists. If it does not exist, then f k is called to obtain a new binding v; k -> v is added to tbl and v is returned.

  • since 1.0
val pp : + ?pp_start:unit printer -> + ?pp_stop:unit printer -> + ?pp_sep:unit printer -> + ?pp_arrow:unit printer -> + 'a printer -> + 'b printer -> + ( 'a, 'b ) Stdlib.Hashtbl.t printer

pp ~pp_start ~pp_stop ~pp_sep ~pp arrow pp_k pp_v returns a table printer given a pp_k printer for individual key and a pp_v printer for individual value. pp_start and pp_stop control the opening and closing delimiters, by default print nothing. pp_sep control the separator between binding. pp_arrow control the arrow between the key and value. Renamed from print since 2.0.

  • since 0.13
\ No newline at end of file diff --git a/3.10/containers/CCHashtbl/index.html b/3.10/containers/CCHashtbl/index.html new file mode 100644 index 00000000..3e944892 --- /dev/null +++ b/3.10/containers/CCHashtbl/index.html @@ -0,0 +1,32 @@ + +CCHashtbl (containers.CCHashtbl)

Module CCHashtbl

Extension to the standard Hashtbl

type 'a iter = ( 'a -> unit ) -> unit

Fast internal iterator.

  • since 2.8
type 'a eq = 'a -> 'a -> bool
type 'a hash = 'a -> int
type 'a printer = Stdlib.Format.formatter -> 'a -> unit

Polymorphic tables

This sub-module contains the extension of the standard polymorphic Hashtbl.

module Poly : sig ... end
include module type of Poly
val get : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'a -> 'b option

get tbl k finds a binding for the key k if present, or returns None if no value is found. Safe version of Hashtbl.find.

val get_or : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'a -> default:'b -> 'b

get_or tbl k ~default returns the value associated to k if present, and returns default otherwise (if k doesn't belong in tbl).

  • since 0.16
val keys : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'a iter

keys tbl f iterates on keys (similar order as Hashtbl.iter).

val values : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'b iter

values tbl f iterates on values in the table tbl.

val keys_list : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'a list

keys_list tbl is the list of keys in tbl. If the key is in the Hashtable multiple times, all occurrences will be returned.

  • since 0.8
val values_list : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'b list

values_list tbl is the list of values in tbl.

  • since 0.8
val map_list : ( 'a -> 'b -> 'c ) -> ( 'a, 'b ) Stdlib.Hashtbl.t -> 'c list

map_list f tbl maps on a tbl's items. Collect into a list.

val incr : ?by:int -> ( 'a, int ) Stdlib.Hashtbl.t -> 'a -> unit

incr ?by tbl x increments or initializes the counter associated with x. If get tbl x = None, then after update, get tbl x = Some 1; otherwise, if get tbl x = Some n, now get tbl x = Some (n+1).

  • parameter by

    if specified, the int value is incremented by by rather than 1.

  • since 0.16
val decr : ?by:int -> ( 'a, int ) Stdlib.Hashtbl.t -> 'a -> unit

decr ?by tbl x is like incr but subtract 1 (or the value of by). If the value reaches 0, the key is removed from the table. This does nothing if the key is not already present in the table.

  • since 0.16
val to_iter : ( 'a, 'b ) Stdlib.Hashtbl.t -> ('a * 'b) iter

Iterate on bindings in the table.

  • since 2.8
val add_list : ( 'a, 'b list ) Stdlib.Hashtbl.t -> 'a -> 'b -> unit

add_list tbl x y adds y to the list x is bound to. If x is not bound, it becomes bound to y.

  • since 0.16
val add_iter : ( 'a, 'b ) Stdlib.Hashtbl.t -> ('a * 'b) iter -> unit

Add the corresponding pairs to the table, using Hashtbl.add.

  • since 2.8
val add_iter_with : + f:( 'a -> 'b -> 'b -> 'b ) -> + ( 'a, 'b ) Stdlib.Hashtbl.t -> + ('a * 'b) iter -> + unit

Add the corresponding pairs to the table, using Hashtbl.add. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val add_seq : ( 'a, 'b ) Stdlib.Hashtbl.t -> ('a * 'b) Stdlib.Seq.t -> unit

Add the corresponding pairs to the table, using Hashtbl.add. Renamed from add_std_seq since 3.0.

  • since 3.0
val add_seq_with : + f:( 'a -> 'b -> 'b -> 'b ) -> + ( 'a, 'b ) Stdlib.Hashtbl.t -> + ('a * 'b) Stdlib.Seq.t -> + unit

Add the corresponding pairs to the table. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val of_iter : ('a * 'b) iter -> ( 'a, 'b ) Stdlib.Hashtbl.t

From the given bindings, added in order.

  • since 2.8
val of_iter_with : + f:( 'a -> 'b -> 'b -> 'b ) -> + ('a * 'b) iter -> + ( 'a, 'b ) Stdlib.Hashtbl.t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val of_seq : ('a * 'b) Stdlib.Seq.t -> ( 'a, 'b ) Stdlib.Hashtbl.t

From the given bindings, added in order. Renamed from of_std_seq since 3.0.

  • since 3.0
val of_seq_with : + f:( 'a -> 'b -> 'b -> 'b ) -> + ('a * 'b) Stdlib.Seq.t -> + ( 'a, 'b ) Stdlib.Hashtbl.t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val add_iter_count : ( 'a, int ) Stdlib.Hashtbl.t -> 'a iter -> unit

add_iter_count tbl i increments the count of each element of i by calling incr. This is useful for counting how many times each element of i occurs.

  • since 2.8
val add_seq_count : ( 'a, int ) Stdlib.Hashtbl.t -> 'a Stdlib.Seq.t -> unit

add_seq_count tbl seq increments the count of each element of seq by calling incr. This is useful for counting how many times each element of seq occurs. Renamed from add_std_seq_count since 3.0.

  • since 3.0
val of_iter_count : 'a iter -> ( 'a, int ) Stdlib.Hashtbl.t

Like add_seq_count, but allocates a new table and returns it.

  • since 2.8
val of_seq_count : 'a Stdlib.Seq.t -> ( 'a, int ) Stdlib.Hashtbl.t

Like add_seq_count, but allocates a new table and returns it. Renamed from of_std_seq_count since 3.0.

  • since 3.0
val to_list : ( 'a, 'b ) Stdlib.Hashtbl.t -> ('a * 'b) list

to_list tbl returns the list of (key,value) bindings (order unspecified).

val of_list : ('a * 'b) list -> ( 'a, 'b ) Stdlib.Hashtbl.t

of_list l builds a table from the given list l of bindings k_i -> v_i, added in order using add. If a key occurs several times, it will be added several times, and the visible binding will be the last one.

val of_list_with : + f:( 'a -> 'b -> 'b -> 'b ) -> + ('a * 'b) list -> + ( 'a, 'b ) Stdlib.Hashtbl.t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val update : + ( 'a, 'b ) Stdlib.Hashtbl.t -> + f:( 'a -> 'b option -> 'b option ) -> + k:'a -> + unit

update tbl ~f ~k updates key k by calling f k (Some v) if k was mapped to v, or f k None otherwise; if the call returns None then k is removed/stays removed, if the call returns Some v' then the binding k -> v' is inserted using Hashtbl.replace.

  • since 0.14
val get_or_add : ( 'a, 'b ) Stdlib.Hashtbl.t -> f:( 'a -> 'b ) -> k:'a -> 'b

get_or_add tbl ~k ~f finds and returns the binding of k in tbl, if it exists. If it does not exist, then f k is called to obtain a new binding v; k -> v is added to tbl and v is returned.

  • since 1.0
val pp : + ?pp_start:unit printer -> + ?pp_stop:unit printer -> + ?pp_sep:unit printer -> + ?pp_arrow:unit printer -> + 'a printer -> + 'b printer -> + ( 'a, 'b ) Stdlib.Hashtbl.t printer

pp ~pp_start ~pp_stop ~pp_sep ~pp arrow pp_k pp_v returns a table printer given a pp_k printer for individual key and a pp_v printer for individual value. pp_start and pp_stop control the opening and closing delimiters, by default print nothing. pp_sep control the separator between binding. pp_arrow control the arrow between the key and value. Renamed from print since 2.0.

  • since 0.13

Functor

module type S = sig ... end
module Make + (X : Stdlib.Hashtbl.HashedType) : + S with type key = X.t and type 'a t = 'a Stdlib.Hashtbl.Make(X).t
\ No newline at end of file diff --git a/3.10/containers/CCHashtbl/module-type-S/index.html b/3.10/containers/CCHashtbl/module-type-S/index.html new file mode 100644 index 00000000..36e8401a --- /dev/null +++ b/3.10/containers/CCHashtbl/module-type-S/index.html @@ -0,0 +1,20 @@ + +S (containers.CCHashtbl.S)

Module type CCHashtbl.S

include Stdlib.Hashtbl.S
type key
type !'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : ( key -> 'a -> unit ) -> 'a t -> unit
val filter_map_inplace : ( key -> 'a -> 'a option ) -> 'a t -> unit
val fold : ( key -> 'a -> 'b -> 'b ) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> Stdlib__Hashtbl.statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val get : 'a t -> key -> 'a option

get tbl k finds a binding for the key k if present, or returns None if no value is found. Safe version of Hashtbl.find.

val get_or : 'a t -> key -> default:'a -> 'a

get_or tbl k ~default returns the value associated to k if present, and returns default otherwise (if k doesn't belong in tbl).

  • since 0.16
val add_list : 'a list t -> key -> 'a -> unit

add_list tbl x y adds y to the list x is bound to. If x is not bound, it becomes bound to y.

  • since 0.16
val incr : ?by:int -> int t -> key -> unit

incr ?by tbl x increments or initializes the counter associated with x. If get tbl x = None, then after update, get tbl x = Some 1; otherwise, if get tbl x = Some n, now get tbl x = Some (n+1).

  • parameter by

    if specified, the int value is incremented by by rather than 1.

  • since 0.16
val decr : ?by:int -> int t -> key -> unit

decr ?by tbl x is like incr but subtract 1 (or the value of by). If the value reaches 0, the key is removed from the table. This does nothing if the key is not already present in the table.

  • since 0.16
val keys : 'a t -> key iter

keys tbl f iterates on keys (similar order as Hashtbl.iter).

val values : 'a t -> 'a iter

values tbl f iterates on values in the table.

val keys_list : _ t -> key list

keys_list tbl is the list of keys in tbl. If the key is in the Hashtable multiple times, all occurrences will be returned.

  • since 0.8
val values_list : 'a t -> 'a list

values_list t is the list of values in t.

  • since 0.8
val map_list : ( key -> 'a -> 'b ) -> 'a t -> 'b list

Map on a hashtable's items, collect into a list.

val to_iter : 'a t -> (key * 'a) iter

Iterate on bindings in the table.

  • since 2.8
val add_iter : 'a t -> (key * 'a) iter -> unit

Add the corresponding pairs to the table, using Hashtbl.add.

  • since 2.8
val add_iter_with : + f:( key -> 'a -> 'a -> 'a ) -> + 'a t -> + (key * 'a) iter -> + unit

Add the corresponding pairs to the table, using Hashtbl.add. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit

Add the corresponding pairs to the table, using Hashtbl.add. Renamed from add_std_seq since 3.0.

  • since 3.0
val add_seq_with : + f:( key -> 'a -> 'a -> 'a ) -> + 'a t -> + (key * 'a) Stdlib.Seq.t -> + unit

Add the corresponding pairs to the table, using Hashtbl.add. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val of_iter : (key * 'a) iter -> 'a t

From the given bindings, added in order.

  • since 2.8
val of_iter_with : f:( key -> 'a -> 'a -> 'a ) -> (key * 'a) iter -> 'a t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

From the given bindings, added in order. Renamed from of_std_seq since 3.0.

  • since 3.0
val of_seq_with : + f:( key -> 'a -> 'a -> 'a ) -> + (key * 'a) Stdlib.Seq.t -> + 'a t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val add_iter_count : int t -> key iter -> unit

add_iter_count tbl i increments the count of each element of i by calling incr. This is useful for counting how many times each element of i occurs.

  • since 2.8
val add_seq_count : int t -> key Stdlib.Seq.t -> unit

add_seq_count tbl seq increments the count of each element of seq by calling incr. This is useful for counting how many times each element of seq occurs. Renamed from of_std_seq_count since 3.0.

  • since 3.0
val of_iter_count : key iter -> int t

Like add_seq_count, but allocates a new table and returns it.

  • since 2.8
val of_seq_count : key Stdlib.Seq.t -> int t

Like add_seq_count, but allocates a new table and returns it. Renamed from of_std_seq_count since 3.0.

  • since 3.0
val to_list : 'a t -> (key * 'a) list

to_list tbl returns the list of (key,value) bindings (order unspecified).

val of_list : (key * 'a) list -> 'a t

of_list l builds a table from the given list l of bindings k_i -> v_i, added in order using add. If a key occurs several times, it will be added several times, and the visible binding will be the last one.

val of_list_with : f:( key -> 'a -> 'a -> 'a ) -> (key * 'a) list -> 'a t

of_list l builds a table from the given list l of bindings k_i -> v_i. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val update : 'a t -> f:( key -> 'a option -> 'a option ) -> k:key -> unit

update tbl ~f ~k updates key k by calling f k (Some v) if k was mapped to v, or f k None otherwise; if the call returns None then k is removed/stays removed, if the call returns Some v' then the binding k -> v' is inserted using Hashtbl.replace.

  • since 0.14
val get_or_add : 'a t -> f:( key -> 'a ) -> k:key -> 'a

get_or_add tbl ~k ~f finds and returns the binding of k in tbl, if it exists. If it does not exist, then f k is called to obtain a new binding v; k -> v is added to tbl and v is returned.

  • since 1.0
val pp : + ?pp_start:unit printer -> + ?pp_stop:unit printer -> + ?pp_sep:unit printer -> + ?pp_arrow:unit printer -> + key printer -> + 'a printer -> + 'a t printer

pp ~pp_start ~pp_stop ~pp_sep ~pp arrow pp_k pp_v returns a table printer given a pp_k printer for individual key and a pp_v printer for individual value. pp_start and pp_stop control the opening and closing delimiters, by default print nothing. pp_sep control the separator between binding. pp_arrow control the arrow between the key and value. Renamed from print since 2.0.

  • since 0.13
\ No newline at end of file diff --git a/3.10/containers/CCHeap/.dummy b/3.10/containers/CCHeap/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCHeap/Make/argument-1-E/index.html b/3.10/containers/CCHeap/Make/argument-1-E/index.html new file mode 100644 index 00000000..ed3e7a3d --- /dev/null +++ b/3.10/containers/CCHeap/Make/argument-1-E/index.html @@ -0,0 +1,2 @@ + +E (containers.CCHeap.Make.1-E)

Parameter Make.1-E

type t
val leq : t -> t -> bool

leq x y shall return true iff x is lower or equal to y.

\ No newline at end of file diff --git a/3.10/containers/CCHeap/Make/index.html b/3.10/containers/CCHeap/Make/index.html new file mode 100644 index 00000000..bd031dab --- /dev/null +++ b/3.10/containers/CCHeap/Make/index.html @@ -0,0 +1,7 @@ + +Make (containers.CCHeap.Make)

Module CCHeap.Make

Parameters

module E : PARTIAL_ORD

Signature

type elt = E.t
type t
val empty : t

empty returns the empty heap.

val is_empty : t -> bool

is_empty h returns true if the heap h is empty.

exception Empty
val merge : t -> t -> t

merge h1 h2 merges the two heaps h1 and h2.

val insert : elt -> t -> t

insert x h inserts an element x into the heap h.

val add : t -> elt -> t

add h x inserts an element x into the heap h.

val filter : ( elt -> bool ) -> t -> t

filter p h filters values, only retaining the ones that satisfy the predicate p. Linear time at least.

val find_min : t -> elt option

find_min h find the minimal element of the heap h.

val find_min_exn : t -> elt

find_min_exn h is like find_min but can fail.

  • raises Empty

    if the heap is empty.

val take : t -> (t * elt) option

take h extracts and returns the minimum element, and the new heap (without this element), or None if the heap h is empty.

val take_exn : t -> t * elt

take_exn h is like take, but can fail.

  • raises Empty

    if the heap is empty.

val delete_one : ( elt -> elt -> bool ) -> elt -> t -> t

delete_one eq x h uses eq to find one occurrence of a value x if it exist in the heap h, and delete it. If h do not contain x then it return h.

  • since 2.0
val delete_all : ( elt -> elt -> bool ) -> elt -> t -> t

delete_all eq x h uses eq to find all x in h and delete them. If h do not contain x then it return h. The difference with filter is that delete_all stops as soon as it enters a subtree whose root is bigger than the element.

  • since 2.0
val iter : ( elt -> unit ) -> t -> unit

iter f h iterates over the heap h invoking f with the current element.

val fold : ( 'a -> elt -> 'a ) -> 'a -> t -> 'a

fold f acc h folds on all values of h.

val size : t -> int

size h is the number of elements in the heap h. Linear complexity.

Conversions

val to_list : t -> elt list

to_list h returns the elements of the heap h, in no particular order.

val to_list_sorted : t -> elt list

to_list_sorted h returns the elements of the heap h in increasing order.

  • since 1.1
val add_list : t -> elt list -> t

add_list h l adds the elements of the list l into the heap h. An element occurring several times will be added that many times to the heap.

  • since 0.16
val of_list : elt list -> t

of_list l is add_list empty l. Complexity: O(n log n).

val add_iter : t -> elt iter -> t

add_iter h iter is like add_list.

  • since 2.8
val add_seq : t -> elt Stdlib.Seq.t -> t

add_seq h seq is like add_list. Renamed from add_std_seq since 3.0.

  • since 3.0
val of_iter : elt iter -> t

of_iter iter builds a heap from a given iter. Complexity: O(n log n).

  • since 2.8
val of_seq : elt Stdlib.Seq.t -> t

of_seq seq builds a heap from a given Seq.t. Complexity: O(n log n). Renamed from of_seq since 3.0.

  • since 3.0
val to_iter : t -> elt iter

to_iter h returns a iter of the elements of the heap h.

  • since 2.8
val to_seq : t -> elt Stdlib.Seq.t

to_seq h returns a Seq.t of the elements of the heap h. Renamed from to_std_seq since 3.0.

  • since 3.0
val to_iter_sorted : t -> elt iter

to_iter_sorted h returns a iter by iterating on the elements of h, in increasing order.

  • since 2.8
val to_seq_sorted : t -> elt Stdlib.Seq.t

to_seq_sorted h returns a Seq.t by iterating on the elements of h, in increasing order. Renamed from to_std_seq_sorted since 3.0.

  • since 3.0
val add_gen : t -> elt gen -> t

add_gen h gen adds the gen gen to the heap h.

  • since 0.16
val of_gen : elt gen -> t

of_gen gen builds a heap from a given gen. Complexity: O(n log n).

val to_gen : t -> elt gen

to_gen h returns a gen of the elements of the heap h.

val to_tree : t -> elt ktree

to_tree h returns a ktree of the elements of the heap h.

val to_string : ?sep:string -> ( elt -> string ) -> t -> string

to_string ?sep f h prints the heap h in a string using sep as a given separator (default ",") between each element (converted to a string using f).

  • since 2.7
val pp : + ?pp_start:unit printer -> + ?pp_stop:unit printer -> + ?pp_sep:unit printer -> + elt printer -> + t printer

pp ?pp_start ?pp_stop ?pp_sep ppf h prints h on ppf. Each element is formatted with ppf, pp_start is called at the beginning, pp_stop is called at the end, pp_sep is called between each elements. By defaults pp_start and pp_stop does nothing and pp_sep defaults to (fun out -> Format.fprintf out ",@ "). Renamed from print since 2.0

  • since 0.16
\ No newline at end of file diff --git a/3.10/containers/CCHeap/Make_from_compare/argument-1-E/index.html b/3.10/containers/CCHeap/Make_from_compare/argument-1-E/index.html new file mode 100644 index 00000000..ee7a9bd2 --- /dev/null +++ b/3.10/containers/CCHeap/Make_from_compare/argument-1-E/index.html @@ -0,0 +1,2 @@ + +E (containers.CCHeap.Make_from_compare.1-E)

Parameter Make_from_compare.1-E

type t
val compare : t -> t -> int

compare a b shall return a negative value if a is smaller than b, 0 if a and b are equal or a positive value if a is greater than b

\ No newline at end of file diff --git a/3.10/containers/CCHeap/Make_from_compare/index.html b/3.10/containers/CCHeap/Make_from_compare/index.html new file mode 100644 index 00000000..4f836647 --- /dev/null +++ b/3.10/containers/CCHeap/Make_from_compare/index.html @@ -0,0 +1,7 @@ + +Make_from_compare (containers.CCHeap.Make_from_compare)

Module CCHeap.Make_from_compare

A convenient version of Make that take a TOTAL_ORD instead of a partially ordered module. It allow to directly pass modules that implement compare without implementing leq explicitly

Parameters

module E : TOTAL_ORD

Signature

type elt = E.t
type t
val empty : t

empty returns the empty heap.

val is_empty : t -> bool

is_empty h returns true if the heap h is empty.

exception Empty
val merge : t -> t -> t

merge h1 h2 merges the two heaps h1 and h2.

val insert : elt -> t -> t

insert x h inserts an element x into the heap h.

val add : t -> elt -> t

add h x inserts an element x into the heap h.

val filter : ( elt -> bool ) -> t -> t

filter p h filters values, only retaining the ones that satisfy the predicate p. Linear time at least.

val find_min : t -> elt option

find_min h find the minimal element of the heap h.

val find_min_exn : t -> elt

find_min_exn h is like find_min but can fail.

  • raises Empty

    if the heap is empty.

val take : t -> (t * elt) option

take h extracts and returns the minimum element, and the new heap (without this element), or None if the heap h is empty.

val take_exn : t -> t * elt

take_exn h is like take, but can fail.

  • raises Empty

    if the heap is empty.

val delete_one : ( elt -> elt -> bool ) -> elt -> t -> t

delete_one eq x h uses eq to find one occurrence of a value x if it exist in the heap h, and delete it. If h do not contain x then it return h.

  • since 2.0
val delete_all : ( elt -> elt -> bool ) -> elt -> t -> t

delete_all eq x h uses eq to find all x in h and delete them. If h do not contain x then it return h. The difference with filter is that delete_all stops as soon as it enters a subtree whose root is bigger than the element.

  • since 2.0
val iter : ( elt -> unit ) -> t -> unit

iter f h iterates over the heap h invoking f with the current element.

val fold : ( 'a -> elt -> 'a ) -> 'a -> t -> 'a

fold f acc h folds on all values of h.

val size : t -> int

size h is the number of elements in the heap h. Linear complexity.

Conversions

val to_list : t -> elt list

to_list h returns the elements of the heap h, in no particular order.

val to_list_sorted : t -> elt list

to_list_sorted h returns the elements of the heap h in increasing order.

  • since 1.1
val add_list : t -> elt list -> t

add_list h l adds the elements of the list l into the heap h. An element occurring several times will be added that many times to the heap.

  • since 0.16
val of_list : elt list -> t

of_list l is add_list empty l. Complexity: O(n log n).

val add_iter : t -> elt iter -> t

add_iter h iter is like add_list.

  • since 2.8
val add_seq : t -> elt Stdlib.Seq.t -> t

add_seq h seq is like add_list. Renamed from add_std_seq since 3.0.

  • since 3.0
val of_iter : elt iter -> t

of_iter iter builds a heap from a given iter. Complexity: O(n log n).

  • since 2.8
val of_seq : elt Stdlib.Seq.t -> t

of_seq seq builds a heap from a given Seq.t. Complexity: O(n log n). Renamed from of_seq since 3.0.

  • since 3.0
val to_iter : t -> elt iter

to_iter h returns a iter of the elements of the heap h.

  • since 2.8
val to_seq : t -> elt Stdlib.Seq.t

to_seq h returns a Seq.t of the elements of the heap h. Renamed from to_std_seq since 3.0.

  • since 3.0
val to_iter_sorted : t -> elt iter

to_iter_sorted h returns a iter by iterating on the elements of h, in increasing order.

  • since 2.8
val to_seq_sorted : t -> elt Stdlib.Seq.t

to_seq_sorted h returns a Seq.t by iterating on the elements of h, in increasing order. Renamed from to_std_seq_sorted since 3.0.

  • since 3.0
val add_gen : t -> elt gen -> t

add_gen h gen adds the gen gen to the heap h.

  • since 0.16
val of_gen : elt gen -> t

of_gen gen builds a heap from a given gen. Complexity: O(n log n).

val to_gen : t -> elt gen

to_gen h returns a gen of the elements of the heap h.

val to_tree : t -> elt ktree

to_tree h returns a ktree of the elements of the heap h.

val to_string : ?sep:string -> ( elt -> string ) -> t -> string

to_string ?sep f h prints the heap h in a string using sep as a given separator (default ",") between each element (converted to a string using f).

  • since 2.7
val pp : + ?pp_start:unit printer -> + ?pp_stop:unit printer -> + ?pp_sep:unit printer -> + elt printer -> + t printer

pp ?pp_start ?pp_stop ?pp_sep ppf h prints h on ppf. Each element is formatted with ppf, pp_start is called at the beginning, pp_stop is called at the end, pp_sep is called between each elements. By defaults pp_start and pp_stop does nothing and pp_sep defaults to (fun out -> Format.fprintf out ",@ "). Renamed from print since 2.0

  • since 0.16
\ No newline at end of file diff --git a/3.10/containers/CCHeap/index.html b/3.10/containers/CCHeap/index.html new file mode 100644 index 00000000..0324832a --- /dev/null +++ b/3.10/containers/CCHeap/index.html @@ -0,0 +1,2 @@ + +CCHeap (containers.CCHeap)

Module CCHeap

Leftist Heaps

Implementation following Okasaki's book.

type 'a iter = ( 'a -> unit ) -> unit

Fast internal iterator.

  • since 2.8
type 'a gen = unit -> 'a option
type 'a ktree = unit -> [ `Nil | `Node of 'a * 'a ktree list ]
type 'a printer = Stdlib.Format.formatter -> 'a -> unit
module type PARTIAL_ORD = sig ... end
module type TOTAL_ORD = sig ... end
module type S = sig ... end
module Make (E : PARTIAL_ORD) : S with type elt = E.t
module Make_from_compare (E : TOTAL_ORD) : S with type elt = E.t

A convenient version of Make that take a TOTAL_ORD instead of a partially ordered module. It allow to directly pass modules that implement compare without implementing leq explicitly

\ No newline at end of file diff --git a/3.10/containers/CCHeap/module-type-PARTIAL_ORD/index.html b/3.10/containers/CCHeap/module-type-PARTIAL_ORD/index.html new file mode 100644 index 00000000..e14dea4b --- /dev/null +++ b/3.10/containers/CCHeap/module-type-PARTIAL_ORD/index.html @@ -0,0 +1,2 @@ + +PARTIAL_ORD (containers.CCHeap.PARTIAL_ORD)

Module type CCHeap.PARTIAL_ORD

type t
val leq : t -> t -> bool

leq x y shall return true iff x is lower or equal to y.

\ No newline at end of file diff --git a/3.10/containers/CCHeap/module-type-S/index.html b/3.10/containers/CCHeap/module-type-S/index.html new file mode 100644 index 00000000..395ab18b --- /dev/null +++ b/3.10/containers/CCHeap/module-type-S/index.html @@ -0,0 +1,7 @@ + +S (containers.CCHeap.S)

Module type CCHeap.S

type elt
type t
val empty : t

empty returns the empty heap.

val is_empty : t -> bool

is_empty h returns true if the heap h is empty.

exception Empty
val merge : t -> t -> t

merge h1 h2 merges the two heaps h1 and h2.

val insert : elt -> t -> t

insert x h inserts an element x into the heap h.

val add : t -> elt -> t

add h x inserts an element x into the heap h.

val filter : ( elt -> bool ) -> t -> t

filter p h filters values, only retaining the ones that satisfy the predicate p. Linear time at least.

val find_min : t -> elt option

find_min h find the minimal element of the heap h.

val find_min_exn : t -> elt

find_min_exn h is like find_min but can fail.

  • raises Empty

    if the heap is empty.

val take : t -> (t * elt) option

take h extracts and returns the minimum element, and the new heap (without this element), or None if the heap h is empty.

val take_exn : t -> t * elt

take_exn h is like take, but can fail.

  • raises Empty

    if the heap is empty.

val delete_one : ( elt -> elt -> bool ) -> elt -> t -> t

delete_one eq x h uses eq to find one occurrence of a value x if it exist in the heap h, and delete it. If h do not contain x then it return h.

  • since 2.0
val delete_all : ( elt -> elt -> bool ) -> elt -> t -> t

delete_all eq x h uses eq to find all x in h and delete them. If h do not contain x then it return h. The difference with filter is that delete_all stops as soon as it enters a subtree whose root is bigger than the element.

  • since 2.0
val iter : ( elt -> unit ) -> t -> unit

iter f h iterates over the heap h invoking f with the current element.

val fold : ( 'a -> elt -> 'a ) -> 'a -> t -> 'a

fold f acc h folds on all values of h.

val size : t -> int

size h is the number of elements in the heap h. Linear complexity.

Conversions

val to_list : t -> elt list

to_list h returns the elements of the heap h, in no particular order.

val to_list_sorted : t -> elt list

to_list_sorted h returns the elements of the heap h in increasing order.

  • since 1.1
val add_list : t -> elt list -> t

add_list h l adds the elements of the list l into the heap h. An element occurring several times will be added that many times to the heap.

  • since 0.16
val of_list : elt list -> t

of_list l is add_list empty l. Complexity: O(n log n).

val add_iter : t -> elt iter -> t

add_iter h iter is like add_list.

  • since 2.8
val add_seq : t -> elt Stdlib.Seq.t -> t

add_seq h seq is like add_list. Renamed from add_std_seq since 3.0.

  • since 3.0
val of_iter : elt iter -> t

of_iter iter builds a heap from a given iter. Complexity: O(n log n).

  • since 2.8
val of_seq : elt Stdlib.Seq.t -> t

of_seq seq builds a heap from a given Seq.t. Complexity: O(n log n). Renamed from of_seq since 3.0.

  • since 3.0
val to_iter : t -> elt iter

to_iter h returns a iter of the elements of the heap h.

  • since 2.8
val to_seq : t -> elt Stdlib.Seq.t

to_seq h returns a Seq.t of the elements of the heap h. Renamed from to_std_seq since 3.0.

  • since 3.0
val to_iter_sorted : t -> elt iter

to_iter_sorted h returns a iter by iterating on the elements of h, in increasing order.

  • since 2.8
val to_seq_sorted : t -> elt Stdlib.Seq.t

to_seq_sorted h returns a Seq.t by iterating on the elements of h, in increasing order. Renamed from to_std_seq_sorted since 3.0.

  • since 3.0
val add_gen : t -> elt gen -> t

add_gen h gen adds the gen gen to the heap h.

  • since 0.16
val of_gen : elt gen -> t

of_gen gen builds a heap from a given gen. Complexity: O(n log n).

val to_gen : t -> elt gen

to_gen h returns a gen of the elements of the heap h.

val to_tree : t -> elt ktree

to_tree h returns a ktree of the elements of the heap h.

val to_string : ?sep:string -> ( elt -> string ) -> t -> string

to_string ?sep f h prints the heap h in a string using sep as a given separator (default ",") between each element (converted to a string using f).

  • since 2.7
val pp : + ?pp_start:unit printer -> + ?pp_stop:unit printer -> + ?pp_sep:unit printer -> + elt printer -> + t printer

pp ?pp_start ?pp_stop ?pp_sep ppf h prints h on ppf. Each element is formatted with ppf, pp_start is called at the beginning, pp_stop is called at the end, pp_sep is called between each elements. By defaults pp_start and pp_stop does nothing and pp_sep defaults to (fun out -> Format.fprintf out ",@ "). Renamed from print since 2.0

  • since 0.16
\ No newline at end of file diff --git a/3.10/containers/CCHeap/module-type-TOTAL_ORD/index.html b/3.10/containers/CCHeap/module-type-TOTAL_ORD/index.html new file mode 100644 index 00000000..3b9ec4e5 --- /dev/null +++ b/3.10/containers/CCHeap/module-type-TOTAL_ORD/index.html @@ -0,0 +1,2 @@ + +TOTAL_ORD (containers.CCHeap.TOTAL_ORD)

Module type CCHeap.TOTAL_ORD

type t
val compare : t -> t -> int

compare a b shall return a negative value if a is smaller than b, 0 if a and b are equal or a positive value if a is greater than b

\ No newline at end of file diff --git a/3.10/containers/CCIO/.dummy b/3.10/containers/CCIO/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCIO/File/index.html b/3.10/containers/CCIO/File/index.html new file mode 100644 index 00000000..ab3d37f9 --- /dev/null +++ b/3.10/containers/CCIO/File/index.html @@ -0,0 +1,7 @@ + +File (containers.CCIO.File)

Module CCIO.File

type t = string

A file should be represented by its absolute path, but currently this is not enforced.

val to_string : t -> string
val make : string -> t

Build a file representation from a path (absolute or relative).

val exists : t -> bool
val is_directory : t -> bool
val remove_exn : t -> unit

remove_exn path tries to remove the file at path from the file system.

  • raises Sys_error

    if there is no file at path or access rights are wrong.

  • since 0.8
val remove : t -> unit or_error

Like remove_exn but with an error monad.

  • since 0.8
val remove_noerr : t -> unit

Like remove_exn but do not raise any exception on failure.

  • since 0.8
val read_dir : ?recurse:bool -> t -> t gen

read_dir d returns a sequence of files and directory contained in the directory d (or an empty stream if d is not a directory).

  • raises Sys_error

    in case of error (e.g. permission denied).

  • parameter recurse

    if true (default false), sub-directories are also explored.

val read_exn : t -> string

Read the content of the given file, or raises some exception.

  • raises Sys_error

    in case of error.

  • since 0.16
val read : t -> string or_error

Read the content of the given file.

  • since 0.16
val append_exn : t -> string -> unit

Append the given string into the given file, possibly raising.

  • raises Sys_error

    in case of error.

  • since 0.16
val append : t -> string -> unit or_error

Append the given string into the given file.

  • since 0.16
val write_exn : t -> string -> unit

Write the given string into the given file, possibly raising.

  • raises Sys_error

    in case of error.

  • since 0.16
val write : t -> string -> unit or_error

Write the given string into the given file.

  • since 0.16
type walk_item = [ `File | `Dir ] * t
val walk : t -> walk_item gen

Like 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.)

  • raises Sys_error

    in case of error (e.g. permission denied) during iteration.

val walk_iter : t -> walk_item iter

Like walk but with an imperative iterator.

  • since 3.6
val walk_l : t -> walk_item list

Like walk but returns a list (therefore it's eager and might take some time on large directories).

  • since 1.1
val walk_seq : t -> walk_item Stdlib.Seq.t

Like walk but returns a Seq

  • since 3.6
val show_walk_item : walk_item -> string
val with_temp : + ?temp_dir:string -> + prefix:string -> + suffix:string -> + ( string -> 'a ) -> + 'a

with_temp ~prefix ~suffix f will call f with the name of a new temporary file (located in temp_dir). After f returns, the file is deleted. Best to be used in combination with with_out. See Filename.temp_file.

  • since 0.17
\ No newline at end of file diff --git a/3.10/containers/CCIO/index.html b/3.10/containers/CCIO/index.html new file mode 100644 index 00000000..f0604ab4 --- /dev/null +++ b/3.10/containers/CCIO/index.html @@ -0,0 +1,46 @@ + +CCIO (containers.CCIO)

Module CCIO

IO Utils

Simple utilities to deal with basic Input/Output tasks in a resource-safe way. For advanced IO tasks, the user is advised to use something like Lwt or Async, that are far more comprehensive.

Examples:

# let l = CCIO.(with_in "/tmp/some_file" read_lines_l);;
# CCIO.(
+    with_in "/tmp/input"
+      (fun ic ->
+         let chunks = read_chunks_gen ic in
+         with_out ~flags:[Open_binary; Open_creat] ~mode:0o644 "/tmp/output"
+           (fun oc ->
+              write_gen oc chunks
+           )
+      )
+  ) ;;
# CCIO.(
+    let chunks =
+      with_in "/tmp/input"
+        (fun ic -> read_chunks_gen ic)
+    in
+    with_out ~flags:[Open_binary;Open_creat] ~mode:0o644 "/tmp/output"
+       (fun oc ->
+          write_gen oc chunks
+       )
+  ) ;;
type 'a or_error = ( 'a, string ) Stdlib.result
type 'a iter = ( 'a -> unit ) -> unit
type 'a gen = unit -> 'a option

See Gen in the gen library.

Input

val with_in : + ?mode:int -> + ?flags:Stdlib.open_flag list -> + string -> + ( Stdlib.in_channel -> 'a ) -> + 'a

Open an input file with the given optional flag list, calls the function on the input channel. When the function raises or returns, the channel is closed.

  • raises Sys_error

    in case of error (same as open_in and close_in).

  • parameter flags

    opening flags (default [Open_text]). Open_rdonly is used in any cases.

val read_chunks_gen : ?size:int -> Stdlib.in_channel -> string gen

Read the channel's content into chunks of size at most size. NOTE the generator must be used within the lifetime of the channel, see warning at the top of the file.

val read_chunks_seq : ?size:int -> Stdlib.in_channel -> string Stdlib.Seq.t

Read the channel's content into chunks of size at most size. NOTE the generator must be used within the lifetime of the channel, see warning at the top of the file.

  • since 3.5
val read_chunks_iter : ?size:int -> Stdlib.in_channel -> string iter

Read the channel's content into chunks of size at most size

  • since 3.6
val read_line : Stdlib.in_channel -> string option

Read a line from the channel. Returns None if the input is terminated. The "\n" is removed from the line.

val read_lines_gen : Stdlib.in_channel -> string gen

Read all lines. The generator should be traversed only once. NOTE the generator must be used within the lifetime of the channel, see warning at the top of the file.

val read_lines_seq : Stdlib.in_channel -> string Stdlib.Seq.t

Read all lines. NOTE the seq must be used within the lifetime of the channel, see warning at the top of the file.

  • since 3.5
val read_lines_iter : Stdlib.in_channel -> string iter

Read all lines.

  • since 3.6
val read_lines_l : Stdlib.in_channel -> string list

Read all lines into a list.

val read_all : ?size:int -> Stdlib.in_channel -> string

Read the whole channel into a buffer, then converted into a string.

  • parameter size

    the internal buffer size.

  • since 0.7
val read_all_bytes : ?size:int -> Stdlib.in_channel -> Stdlib.Bytes.t

Read the whole channel into a mutable byte array.

  • parameter size

    the internal buffer size.

  • since 0.12

Output

val with_out : + ?mode:int -> + ?flags:Stdlib.open_flag list -> + string -> + ( Stdlib.out_channel -> 'a ) -> + 'a

Like with_in but for an output channel.

  • parameter flags

    opening flags (default [Open_creat; Open_trunc; Open_text]).

  • raises Sys_error

    in case of error (same as open_out and close_out). Open_wronly is used in any cases.

val with_out_a : + ?mode:int -> + ?flags:Stdlib.open_flag list -> + string -> + ( Stdlib.out_channel -> 'a ) -> + 'a

Like with_out but with the [Open_append; Open_creat; Open_wronly] flags activated, to append to the file.

  • raises Sys_error

    in case of error (same as open_out and close_out).

val write_line : Stdlib.out_channel -> string -> unit

Write the given string on the channel, followed by "\n".

val write_gen : ?sep:string -> Stdlib.out_channel -> string gen -> unit

Write the given strings on the output. If provided, add sep between every two strings (but not at the end).

val write_seq : + ?sep:string -> + Stdlib.out_channel -> + string Stdlib.Seq.t -> + unit

Write the given strings on the output. If provided, add sep between every two strings (but not at the end).

  • since 3.5
val write_lines : Stdlib.out_channel -> string gen -> unit

Write every string on the output, followed by "\n".

val write_lines_iter : Stdlib.out_channel -> string iter -> unit

Write every string on the output, followed by "\n".

  • since 3.6
val write_lines_seq : Stdlib.out_channel -> string Stdlib.Seq.t -> unit

Write every string on the output, followed by "\n".

  • since 3.5
val write_lines_l : Stdlib.out_channel -> string list -> unit

Both

val with_in_out : + ?mode:int -> + ?flags:Stdlib.open_flag list -> + string -> + ( Stdlib.in_channel -> Stdlib.out_channel -> 'a ) -> + 'a

Combines with_in and with_out.

  • parameter flags

    opening flags (default [Open_creat]).

  • raises Sys_error

    in case of error.

  • since 0.12
val copy_into : ?bufsize:int -> Stdlib.in_channel -> Stdlib.out_channel -> unit

copy_into ic oc writes the content of ic into oc. It is a blocking call.

  • since 3.0

Misc for Generators

val tee : ( 'a -> unit ) list -> 'a gen -> 'a gen

tee funs gen behaves like gen, but each element is given to every function f in funs at the time the element is produced. The returned generator will raise any exception that f raises

File and file names

How to list recursively files in a directory:

# let files = CCIO.File.read_dir ~recurse:true (CCIO.File.make "/tmp");;
+# CCIO.write_lines stdout files;;

See File.walk if you also need to list directories:

# let content = CCIO.File.walk (CCIO.File.make "/tmp");;
+# Gen.map CCIO.File.show_walk_item content |> CCIO.write_lines stdout;;
module File : sig ... end
\ No newline at end of file diff --git a/3.10/containers/CCInt/.dummy b/3.10/containers/CCInt/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCInt/Infix/index.html b/3.10/containers/CCInt/Infix/index.html new file mode 100644 index 00000000..e2488fc6 --- /dev/null +++ b/3.10/containers/CCInt/Infix/index.html @@ -0,0 +1,2 @@ + +Infix (containers.CCInt.Infix)

Module CCInt.Infix

val (=) : t -> t -> bool
  • since 0.17
val (<>) : t -> t -> bool
  • since 0.17
val (<) : t -> t -> bool
  • since 0.17
val (>) : t -> t -> bool
  • since 0.17
val (<=) : t -> t -> bool
  • since 0.17
val (>=) : t -> t -> bool
  • since 0.17
val (--) : t -> t -> t iter

Alias to range.

  • since 1.2
val (--^) : t -> t -> t iter

Alias to range'.

  • since 1.2
val (+) : t -> t -> t
  • since 2.1
val (-) : t -> t -> t
  • since 2.1
val (~-) : t -> t
  • since 2.1
val (*) : t -> t -> t
  • since 2.1
val (/) : t -> t -> t
  • since 2.1
val (**) : t -> t -> t
  • since 2.4
val (mod) : t -> t -> t
  • since 2.1
val (land) : t -> t -> t
  • since 2.1
val (lor) : t -> t -> t
  • since 2.1
val (lxor) : t -> t -> t
  • since 2.1
val lnot : t -> t
  • since 2.1
val (lsl) : t -> int -> t
  • since 2.1
val (lsr) : t -> int -> t
  • since 2.1
val (asr) : t -> int -> t
  • since 2.1
\ No newline at end of file diff --git a/3.10/containers/CCInt/index.html b/3.10/containers/CCInt/index.html new file mode 100644 index 00000000..25ada972 --- /dev/null +++ b/3.10/containers/CCInt/index.html @@ -0,0 +1,2 @@ + +CCInt (containers.CCInt)

Module CCInt

Basic Int functions

type t = int
val zero : t

zero is the integer 0.

  • since 3.0
val one : t

one is the integer 1.

  • since 3.0
val minus_one : t

minus_one is the integer -1.

  • since 3.0
val add : t -> t -> t

add x y is x + y.

  • since 3.0
val sub : t -> t -> t

sub x y is x - y.

  • since 3.0
val mul : t -> t -> t

mul x y is x * y.

  • since 3.0
val div : t -> t -> t

div x y is x / y

  • since 3.0
val succ : t -> t

succ x is x + 1.

  • since 3.0
val pred : t -> t

pred x is x - 1.

  • since 3.0
val abs : t -> t

abs x is the absolute value of x. It is x if x is positive and neg x otherwise.

  • since 3.0
val max_int : t

max_int is the maximum integer.

  • since 3.0
val min_int : t

min_int is the minimum integer.

  • since 3.0
val compare : t -> t -> int

compare x y is the comparison function for integers with the same specification as Stdlib.compare.

val equal : t -> t -> bool

equal x y is true iff x and y are equal. Equality function for integers.

val hash : t -> int

hash x computes the hash of x.

val sign : t -> int

sign x return 0 if x = 0, -1 if x < 0 and 1 if x > 0. Same as compare x 0.

val neg : t -> t

neg x is - x. Unary negation.

  • since 0.5
val pow : t -> t -> t

pow base exponent returns base raised to the power of exponent. pow x y = x^y for positive integers x and y. Raises Invalid_argument if x = y = 0 or y < 0.

  • since 0.11
val floor_div : t -> t -> t

floor_div x n is integer division rounding towards negative infinity. It satisfies x = m * floor_div x n + rem x n.

  • since 1.2
val rem : t -> t -> t

rem x n is the remainder of dividing x by n, with the same sign as n.

  • since 1.2
type 'a printer = Stdlib.Format.formatter -> 'a -> unit
type 'a random_gen = Stdlib.Random.State.t -> 'a
type 'a iter = ( 'a -> unit ) -> unit
val random : int -> t random_gen
val random_small : t random_gen
val random_range : int -> int -> t random_gen
val pp : t printer

pp ppf x prints the integer x on ppf.

val to_float : t -> float

to_float is the same as float_of_int

  • since 3.0
val to_string : t -> string

to_string x returns the string representation of the integer x, in signed decimal.

  • since 0.13
val of_string : string -> t option

of_string s converts the given string s into an integer. Safe version of of_string_exn.

  • since 0.13
val of_string_exn : string -> t

of_string_exn s converts the given string s to an integer. Alias to int_of_string.

  • raises Failure

    in case of failure.

  • since 3.0
val of_float : float -> t

of_float x converts the given floating-point number x to an integer. Alias to int_of_float.

  • since 3.0
val pp_binary : t printer

pp_binary ppf x prints x on ppf. Print as "0b00101010".

  • since 0.20
val to_string_binary : t -> string

to_string_binary x returns the string representation of the integer x, in binary.

  • since 0.20
val min : t -> t -> t

min x y returns the minimum of the two integers x and y.

  • since 0.17
val max : t -> t -> t

max x y returns the maximum of the two integers x and y.

  • since 0.17
val range_by : step:t -> t -> t -> t iter

range_by ~step i j iterates on integers from i to j included, where the difference between successive elements is step. Use a negative step for a decreasing list.

  • raises Invalid_argument

    if step=0.

  • since 1.2
val range : t -> t -> t iter

range i j iterates on integers from i to j included . It works both for decreasing and increasing ranges.

  • since 1.2
val range' : t -> t -> t iter

range' i j is like range but the second bound j is excluded. For instance range' 0 5 = Iter.of_list [0;1;2;3;4].

  • since 1.2
val popcount : t -> int

Number of bits set to 1

  • since 3.0
val logand : t -> t -> t

logand is the same as (land).

  • since 3.0
val logor : t -> t -> t

logand is the same as (lor).

  • since 3.0
val logxor : t -> t -> t

logxor is the same as (lxor).

  • since 3.0
val lognot : t -> t

logand is the same as lnot.

  • since 3.0
val shift_left : t -> int -> t

shift_left is the same as (lsl).

  • since 3.0
val shift_right : t -> int -> t

shift_right is the same as (asr).

  • since 3.0
val shift_right_logical : t -> int -> t

shift_right_logical is the same as (lsr).

  • since 3.0

Infix Operators

module Infix : sig ... end
include module type of Infix
val (=) : t -> t -> bool
  • since 0.17
val (<>) : t -> t -> bool
  • since 0.17
val (<) : t -> t -> bool
  • since 0.17
val (>) : t -> t -> bool
  • since 0.17
val (<=) : t -> t -> bool
  • since 0.17
val (>=) : t -> t -> bool
  • since 0.17
val (--) : t -> t -> t iter

Alias to range.

  • since 1.2
val (--^) : t -> t -> t iter

Alias to range'.

  • since 1.2
val (+) : t -> t -> t
  • since 2.1
val (-) : t -> t -> t
  • since 2.1
val (~-) : t -> t
  • since 2.1
val (*) : t -> t -> t
  • since 2.1
val (/) : t -> t -> t
  • since 2.1
val (**) : t -> t -> t
  • since 2.4
val (mod) : t -> t -> t
  • since 2.1
val (land) : t -> t -> t
  • since 2.1
val (lor) : t -> t -> t
  • since 2.1
val (lxor) : t -> t -> t
  • since 2.1
val lnot : t -> t
  • since 2.1
val (lsl) : t -> int -> t
  • since 2.1
val (lsr) : t -> int -> t
  • since 2.1
val (asr) : t -> int -> t
  • since 2.1
\ No newline at end of file diff --git a/3.10/containers/CCInt32/.dummy b/3.10/containers/CCInt32/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCInt32/Infix/index.html b/3.10/containers/CCInt32/Infix/index.html new file mode 100644 index 00000000..41703343 --- /dev/null +++ b/3.10/containers/CCInt32/Infix/index.html @@ -0,0 +1,2 @@ + +Infix (containers.CCInt32.Infix)

Module CCInt32.Infix

val (+) : t -> t -> t

x + y is the sum of x and y. Addition.

val (-) : t -> t -> t

x - y is the difference of x and y. Subtraction.

val (~-) : t -> t

~- x is the negation of x. Unary negation.

val (*) : t -> t -> t

x * y is the product of x and y. Multiplication.

val (/) : t -> t -> t

x / y is the integer quotient of x and y. Integer division. Raise Division_by_zero if the second argument y is zero. This division rounds the real quotient of its arguments towards zero, as specified for Stdlib.(/).

val (mod) : t -> t -> t

x mod y is the integer remainder of x / y. If y <> zero, the result of x mod y satisfies the following properties: zero <= x mod y < abs y and x = ((x / y) * y) + (x mod y). If y = 0, x mod y raises Division_by_zero.

val (**) : t -> t -> t

Alias to pow

  • since 3.0
val (--) : t -> t -> t iter

Alias to range.

  • since 3.0
val (--^) : t -> t -> t iter

Alias to range'.

  • since 3.0
val (land) : t -> t -> t

x land y is the bitwise logical and of x and y.

val (lor) : t -> t -> t

x lor y is the bitwise logical or of x and y.

val (lxor) : t -> t -> t

x lxor y is the bitwise logical exclusive or of x and y.

val lnot : t -> t

lnot x is the bitwise logical negation of x (the bits of x are inverted).

val (lsl) : t -> int -> t

x lsl y shifts x to the left by y bits, filling in with zeroes. The result is unspecified if y < 0 or y >= 32.

val (lsr) : t -> int -> t

x lsr y shifts x to the right by y bits. This is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of x. The result is unspecified if y < 0 or y >= 32.

val (asr) : t -> int -> t

x asr y shifts x to the right by y bits. This is an arithmetic shift: the sign bit of x is replicated and inserted in the vacated bits. The result is unspecified if y < 0 or y >= 32.

val (=) : t -> t -> bool
val (<>) : t -> t -> bool
val (>) : t -> t -> bool
val (>=) : t -> t -> bool
val (<=) : t -> t -> bool
val (<) : t -> t -> bool
\ No newline at end of file diff --git a/3.10/containers/CCInt32/index.html b/3.10/containers/CCInt32/index.html new file mode 100644 index 00000000..112131fb --- /dev/null +++ b/3.10/containers/CCInt32/index.html @@ -0,0 +1,2 @@ + +CCInt32 (containers.CCInt32)

Module CCInt32

Helpers for 32-bit integers.

This module provides operations on the type int32 of signed 32-bit integers. Unlike the built-in int type, the type int32 is guaranteed to be exactly 32-bit wide on all platforms. All arithmetic operations over int32 are taken modulo 232.

Performance notice: values of type int32 occupy more memory space than values of type int, and arithmetic operations on int32 are generally slower than those on int. Use int32 only when the application requires exact 32-bit arithmetic.

include module type of struct include Stdlib.Int32 end
val zero : int32
val one : int32
val minus_one : int32
val neg : int32 -> int32
val add : int32 -> int32 -> int32
val sub : int32 -> int32 -> int32
val mul : int32 -> int32 -> int32
val div : int32 -> int32 -> int32
val unsigned_div : int32 -> int32 -> int32
val rem : int32 -> int32 -> int32
val unsigned_rem : int32 -> int32 -> int32
val succ : int32 -> int32
val pred : int32 -> int32
val abs : int32 -> int32
val max_int : int32
val min_int : int32
val logand : int32 -> int32 -> int32
val logor : int32 -> int32 -> int32
val logxor : int32 -> int32 -> int32
val lognot : int32 -> int32
val shift_left : int32 -> int -> int32
val shift_right : int32 -> int -> int32
val shift_right_logical : int32 -> int -> int32
val of_int : int -> int32
val to_int : int32 -> int
val unsigned_to_int : int32 -> int option
val of_float : float -> int32
val to_float : int32 -> float
val to_string : int32 -> string
val bits_of_float : float -> int32
val float_of_bits : int32 -> float
type t = int32
val compare : t -> t -> int
val unsigned_compare : t -> t -> int
val equal : t -> t -> bool
val format : string -> int32 -> string
val min : t -> t -> t

min x y returns the minimum of the two integers x and y.

  • since 3.0
val max : t -> t -> t

max x y returns the maximum of the two integers x and y.

  • since 3.0
val hash : t -> int

hash x computes the hash of x. Like Stdlib.abs(to_intx).

val sign : t -> int

sign x return 0 if x = 0, -1 if x < 0 and 1 if x > 0. Same as compare x zero.

  • since 3.0
val pow : t -> t -> t

pow base exponent returns base raised to the power of exponent. pow x y = x^y for positive integers x and y. Raises Invalid_argument if x = y = 0 or y < 0.

  • since 0.11
val popcount : t -> int

Number of bits set to 1.

  • since 3.9
val floor_div : t -> t -> t

floor_div x n is integer division rounding towards negative infinity. It satisfies x = m * floor_div x n + rem x n.

  • since 3.0
type 'a printer = Stdlib.Format.formatter -> 'a -> unit
type 'a random_gen = Stdlib.Random.State.t -> 'a
type 'a iter = ( 'a -> unit ) -> unit
val range_by : step:t -> t -> t -> t iter

range_by ~step i j iterates on integers from i to j included, where the difference between successive elements is step. Use a negative step for a decreasing list.

  • raises Invalid_argument

    if step=0.

  • since 3.0
val range : t -> t -> t iter

range i j iterates on integers from i to j included . It works both for decreasing and increasing ranges.

  • since 3.0
val range' : t -> t -> t iter

range' i j is like range but the second bound j is excluded. For instance range' 0 5 = Iter.of_list [0;1;2;3;4].

  • since 3.0
val random : t -> t random_gen
val random_small : t random_gen
val random_range : t -> t -> t random_gen

Conversion

val of_string : string -> t option

of_string s is the safe version of of_string_exn. Like of_string_exn, but return None instead of raising.

val of_string_opt : string -> t option

of_string_opt s is an alias to of_string.

val of_string_exn : string -> t

of_string_exn s converts the given string s into a 32-bit integer. Alias to Int32.of_string. The string is read in decimal (by default, or if the string begins with 0u) or in hexadecimal, octal or binary if the string begins with 0x, 0o or 0b respectively.

The 0u prefix reads the input as an unsigned integer in the range [0, 2*CCInt32.max_int+1]. If the input exceeds CCInt32.max_int it is converted to the signed integer CCInt32.min_int + input - CCInt32.max_int - 1.

The _ (underscore) character can appear anywhere in the string and is ignored. Raise Failure "Int32.of_string" if the given string is not a valid representation of an integer, or if the integer represented exceeds the range of integers representable in type int32.

val to_string_binary : t -> string

to_string_binary x returns the string representation of the integer x, in binary.

  • since 3.0

Printing

val pp : t printer

pp ppf x prints the integer x on ppf.

  • since 3.0
val pp_binary : t printer

pp_binary ppf x prints x on ppf. Print as "0b00101010".

  • since 3.0

Infix Operators

module Infix : sig ... end
include module type of Infix
val (+) : t -> t -> t

x + y is the sum of x and y. Addition.

val (-) : t -> t -> t

x - y is the difference of x and y. Subtraction.

val (~-) : t -> t

~- x is the negation of x. Unary negation.

val (*) : t -> t -> t

x * y is the product of x and y. Multiplication.

val (/) : t -> t -> t

x / y is the integer quotient of x and y. Integer division. Raise Division_by_zero if the second argument y is zero. This division rounds the real quotient of its arguments towards zero, as specified for Stdlib.(/).

val (mod) : t -> t -> t

x mod y is the integer remainder of x / y. If y <> zero, the result of x mod y satisfies the following properties: zero <= x mod y < abs y and x = ((x / y) * y) + (x mod y). If y = 0, x mod y raises Division_by_zero.

val (**) : t -> t -> t

Alias to pow

  • since 3.0
val (--) : t -> t -> t iter

Alias to range.

  • since 3.0
val (--^) : t -> t -> t iter

Alias to range'.

  • since 3.0
val (land) : t -> t -> t

x land y is the bitwise logical and of x and y.

val (lor) : t -> t -> t

x lor y is the bitwise logical or of x and y.

val (lxor) : t -> t -> t

x lxor y is the bitwise logical exclusive or of x and y.

val lnot : t -> t

lnot x is the bitwise logical negation of x (the bits of x are inverted).

val (lsl) : t -> int -> t

x lsl y shifts x to the left by y bits, filling in with zeroes. The result is unspecified if y < 0 or y >= 32.

val (lsr) : t -> int -> t

x lsr y shifts x to the right by y bits. This is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of x. The result is unspecified if y < 0 or y >= 32.

val (asr) : t -> int -> t

x asr y shifts x to the right by y bits. This is an arithmetic shift: the sign bit of x is replicated and inserted in the vacated bits. The result is unspecified if y < 0 or y >= 32.

val (=) : t -> t -> bool
val (<>) : t -> t -> bool
val (>) : t -> t -> bool
val (>=) : t -> t -> bool
val (<=) : t -> t -> bool
val (<) : t -> t -> bool
\ No newline at end of file diff --git a/3.10/containers/CCInt64/.dummy b/3.10/containers/CCInt64/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCInt64/Infix/index.html b/3.10/containers/CCInt64/Infix/index.html new file mode 100644 index 00000000..4d171959 --- /dev/null +++ b/3.10/containers/CCInt64/Infix/index.html @@ -0,0 +1,2 @@ + +Infix (containers.CCInt64.Infix)

Module CCInt64.Infix

val (+) : t -> t -> t

x + y is the sum of x and y. Addition.

val (-) : t -> t -> t

x - y is the difference of x and y. Subtraction.

val (~-) : t -> t

~- x is the negation of x. Unary negation.

val (*) : t -> t -> t

x * y is the product of x and y. Multiplication.

val (/) : t -> t -> t

x / y is the integer quotient of x and y. Integer division. Raise Division_by_zero if the second argument y is zero. This division rounds the real quotient of its arguments towards zero, as specified for Stdlib.(/).

val (mod) : t -> t -> t

x mod y is the integer remainder of x / y. If y <> zero, the result of x mod y satisfies the following properties: zero <= x mod y < abs y and x = ((x / y) * y) + (x mod y). If y = 0, x mod y raises Division_by_zero.

val (**) : t -> t -> t

Alias to pow

  • since 3.0
val (--) : t -> t -> t iter

Alias to range.

  • since 3.0
val (--^) : t -> t -> t iter

Alias to range'.

  • since 3.0
val (land) : t -> t -> t

x land y is the bitwise logical and of x and y.

val (lor) : t -> t -> t

x lor y is the bitwise logical or of x and y.

val (lxor) : t -> t -> t

x lxor y is the bitwise logical exclusive or of x and y.

val lnot : t -> t

lnot x is the bitwise logical negation of x (the bits of x are inverted).

val (lsl) : t -> int -> t

x lsl y shifts x to the left by y bits, filling in with zeroes. The result is unspecified if y < 0 or y >= 64.

val (lsr) : t -> int -> t

x lsr y shifts x to the right by y bits. This is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of x. The result is unspecified if y < 0 or y >= 64.

val (asr) : t -> int -> t

x asr y shifts x to the right by y bits. This is an arithmetic shift: the sign bit of x is replicated and inserted in the vacated bits. The result is unspecified if y < 0 or y >= 64.

val (=) : t -> t -> bool
val (<>) : t -> t -> bool
val (>) : t -> t -> bool
val (>=) : t -> t -> bool
val (<=) : t -> t -> bool
val (<) : t -> t -> bool
\ No newline at end of file diff --git a/3.10/containers/CCInt64/index.html b/3.10/containers/CCInt64/index.html new file mode 100644 index 00000000..9c93c0d8 --- /dev/null +++ b/3.10/containers/CCInt64/index.html @@ -0,0 +1,2 @@ + +CCInt64 (containers.CCInt64)

Module CCInt64

Helpers for 64-bit integers.

This module provides operations on the type int64 of signed 64-bit integers. Unlike the built-in int type, the type int64 is guaranteed to be exactly 64-bit wide on all platforms. All arithmetic operations over int64 are taken modulo 264.

Performance notice: values of type int64 occupy more memory space than values of type int, and arithmetic operations on int64 are generally slower than those on int. Use int64 only when the application requires exact 64-bit arithmetic.

include module type of struct include Stdlib.Int64 end
val zero : int64
val one : int64
val minus_one : int64
val neg : int64 -> int64
val add : int64 -> int64 -> int64
val sub : int64 -> int64 -> int64
val mul : int64 -> int64 -> int64
val div : int64 -> int64 -> int64
val unsigned_div : int64 -> int64 -> int64
val rem : int64 -> int64 -> int64
val unsigned_rem : int64 -> int64 -> int64
val succ : int64 -> int64
val pred : int64 -> int64
val abs : int64 -> int64
val max_int : int64
val min_int : int64
val logand : int64 -> int64 -> int64
val logor : int64 -> int64 -> int64
val logxor : int64 -> int64 -> int64
val lognot : int64 -> int64
val shift_left : int64 -> int -> int64
val shift_right : int64 -> int -> int64
val shift_right_logical : int64 -> int -> int64
val of_int : int -> int64
val to_int : int64 -> int
val unsigned_to_int : int64 -> int option
val of_float : float -> int64
val to_float : int64 -> float
val of_int32 : int32 -> int64
val to_int32 : int64 -> int32
val of_nativeint : nativeint -> int64
val to_nativeint : int64 -> nativeint
val to_string : int64 -> string
val bits_of_float : float -> int64
val float_of_bits : int64 -> float
type t = int64
val compare : t -> t -> int
val unsigned_compare : t -> t -> int
val equal : t -> t -> bool
val format : string -> int64 -> string
val min : t -> t -> t

min x y returns the minimum of the two integers x and y.

  • since 3.0
val max : t -> t -> t

max x y returns the maximum of the two integers x and y.

  • since 3.0
val hash : t -> int

hash x computes the hash of x, a non-negative integer. Uses FNV since NEXT_RELEASE

val hash_to_int64 : t -> t

Like hash but does not truncate. Uses FNV.

  • since NEXT_RELEASE
val popcount : t -> int

Number of bits set to 1.

  • since 3.9
val sign : t -> int

sign x return 0 if x = 0, -1 if x < 0 and 1 if x > 0. Same as compare x zero.

  • since 3.0
val pow : t -> t -> t

pow base exponent returns base raised to the power of exponent. pow x y = x^y for positive integers x and y. Raises Invalid_argument if x = y = 0 or y < 0.

  • since 0.11
val floor_div : t -> t -> t

floor_div x n is integer division rounding towards negative infinity. It satisfies x = m * floor_div x n + rem x n.

  • since 3.0
type 'a printer = Stdlib.Format.formatter -> 'a -> unit
type 'a random_gen = Stdlib.Random.State.t -> 'a
type 'a iter = ( 'a -> unit ) -> unit
val range_by : step:t -> t -> t -> t iter

range_by ~step i j iterates on integers from i to j included, where the difference between successive elements is step. Use a negative step for a decreasing list.

  • raises Invalid_argument

    if step=0.

  • since 3.0
val range : t -> t -> t iter

range i j iterates on integers from i to j included . It works both for decreasing and increasing ranges.

  • since 3.0
val range' : t -> t -> t iter

range' i j is like range but the second bound j is excluded. For instance range' 0 5 = Iter.of_list [0;1;2;3;4].

  • since 3.0
val random : t -> t random_gen
val random_small : t random_gen
val random_range : t -> t -> t random_gen

Conversion

val of_string : string -> t option

of_string s is the safe version of of_string_exn. Like of_string_exn, but return None instead of raising.

val of_string_opt : string -> t option

of_string_opt s is an alias to of_string.

  • since 2.1
val of_string_exn : string -> t

of_string_exn s converts the given string s into a 64-bit integer. Alias to Int64.of_string. The string is read in decimal (by default, or if the string begins with 0u) or in hexadecimal, octal or binary if the string begins with 0x, 0o or 0b respectively.

The 0u prefix reads the input as an unsigned integer in the range [0, 2*CCInt64.max_int+1]. If the input exceeds CCInt64.max_int it is converted to the signed integer CCInt64.min_int + input - CCInt64.max_int - 1.

The _ (underscore) character can appear anywhere in the string and is ignored. Raise Failure "Int64.of_string" if the given string is not a valid representation of an integer, or if the integer represented exceeds the range of integers representable in type int64.

val to_string_binary : t -> string

to_string_binary x returns the string representation of the integer x, in binary.

  • since 3.0

Printing

val pp : t printer

pp ppf x prints the integer x on ppf.

  • since 3.0
val pp_binary : t printer

pp_binary ppf x prints x on ppf. Print as "0b00101010".

  • since 3.0

Infix Operators

Infix operators

module Infix : sig ... end
include module type of Infix
val (+) : t -> t -> t

x + y is the sum of x and y. Addition.

val (-) : t -> t -> t

x - y is the difference of x and y. Subtraction.

val (~-) : t -> t

~- x is the negation of x. Unary negation.

val (*) : t -> t -> t

x * y is the product of x and y. Multiplication.

val (/) : t -> t -> t

x / y is the integer quotient of x and y. Integer division. Raise Division_by_zero if the second argument y is zero. This division rounds the real quotient of its arguments towards zero, as specified for Stdlib.(/).

val (mod) : t -> t -> t

x mod y is the integer remainder of x / y. If y <> zero, the result of x mod y satisfies the following properties: zero <= x mod y < abs y and x = ((x / y) * y) + (x mod y). If y = 0, x mod y raises Division_by_zero.

val (**) : t -> t -> t

Alias to pow

  • since 3.0
val (--) : t -> t -> t iter

Alias to range.

  • since 3.0
val (--^) : t -> t -> t iter

Alias to range'.

  • since 3.0
val (land) : t -> t -> t

x land y is the bitwise logical and of x and y.

val (lor) : t -> t -> t

x lor y is the bitwise logical or of x and y.

val (lxor) : t -> t -> t

x lxor y is the bitwise logical exclusive or of x and y.

val lnot : t -> t

lnot x is the bitwise logical negation of x (the bits of x are inverted).

val (lsl) : t -> int -> t

x lsl y shifts x to the left by y bits, filling in with zeroes. The result is unspecified if y < 0 or y >= 64.

val (lsr) : t -> int -> t

x lsr y shifts x to the right by y bits. This is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of x. The result is unspecified if y < 0 or y >= 64.

val (asr) : t -> int -> t

x asr y shifts x to the right by y bits. This is an arithmetic shift: the sign bit of x is replicated and inserted in the vacated bits. The result is unspecified if y < 0 or y >= 64.

val (=) : t -> t -> bool
val (<>) : t -> t -> bool
val (>) : t -> t -> bool
val (>=) : t -> t -> bool
val (<=) : t -> t -> bool
val (<) : t -> t -> bool
\ No newline at end of file diff --git a/3.10/containers/CCList/.dummy b/3.10/containers/CCList/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCList/Assoc/index.html b/3.10/containers/CCList/Assoc/index.html new file mode 100644 index 00000000..9898483f --- /dev/null +++ b/3.10/containers/CCList/Assoc/index.html @@ -0,0 +1,7 @@ + +Assoc (containers.CCList.Assoc)

Module CCList.Assoc

type ('a, 'b) t = ('a * 'b) list
val get : eq:( 'a -> 'a -> bool ) -> 'a -> ( 'a, 'b ) t -> 'b option

get ~eq k alist returns Some v if the given key k is present into alist, or None if not present.

val get_exn : eq:( 'a -> 'a -> bool ) -> 'a -> ( 'a, 'b ) t -> 'b

get_exn ~eq k alist returns v if the element k is present into alist. Like get, but unsafe.

  • raises Not_found

    if the element is not present.

val set : eq:( 'a -> 'a -> bool ) -> 'a -> 'b -> ( 'a, 'b ) t -> ( 'a, 'b ) t

set ~eq k v alist adds the binding k, v into the list alist (erase it if already present).

val mem : ?eq:( 'a -> 'a -> bool ) -> 'a -> ( 'a, _ ) t -> bool

mem ?eq k alist returns true iff k is a key in alist.

  • since 0.16
val update : + eq:( 'a -> 'a -> bool ) -> + f:( 'b option -> 'b option ) -> + 'a -> + ( 'a, 'b ) t -> + ( 'a, 'b ) t

update ~eq ~f k alist updates alist on the key k, by calling f (get k alist) and removing k if it returns None, mapping k to v' if it returns Some v'.

  • since 0.16
val remove : eq:( 'a -> 'a -> bool ) -> 'a -> ( 'a, 'b ) t -> ( 'a, 'b ) t

remove ~eq k alist returns the alist without the first pair with key k, if any.

  • since 0.17
val keys : ( 'a, 'b ) t -> 'a list

keys alist returns a list of all keys of alist.

  • since 3.8
val values : ( 'a, 'b ) t -> 'b list

values alist returns a list of all values of alist.

  • since 3.8
val map_values : ( 'b -> 'c ) -> ( 'a, 'b ) t -> ( 'a, 'c ) t

map_values f alist applies function f to all values of alist.

  • since 3.8
\ No newline at end of file diff --git a/3.10/containers/CCList/Infix/index.html b/3.10/containers/CCList/Infix/index.html new file mode 100644 index 00000000..12311d03 --- /dev/null +++ b/3.10/containers/CCList/Infix/index.html @@ -0,0 +1,9 @@ + +Infix (containers.CCList.Infix)

Module CCList.Infix

val (>|=) : 'a t -> ( 'a -> 'b ) -> 'b t

l >|= f is the infix version of map with reversed arguments.

val (@) : 'a t -> 'a t -> 'a t

l1 @ l2 concatenates two lists l1 and l2. As append.

val (<*>) : ( 'a -> 'b ) t -> 'a t -> 'b t

funs <*> l is product (fun f x -> f x) funs l.

val (<$>) : ( 'a -> 'b ) -> 'a t -> 'b t

f <$> l is like map.

val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t

l >>= f is flat_map f l.

val (--) : int -> int -> int t

i -- j is the infix alias for range. Bounds included.

val (--^) : int -> int -> int t

i --^ j is the infix alias for range'. Second bound j excluded.

  • since 0.17
val let+ : 'a t -> ( 'a -> 'b ) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ( 'a -> 'b t ) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t
val and& : 'a list -> 'b list -> ('a * 'b) list

(and&) is combine_shortest. It allows to perform a synchronized product between two lists, stopping gently at the shortest. Usable both with let+ and let*.

# let f xs ys zs =
+    let+ x = xs
+    and& y = ys
+    and& z = zs in
+    x + y + z;;
+val f : int list -> int list -> int list -> int list = <fun>
+# f [1;2] [5;6;7] [10;10];;
+- : int list = [16; 18]
  • since 3.1
\ No newline at end of file diff --git a/3.10/containers/CCList/Ref/index.html b/3.10/containers/CCList/Ref/index.html new file mode 100644 index 00000000..1d26c04e --- /dev/null +++ b/3.10/containers/CCList/Ref/index.html @@ -0,0 +1,2 @@ + +Ref (containers.CCList.Ref)

Module CCList.Ref

type 'a t = 'a list Stdlib.ref
val push : 'a t -> 'a -> unit

push rlist e adds an element e at the head of rlist.

val pop : 'a t -> 'a option

pop rlist removes and returns Some e (the first element of rlist) or None if the rlist is empty

val pop_exn : 'a t -> 'a

pop_exn rlist removes and returns the first element of rlist. Unsafe version of pop.

  • raises Failure

    if the list is empty.

val create : unit -> 'a t

create () creates a new empty reference list.

val clear : _ t -> unit

clear rlist removes all elements of rlist.

val lift : ( 'a list -> 'b ) -> 'a t -> 'b

lift f rlist applies a list function f to the content of rlist.

val push_list : 'a t -> 'a list -> unit

push_list rlist l adds elements of the list l at the beginning of the list ref rlist. Elements at the end of the list l will be at the beginning of the list ref rlist.

\ No newline at end of file diff --git a/3.10/containers/CCList/Traverse/argument-1-M/index.html b/3.10/containers/CCList/Traverse/argument-1-M/index.html new file mode 100644 index 00000000..48d5a5e4 --- /dev/null +++ b/3.10/containers/CCList/Traverse/argument-1-M/index.html @@ -0,0 +1,2 @@ + +M (containers.CCList.Traverse.1-M)

Parameter Traverse.1-M

type 'a t
val return : 'a -> 'a t

return is the Monadic return.

val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t

(>>=) is the Monadic bind.

\ No newline at end of file diff --git a/3.10/containers/CCList/Traverse/index.html b/3.10/containers/CCList/Traverse/index.html new file mode 100644 index 00000000..0ff2782b --- /dev/null +++ b/3.10/containers/CCList/Traverse/index.html @@ -0,0 +1,2 @@ + +Traverse (containers.CCList.Traverse)

Module CCList.Traverse

Monadic Traverse

This allows the traversal of a 'a t list where _ t is also a monad.

For example, a 'a option list will be traversed by extracting a value from each option, returning Some [x1;…;x_n]; but if one of the option is None then the whole result is None.

Another example is with result: ('a, 'err) result list can be transformed into ('a list, 'err) result by returning the first error, or Ok [x1; …; xn] if all the elements were successful.

This describes the behavior of sequence_m; map_m is a combination of map and sequence_m; map_m_par is like map_m but useful for some pseudo monads like Lwt.

Parameters

module M : MONAD

Signature

val sequence_m : 'a M.t t -> 'a t M.t

Traverse the list of monadic values using M.(>>=), re-combining elements with (::). See the documentation of the Traverse functor itself.

val fold_m : ( 'b -> 'a -> 'b M.t ) -> 'b -> 'a t -> 'b M.t

Fold a function with a monadic effect through a list.

val map_m : ( 'a -> 'b M.t ) -> 'a t -> 'b t M.t

Combination of map and sequence_m.

val map_m_par : ( 'a -> 'b M.t ) -> 'a t -> 'b t M.t

map_m_par f (x :: l) is like map_m but f x and f l are evaluated "in parallel" before combining their result (for instance in Lwt).

Basically, when encoutering x :: tl, this computes f x and map_m_par f tl, and only then is M.(>>=) used to combine the two results into a new list.

\ No newline at end of file diff --git a/3.10/containers/CCList/index.html b/3.10/containers/CCList/index.html new file mode 100644 index 00000000..726d4dc4 --- /dev/null +++ b/3.10/containers/CCList/index.html @@ -0,0 +1,114 @@ + +CCList (containers.CCList)

Module CCList

Complements to List

type 'a iter = ( 'a -> unit ) -> unit

Fast internal iterator.

  • since 2.8
type 'a gen = unit -> 'a option
type 'a printer = Stdlib.Format.formatter -> 'a -> unit
type 'a random_gen = Stdlib.Random.State.t -> 'a
val length : 'a list -> int
val cons : 'a -> 'a list -> 'a list
val hd : 'a list -> 'a
val tl : 'a list -> 'a list
val nth : 'a list -> int -> 'a
val rev : 'a list -> 'a list
val rev_append : 'a list -> 'a list -> 'a list
val concat : 'a list list -> 'a list
val iter : ( 'a -> unit ) -> 'a list -> unit
val rev_map : ( 'a -> 'b ) -> 'a list -> 'b list
val concat_map : ( 'a -> 'b list ) -> 'a list -> 'b list
val fold_left_map : ( 'a -> 'b -> 'a * 'c ) -> 'a -> 'b list -> 'a * 'c list
val fold_left : ( 'a -> 'b -> 'a ) -> 'a -> 'b list -> 'a
val iter2 : ( 'a -> 'b -> unit ) -> 'a list -> 'b list -> unit
val map2 : ( 'a -> 'b -> 'c ) -> 'a list -> 'b list -> 'c list
val rev_map2 : ( 'a -> 'b -> 'c ) -> 'a list -> 'b list -> 'c list
val fold_left2 : ( 'a -> 'b -> 'c -> 'a ) -> 'a -> 'b list -> 'c list -> 'a
val fold_right2 : ( 'a -> 'b -> 'c -> 'c ) -> 'a list -> 'b list -> 'c -> 'c
val for_all : ( 'a -> bool ) -> 'a list -> bool
val exists : ( 'a -> bool ) -> 'a list -> bool
val for_all2 : ( 'a -> 'b -> bool ) -> 'a list -> 'b list -> bool
val exists2 : ( 'a -> 'b -> bool ) -> 'a list -> 'b list -> bool
val memq : 'a -> 'a list -> bool
val find : ( 'a -> bool ) -> 'a list -> 'a
val find_all : ( 'a -> bool ) -> 'a list -> 'a list
val filteri : ( int -> 'a -> bool ) -> 'a list -> 'a list
val partition : ( 'a -> bool ) -> 'a list -> 'a list * 'a list
val assq : 'a -> ('a * 'b) list -> 'b
val mem_assq : 'a -> ('a * 'b) list -> bool
val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list
val sort : ( 'a -> 'a -> int ) -> 'a list -> 'a list
val stable_sort : ( 'a -> 'a -> int ) -> 'a list -> 'a list
val fast_sort : ( 'a -> 'a -> int ) -> 'a list -> 'a list
val merge : ( 'a -> 'a -> int ) -> 'a list -> 'a list -> 'a list
type +'a t = 'a list
val empty : 'a t

empty is [].

val is_empty : _ t -> bool

is_empty l returns true iff l = [].

  • since 0.11
val map : ( 'a -> 'b ) -> 'a t -> 'b t

map f [a0; a1; …; an] applies function f in turn to a0; a1; …; an. Safe version of List.map.

val append : 'a t -> 'a t -> 'a t

append l1 l2 returns the list that is the concatenation of l1 and l2. Safe version of List.append.

val cons_maybe : 'a option -> 'a t -> 'a t

cons_maybe (Some x) l is x :: l. cons_maybe None l is l.

  • since 0.13
val cons' : 'a t -> 'a -> 'a t

cons' l x is the same as x :: l. This is convenient for fold functions such as List.fold_left or Array.fold_left.

  • since 3.3
val filter : ( 'a -> bool ) -> 'a t -> 'a t

filter p l returns all the elements of the list l that satisfy the predicate p. The order of the elements in the input list l is preserved. Safe version of List.filter.

val fold_right : ( 'a -> 'b -> 'b ) -> 'a t -> 'b -> 'b

fold_right f [a1; …; an] b is f a1 (f a2 ( … (f an b) … )). Safe version of List.fold_right.

val fold_while : ( 'a -> 'b -> 'a * [ `Stop | `Continue ] ) -> 'a -> 'b t -> 'a

fold_while f init l folds until a stop condition via ('a, `Stop) is indicated by the accumulator.

  • since 0.8
val fold_map : ( 'acc -> 'a -> 'acc * 'b ) -> 'acc -> 'a list -> 'acc * 'b list

fold_map f init l is a fold_left-like function, but it also maps the list to another list.

  • since 0.14
val fold_map_i : + ( 'acc -> int -> 'a -> 'acc * 'b ) -> + 'acc -> + 'a list -> + 'acc * 'b list

fold_map_i f init l is a foldi-like function, but it also maps the list to another list.

  • since 2.8
val fold_on_map : + f:( 'a -> 'b ) -> + reduce:( 'acc -> 'b -> 'acc ) -> + 'acc -> + 'a list -> + 'acc

fold_on_map ~f ~reduce init l combines map f and fold_left reduce init in one operation.

  • since 2.8
val scan_left : ( 'acc -> 'a -> 'acc ) -> 'acc -> 'a list -> 'acc list

scan_left f init l returns the list [init; f init x0; f (f init x0) x1; …] where x0, x1, etc. are the elements of l.

  • since 1.2, but only
  • since 2.2 with labels
val reduce : ( 'a -> 'a -> 'a ) -> 'a list -> 'a option

reduce f (hd::tl) returns Some (fold_left f hd tl). If l is empty, then None is returned.

  • since 3.2
val reduce_exn : ( 'a -> 'a -> 'a ) -> 'a list -> 'a

reduce_exn is the unsafe version of reduce.

  • raises Invalid_argument

    if the given list is empty.

  • since 3.2
val fold_map2 : + ( 'acc -> 'a -> 'b -> 'acc * 'c ) -> + 'acc -> + 'a list -> + 'b list -> + 'acc * 'c list

fold_map2 f init l1 l2 is to fold_map what List.map2 is to List.map.

  • raises Invalid_argument

    if the lists do not have the same length.

  • since 0.16
val fold_filter_map : + ( 'acc -> 'a -> 'acc * 'b option ) -> + 'acc -> + 'a list -> + 'acc * 'b list

fold_filter_map f init l is a fold_left-like function, but also generates a list of output in a way similar to filter_map.

  • since 0.17
val fold_filter_map_i : + ( 'acc -> int -> 'a -> 'acc * 'b option ) -> + 'acc -> + 'a list -> + 'acc * 'b list

fold_filter_map_i f init l is a foldi-like function, but also generates a list of output in a way similar to filter_map.

  • since 2.8
val fold_flat_map : + ( 'acc -> 'a -> 'acc * 'b list ) -> + 'acc -> + 'a list -> + 'acc * 'b list

fold_flat_map f init 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 fold_flat_map_i : + ( 'acc -> int -> 'a -> 'acc * 'b list ) -> + 'acc -> + 'a list -> + 'acc * 'b list

fold_flat_map_i f init l is a fold_left-like function, but it also maps the list to a list of lists that is then flatten'd.

  • since 2.8
val count : ( 'a -> bool ) -> 'a list -> int

count p l counts how many elements of l satisfy predicate p.

  • since 1.5, but only
  • since 2.2 with labels
val count_true_false : ( 'a -> bool ) -> 'a list -> int * int

count_true_false p l returns a pair (int1,int2) where int1 is the number of elements in l that satisfy the predicate p, and int2 the number of elements that do not satisfy p.

  • since 2.4
val init : int -> ( int -> 'a ) -> 'a t

init len f is f 0; f 1; …; f (len-1).

  • raises Invalid_argument

    if len < 0.

  • since 0.6
val combine : 'a list -> 'b list -> ('a * 'b) list

combine [a1; …; an] [b1; …; bn] is [(a1,b1); …; (an,bn)]. Transform two lists into a list of pairs. Like List.combine but tail-recursive.

  • raises Invalid_argument

    if the lists have distinct lengths.

  • since 1.2, but only
  • since 2.2 with labels
val combine_gen : 'a list -> 'b list -> ('a * 'b) gen

combine_gen l1 l2 transforms two lists into a gen of pairs. Lazy version of combine. Unlike combine, it does not fail if the lists have different lengths; instead, the output has as many pairs as the smallest input list.

  • since 1.2, but only
  • since 2.2 with labels
val combine_shortest : 'a list -> 'b list -> ('a * 'b) list

combine_shortest [a1; …; am] [b1; …; bn] is [(a1,b1); …; (am,bm)] if m <= n. Like combine but stops at the shortest list rather than raising.

  • since 3.1
val split : ('a * 'b) t -> 'a t * 'b t

split [(a1,b1); …; (an,bn)] is ([a1; …; an], [b1; …; bn]). Transform a list of pairs into a pair of lists. A tail-recursive version of List.split.

  • since 1.2, but only
  • since 2.2 with labels
val compare : ( 'a -> 'a -> int ) -> 'a t -> 'a t -> int

compare cmp l1 l2 compares the two lists l1 and l2 using the given comparison function cmp.

val compare_lengths : 'a t -> 'b t -> int

compare_lengths l1 l2 compare the lengths of the two lists l1 and l2. Equivalent to compare (length l1) (length l2) but more efficient.

  • since 1.5, but only
  • since 2.2 with labels
val compare_length_with : 'a t -> int -> int

compare_length_with l x compares the length of the list l to an integer x. Equivalent to compare (length l) x but more efficient.

  • since 1.5, but only
  • since 2.2 with labels
val equal : ( 'a -> 'a -> bool ) -> 'a t -> 'a t -> bool

equal p l1 l2 returns true if l1 and l2 are equal.

val flat_map : ( 'a -> 'b t ) -> 'a t -> 'b t

flat_map f l maps and flattens at the same time (safe). Evaluation order is not guaranteed.

val flat_map_i : ( int -> 'a -> 'b t ) -> 'a t -> 'b t

flat_map_i f l maps with index and flattens at the same time (safe). Evaluation order is not guaranteed.

  • since 2.8
val flatten : 'a t t -> 'a t

flatten [l1]; [l2]; … concatenates a list of lists. Safe version of List.flatten.

val product : ( 'a -> 'b -> 'c ) -> 'a t -> 'b t -> 'c t

product comb l1 l2 computes the cartesian product of the two lists, with the given combinator comb.

val fold_product : ( 'c -> 'a -> 'b -> 'c ) -> 'c -> 'a t -> 'b t -> 'c

fold_product f init l1 l2 applies the function f with the accumulator init on all the pair of elements of l1 and l2. Fold on the cartesian product.

val cartesian_product : 'a t t -> 'a t t

cartesian_product [[l1]; [l2]; …; [ln]] produces the cartesian product of this list of lists, by returning all the ways of picking one element per sublist. NOTE the order of the returned list is unspecified. For example:

# cartesian_product [[1;2];[3];[4;5;6]] |> sort =
+[[1;3;4];[1;3;5];[1;3;6];[2;3;4];[2;3;5];[2;3;6]];;
+# cartesian_product [[1;2];[];[4;5;6]] = [];;
+# cartesian_product [[1;2];[3];[4];[5];[6]] |> sort =
+[[1;3;4;5;6];[2;3;4;5;6]];;

invariant: cartesian_product l = map_product id l.

  • since 1.2, but only
  • since 2.2 with labels
val map_product_l : ( 'a -> 'b list ) -> 'a list -> 'b list list

map_product_l f l maps each element of l to a list of objects of type 'b using f. We obtain [l1; l2; …; ln] where length l=n and li : 'b list. Then, it returns all the ways of picking exactly one element per li.

  • since 1.2, but only
  • since 2.2 with labels
val diagonal : 'a t -> ('a * 'a) t

diagonal l returns all pairs of distinct positions of the list l, that is the list of List.nth i l, List.nth j l if i < j.

val partition_map_either : + ( 'a -> ( 'b, 'c ) CCEither.t ) -> + 'a list -> + 'b list * 'c list

partition_map_either f l maps f on l and gather results in lists:

  • if f x = Left y, adds y to the first list.
  • if f x = Right z, adds z to the second list.
  • since 3.3
val partition_filter_map : + ( 'a -> [< `Left of 'b | `Right of 'c | `Drop ] ) -> + 'a list -> + 'b list * 'c list

partition_filter_map f l maps f on l and gather results in lists:

  • if f x = `Left y, adds y to the first list.
  • if f x = `Right z, adds z to the second list.
  • if f x = `Drop, ignores x.
  • since 3.3
val partition_map : + ( 'a -> [< `Left of 'b | `Right of 'c | `Drop ] ) -> + 'a list -> + 'b list * 'c list
  • deprecated

    use partition_filter_map instead

  • since 0.11
val group_by : + ?hash:( 'a -> int ) -> + ?eq:( 'a -> 'a -> bool ) -> + 'a t -> + 'a list t

group_by ?hash ?eq l groups equal elements, regardless of their order of appearance. precondition: for any x and y, if eq x y then hash x=hash y must hold.

  • since 2.3
val join : join_row:( 'a -> 'b -> 'c option ) -> 'a t -> 'b t -> 'c t

join ~join_row a b combines every element of a with every element of b using join_row. If join_row returns None, then the two elements do not combine. Assume that b allows for multiple iterations.

  • since 2.3
val join_by : + ?eq:( 'key -> 'key -> bool ) -> + ?hash:( 'key -> int ) -> + ( 'a -> 'key ) -> + ( 'b -> 'key ) -> + merge:( 'key -> 'a -> 'b -> 'c option ) -> + 'a t -> + 'b t -> + 'c t

join_by ?eq ?hash key1 key2 ~merge la lb is a binary operation that takes two sequences a and b, projects their elements resp. with key1 and key2, and combine values (x,y) from (a,b) with the same key using merge. If merge returns None, the combination of values is discarded. precondition: for any x and y, if eq x y then hash x=hash y must hold.

  • since 2.3
val join_all_by : + ?eq:( 'key -> 'key -> bool ) -> + ?hash:( 'key -> int ) -> + ( 'a -> 'key ) -> + ( 'b -> 'key ) -> + merge:( 'key -> 'a list -> 'b list -> 'c option ) -> + 'a t -> + 'b t -> + 'c t

join_all_by ?eq ?hash key1 key2 ~merge la lb is a binary operation that takes two sequences a and b, projects their elements resp. with key1 and key2, and, for each key k occurring in at least one of them:

  • compute the list l1 of elements of a that map to k
  • compute the list l2 of elements of b that map to k
  • call merge k l1 l2. If merge returns None, the combination of values is discarded, otherwise it returns Some c and c is inserted in the result.
  • since 2.3
val group_join_by : + ?eq:( 'a -> 'a -> bool ) -> + ?hash:( 'a -> int ) -> + ( 'b -> 'a ) -> + 'a t -> + 'b t -> + ('a * 'b list) t

group_join_by ?eq ?hash key la lb associates to every element x of the first sequence, all the elements y of the second sequence such that eq x (key y). Elements of the first sequences without corresponding values in the second one are mapped to [] precondition: for any x and y, if eq x y then hash x=hash y must hold.

  • since 2.3
val sublists_of_len : + ?last:( 'a list -> 'a list option ) -> + ?offset:int -> + int -> + 'a list -> + 'a list list

sublists_of_len ?last ?offset n l returns sub-lists of l that have length n. By default, these sub-lists are non overlapping: sublists_of_len 2 [1;2;3;4;5;6] returns [1;2]; [3;4]; [5;6].

Examples:

  • sublists_of_len 2 [1;2;3;4;5;6] = [[1;2]; [3;4]; [5;6]].
  • sublists_of_len 2 ~offset:3 [1;2;3;4;5;6] = [1;2];[4;5].
  • sublists_of_len 3 ~last:CCOption.return [1;2;3;4] = [1;2;3];[4].
  • sublists_of_len 2 [1;2;3;4;5] = [[1;2]; [3;4]].
  • parameter offset

    the number of elements skipped between two consecutive sub-lists. By default it is n. If offset < n, the sub-lists will overlap; if offset > n, some elements will not appear at all.

  • parameter last

    if provided and the last group of elements g is such that length g < n, last g is called. If last g = Some g', g' is appended; otherwise g is dropped. If last = CCOption.return, it will simply keep the last group. By default, last = fun _ -> None, i.e. the last group is dropped if shorter than n.

  • raises Invalid_argument

    if offset <= 0 or n <= 0. See CCList.sublists_of_len for more details.

  • since 1.0, but only
  • since 1.5 with labels
val chunks : int -> 'a list -> 'a list list

chunks n l returns consecutives chunks of size at most n from l. Each item of l will occur in exactly one chunk. Only the last chunk might be of length smaller than n. Invariant: (chunks n l |> List.flatten) = l.

  • since 3.2
val intersperse : 'a -> 'a list -> 'a list

intersperse x l inserts the element x between adjacent elements of the list l.

  • since 2.1, but only
  • since 2.2 with labels
val interleave : 'a list -> 'a list -> 'a list

interleave [x1…xn] [y1…ym] is [x1;y1;x2;y2;…] and finishes with the suffix of the longest list.

  • since 2.1, but only
  • since 2.2 with labels
val pure : 'a -> 'a t

pure x is return x.

val mguard : bool -> unit t

mguard c is pure () if c is true, [] otherwise. This is useful to define a list by comprehension, e.g.:

# let square_even xs =
+      let* x = xs in
+      let* () = mguard (x mod 2 = 0) in
+      return @@ x * x;;
+val square_even : int list -> int list = <fun>
+# square_even [1;2;4;3;5;2];;
+- : int list = [4; 16; 4]
  • since 3.1
val return : 'a -> 'a t

return x is x.

val take : int -> 'a t -> 'a t

take n l takes the n first elements of the list l, drop the rest.

val drop : int -> 'a t -> 'a t

drop n l drops the n first elements of the list l, keep the rest.

val hd_tl : 'a t -> 'a * 'a t

hd_tl (x :: l) returns hd, l.

  • raises Failure

    if the list is empty.

  • since 0.16
val take_drop : int -> 'a t -> 'a t * 'a t

take_drop n l returns l1, l2 such that l1 @ l2 = l and length l1 = min (length l) n.

val take_while : ( 'a -> bool ) -> 'a t -> 'a t

take_while f l returns the longest prefix of l for which f is true.

  • since 0.13
val drop_while : ( 'a -> bool ) -> 'a t -> 'a t

drop_while f l drops the longest prefix of l for which f is true.

  • since 0.13
val take_drop_while : ( 'a -> bool ) -> 'a t -> 'a t * 'a t

take_drop_while p l = take_while p l, drop_while p l.

  • since 1.2, but only
  • since 2.2 with labels
val last : int -> 'a t -> 'a t

last n l takes the last n elements of l (or less if l doesn't have that many elements).

val head_opt : 'a t -> 'a option

head_opt l returns Some x (the first element of the list l) or None if the list l is empty.

  • since 0.20
val tail_opt : 'a t -> 'a t option

tail_opt l returns Some l' (the given list l without its first element) or None if the list l is empty.

  • since 2.0
val last_opt : 'a t -> 'a option

last_opt l returns Some x (the last element of l) or None if the list l is empty.

  • since 0.20
val find_pred : ( 'a -> bool ) -> 'a t -> 'a option

find_pred p l finds the first element of l that satisfies p, or returns None if no element satisfies p.

  • since 0.11
val find_opt : ( 'a -> bool ) -> 'a t -> 'a option

find_opt p l is the safe version of find.

  • since 1.5, but only
  • since 2.2 with labels
val find_pred_exn : ( 'a -> bool ) -> 'a t -> 'a

find_pred_exn p l is the unsafe version of find_pred.

  • raises Not_found

    if no such element is found.

  • since 0.11
val find_map : ( 'a -> 'b option ) -> 'a t -> 'b option

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
val find_mapi : ( int -> 'a -> 'b option ) -> 'a t -> 'b option

find_mapi f l is like find_map, but also pass the index to the predicate function.

  • since 0.11
val find_idx : ( 'a -> bool ) -> 'a t -> (int * 'a) option

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 ) -> key:'a -> 'a t -> 'a t

remove ~eq ~key l removes every instance of key from l. Tail-recursive.

  • parameter eq

    equality function.

  • since 0.11
val filter_map : ( 'a -> 'b option ) -> 'a t -> 'b t

filter_map f l is the sublist of l containing only elements for which f returns Some e. Map and remove elements at the same time.

val keep_some : 'a option t -> 'a t

keep_some l retains only elements of the form Some x. Like filter_map CCFun.id.

  • since 1.3, but only
  • since 2.2 with labels
val keep_ok : ( 'a, _ ) Stdlib.result t -> 'a t

keep_ok l retains only elements of the form Ok x.

  • since 1.3, but only
  • since 2.2 with labels
val all_some : 'a option t -> 'a t option

all_some l returns Some l' if all elements of l are of the form Some x, or None otherwise.

  • since 1.3, but only
  • since 2.2 with labels
val all_ok : ( 'a, 'err ) Stdlib.result t -> ( 'a t, 'err ) Stdlib.result

all_ok l returns Ok l' if all elements of l are of the form Ok x, or Error e otherwise (with the first error met).

  • since 1.3, but only
  • since 2.2 with labels
val sorted_mem : cmp:( 'a -> 'a -> int ) -> 'a -> 'a list -> bool

sorted_mem ~cmp x l and mem x l give the same result for any sorted list l, but potentially more efficiently.

  • since 3.5
val sorted_merge : cmp:( 'a -> 'a -> int ) -> 'a list -> 'a list -> 'a list

sorted_merge ~cmp l1 l2 merges elements from both sorted list using the given comparison function cmp.

val sorted_diff : cmp:( 'a -> 'a -> int ) -> 'a list -> 'a list -> 'a list

sorted_diff ~cmp l1 l2 returns the elements in l1 that are not in l2. Both lists are assumed to be sorted with respect to cmp and duplicate elements in the input lists are treated individually; for example, sorted_diff ~cmp [1;1;1;2;2;3] [1;2;2] would be [1;1;3]. It is the left inverse of sorted_merge; that is, sorted_diff ~cmp (sorted_merge ~cmp l1 l2) l2 is always equal to l1 for sorted lists l1 and l2.

  • since 3.5
val sort_uniq : cmp:( 'a -> 'a -> int ) -> 'a list -> 'a list

sort_uniq ~cmp l sorts the list l using the given comparison function cmp and remove duplicate elements.

val sorted_merge_uniq : + cmp:( 'a -> 'a -> int ) -> + 'a list -> + 'a list -> + 'a list

sorted_merge_uniq ~cmp l1 l2 merges the sorted lists l1 and l2 and removes duplicates.

  • since 0.10
val sorted_diff_uniq : cmp:( 'a -> 'a -> int ) -> 'a list -> 'a list -> 'a list

sorted_diff_uniq ~cmp l1 l2 collects the elements in l1 that are not in l2 and then remove duplicates. Both lists are assumed to be sorted with respect to cmp and duplicate elements in the input lists are treated individually; for example, sorted_diff_uniq ~cmp [1;1;1;2;2] [1;2;2;2] would be [1]. sorted_diff_uniq ~cmp l1 l2 and uniq_succ ~eq (sorted_diff ~cmp l1 l2) always give the same result for sorted l1 and l2 and compatible cmp and eq.

  • since 3.5
val is_sorted : cmp:( 'a -> 'a -> int ) -> 'a list -> bool

is_sorted ~cmp l returns true iff l is sorted (according to given order).

  • parameter cmp

    the comparison function.

  • since 0.17
val sorted_insert : + cmp:( 'a -> 'a -> int ) -> + ?uniq:bool -> + 'a -> + 'a list -> + 'a list

sorted_insert ~cmp ?uniq x l inserts x into l such that, if l was sorted, then sorted_insert x l is sorted too.

  • parameter uniq

    if true and x is already in sorted position in l, then x is not duplicated. Default false (x will be inserted in any case).

  • since 0.17
val sorted_remove : + cmp:( 'a -> 'a -> int ) -> + ?all:bool -> + 'a -> + 'a list -> + 'a list

sorted_remove ~cmp x l removes x from a sorted list l such that the return value is sorted too. By default, it is the left inverse of sorted_insert; that is, sorted_remove ~cmp x (sorted_insert ~cmp x l) is equal to l for any sorted list l.

  • parameter all

    if true then all occurrences of x will be removed. Otherwise, only the first x will be removed (if any). Default false (only the first will be removed).

  • since 3.5
val uniq_succ : eq:( 'a -> 'a -> bool ) -> 'a list -> 'a list

uniq_succ ~eq l removes duplicate elements that occur one next to the other. Examples: uniq_succ ~eq:(=) [1;2;1] = [1;2;1]. uniq_succ ~eq:(=) [1;1;2] = [1;2].

  • since 0.10
val group_succ : eq:( 'a -> 'a -> bool ) -> 'a list -> 'a list list

group_succ ~eq l groups together consecutive elements that are equal according to eq.

  • since 0.11

Indices

val mapi : ( int -> 'a -> 'b ) -> 'a t -> 'b t

mapi f l is like map, but the function f is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

val iteri : ( int -> 'a -> unit ) -> 'a t -> unit

iteri f l is like iter, but the function f is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

val iteri2 : ( int -> 'a -> 'b -> unit ) -> 'a t -> 'b t -> unit

iteri2 f l1 l2 applies f to the two lists l1 and l2 simultaneously. The integer passed to f indicates the index of element.

  • raises Invalid_argument

    when lists do not have the same length.

  • since 2.0, but only
  • since 2.2 with labels
val foldi : ( 'b -> int -> 'a -> 'b ) -> 'b -> 'a t -> 'b

foldi f init l is like fold but it also passes in the index of each element, from 0 to length l - 1 as additional argument to the folded function f. Tail-recursive.

val foldi2 : ( 'c -> int -> 'a -> 'b -> 'c ) -> 'c -> 'a t -> 'b t -> 'c

foldi2 f init l1 l2 folds on the two lists l1 and l2, with index of each element passed to the function f. Computes f(… (f init i_0 l1_0 l2_0) …) i_n l1_n l2_n .

  • raises Invalid_argument

    when lists do not have the same length.

  • since 2.0, but only
  • since 2.2 with labels
val get_at_idx : int -> 'a t -> 'a option

get_at_idx i l returns Some i-th element of the given list l or None if the list l is too short. If the index is negative, it will get element starting from the end of the list l.

val nth_opt : 'a t -> int -> 'a option

nth_opt l n returns Some n-th element of l. Safe version of nth.

  • raises Invalid_argument

    if the int is negative.

  • since 1.5, but only
  • since 2.2 with labels
val get_at_idx_exn : int -> 'a t -> 'a

get_at_idx_exn i l gets the i-th element of l, or

  • raises Not_found

    if the index is invalid. The first element has index 0. If the index is negative, it will get element starting from the end of the list.

val set_at_idx : int -> 'a -> 'a t -> 'a t

set_at_idx i x l replaces the i-th element with x (removes the old one), or does nothing if index is too high. If the index is negative, it will set element starting from the end of the list.

val insert_at_idx : int -> 'a -> 'a t -> 'a t

insert_at_idx i x l inserts x at i-th position, between the two existing elements. If the index is too high, append at the end of the list. If the index is negative, it will insert element starting from the end of the list.

val remove_at_idx : int -> 'a t -> 'a t

remove_at_idx i l removes element at given index i. Does nothing if the index is too high. If the index is negative, it will remove element starting from the end of the list.

Set Operators

Those operations maintain the invariant that the list does not contain duplicates (if it already satisfies it).

val add_nodup : eq:( 'a -> 'a -> bool ) -> 'a -> 'a t -> 'a t

add_nodup ~eq x set adds x to set if it was not already present. Linear time.

  • since 0.11
val remove_one : eq:( 'a -> 'a -> bool ) -> 'a -> 'a t -> 'a t

remove_one ~eq x set removes one occurrence of x from set. Linear time.

  • since 0.11
val mem : ?eq:( 'a -> 'a -> bool ) -> 'a -> 'a t -> bool

mem ?eq x l is true iff x is equal to an element of l. A comparator function eq can be provided. Linear time.

val subset : eq:( 'a -> 'a -> bool ) -> 'a t -> 'a t -> bool

subset ~eq l1 l2 tests if all elements of the list l1 are contained in the list l2 by applying eq.

val uniq : eq:( 'a -> 'a -> bool ) -> 'a t -> 'a t

uniq ~eq l removes duplicates in l w.r.t the equality predicate eq. 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

union ~eq l1 l2 is the union of the lists l1 and l2 w.r.t. the equality predicate eq. Complexity is product of length of inputs.

val inter : eq:( 'a -> 'a -> bool ) -> 'a t -> 'a t -> 'a t

inter ~eq l1 l2 is the intersection of the lists l1 and l2 w.r.t. the equality predicate eq. Complexity is product of length of inputs.

Other Constructors

val range_by : step:int -> int -> int -> int t

range_by ~step i j iterates on integers from i to j included, where the difference between successive elements is step. Use a negative step for a decreasing list.

  • raises Invalid_argument

    if step=0.

  • since 0.18
val range : int -> int -> int t

range i j iterates on integers from i to j included. It works both for decreasing and increasing ranges.

val range' : int -> int -> int t

range' i j is like range but the second bound j is excluded. For instance range' 0 5 = [0;1;2;3;4].

val replicate : int -> 'a -> 'a t

replicate n x replicates the given element x n times.

val repeat : int -> 'a t -> 'a t

repeat n l concatenates the list l with itself n times.

Association Lists

module Assoc : sig ... end
val assoc : eq:( 'a -> 'a -> bool ) -> 'a -> ('a * 'b) t -> 'b

assoc ~eq k alist returns the value v associated with key k in alist. Like Assoc.get_exn.

  • since 2.0
val assoc_opt : eq:( 'a -> 'a -> bool ) -> 'a -> ('a * 'b) t -> 'b option

assoc_opt ~eq k alist returns Some v if the given key k is present into alist, or None if not present. Like Assoc.get.

  • since 1.5, but only
  • since 2.0 with labels
val assq_opt : 'a -> ('a * 'b) t -> 'b option

assq_opt k alist returns Some v if the given key k is present into alist. Like Assoc.assoc_opt but use physical equality instead of structural equality to compare keys. Safe version of assq.

  • since 1.5, but only
  • since 2.0 with labels
val mem_assoc : ?eq:( 'a -> 'a -> bool ) -> 'a -> ('a * _) t -> bool

mem_assoc ?eq k alist returns true iff k is a key in alist. Like Assoc.mem.

  • since 2.0
val remove_assoc : eq:( 'a -> 'a -> bool ) -> 'a -> ('a * 'b) t -> ('a * 'b) t

remove_assoc ~eq k alist returns the alist without the first pair with key k, if any. Like Assoc.remove.

  • since 2.0

References on Lists

module Ref : sig ... end
module type MONAD = sig ... end
module Traverse (M : MONAD) : sig ... end

Conversions

val random : 'a random_gen -> 'a t random_gen
val random_non_empty : 'a random_gen -> 'a t random_gen
val random_len : int -> 'a random_gen -> 'a t random_gen
val random_choose : 'a t -> 'a random_gen

random_choose l randomly chooses an element in the list l.

  • raises Not_found

    if the list is empty.

val random_sequence : 'a random_gen t -> 'a t random_gen
val to_string : + ?start:string -> + ?stop:string -> + ?sep:string -> + ( 'a -> string ) -> + 'a t -> + string

to_string ?start ?stop ?sep item_to_string l prints l to a string using sep as a separator between elements of l.

  • since 2.7
val to_iter : 'a t -> 'a iter

to_iter l returns a iter of the elements of the list l.

  • since 2.8
val to_seq : 'a t -> 'a Stdlib.Seq.t

to_seq l returns a Seq.t of the elements of the list l. Renamed from to_std_seq since 3.0.

  • since 3.0
val of_iter : 'a iter -> 'a t

of_iter iter builds a list from a given iter. In the result, elements appear in the same order as they did in the source iter.

  • since 2.8
val of_seq_rev : 'a Stdlib.Seq.t -> 'a t

of_seq_rev seq builds a list from a given Seq.t, in reverse order. Renamed from to_std_seq_rev since 3.0.

  • since 3.0
val of_seq : 'a Stdlib.Seq.t -> 'a t

of_seq seq builds a list from a given Seq.t. In the result, elements appear in the same order as they did in the source Seq.t. Renamed from of_std_seq since 3.0.

  • since 3.0
val to_gen : 'a t -> 'a gen

to_gen l returns a gen of the elements of the list l.

val of_gen : 'a gen -> 'a t

of_gen gen builds a list from a given gen. In the result, elements appear in the same order as they did in the source gen.

Infix Operators

It is convenient to open CCList.Infix to access the infix operators without cluttering the scope too much.

module Infix : sig ... end
include module type of Infix
val (>|=) : 'a t -> ( 'a -> 'b ) -> 'b t

l >|= f is the infix version of map with reversed arguments.

val (@) : 'a t -> 'a t -> 'a t

l1 @ l2 concatenates two lists l1 and l2. As append.

val (<*>) : ( 'a -> 'b ) t -> 'a t -> 'b t

funs <*> l is product (fun f x -> f x) funs l.

val (<$>) : ( 'a -> 'b ) -> 'a t -> 'b t

f <$> l is like map.

val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t

l >>= f is flat_map f l.

val (--) : int -> int -> int t

i -- j is the infix alias for range. Bounds included.

val (--^) : int -> int -> int t

i --^ j is the infix alias for range'. Second bound j excluded.

  • since 0.17
val let+ : 'a t -> ( 'a -> 'b ) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ( 'a -> 'b t ) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t
val and& : 'a list -> 'b list -> ('a * 'b) list

(and&) is combine_shortest. It allows to perform a synchronized product between two lists, stopping gently at the shortest. Usable both with let+ and let*.

# let f xs ys zs =
+    let+ x = xs
+    and& y = ys
+    and& z = zs in
+    x + y + z;;
+val f : int list -> int list -> int list -> int list = <fun>
+# f [1;2] [5;6;7] [10;10];;
+- : int list = [16; 18]
  • since 3.1

IO

val pp : + ?pp_start:unit printer -> + ?pp_stop:unit printer -> + ?pp_sep:unit printer -> + 'a printer -> + 'a t printer

pp ?pp_start ?pp_stop ?pp_sep ppf l prints the contents of a list.

\ No newline at end of file diff --git a/3.10/containers/CCList/module-type-MONAD/index.html b/3.10/containers/CCList/module-type-MONAD/index.html new file mode 100644 index 00000000..8e0bb8b0 --- /dev/null +++ b/3.10/containers/CCList/module-type-MONAD/index.html @@ -0,0 +1,2 @@ + +MONAD (containers.CCList.MONAD)

Module type CCList.MONAD

Monadic Operations

type 'a t
val return : 'a -> 'a t

return is the Monadic return.

val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t

(>>=) is the Monadic bind.

\ No newline at end of file diff --git a/3.10/containers/CCListLabels/.dummy b/3.10/containers/CCListLabels/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCListLabels/Assoc/index.html b/3.10/containers/CCListLabels/Assoc/index.html new file mode 100644 index 00000000..b487af58 --- /dev/null +++ b/3.10/containers/CCListLabels/Assoc/index.html @@ -0,0 +1,7 @@ + +Assoc (containers.CCListLabels.Assoc)

Module CCListLabels.Assoc

type ('a, 'b) t = ('a * 'b) list
val get : eq:( 'a -> 'a -> bool ) -> 'a -> ( 'a, 'b ) t -> 'b option

get ~eq k alist returns Some v if the given key k is present into alist, or None if not present.

val get_exn : eq:( 'a -> 'a -> bool ) -> 'a -> ( 'a, 'b ) t -> 'b

get_exn ~eq k alist returns v if the element k is present into alist. Like get, but unsafe.

  • raises Not_found

    if the element is not present.

val set : eq:( 'a -> 'a -> bool ) -> 'a -> 'b -> ( 'a, 'b ) t -> ( 'a, 'b ) t

set ~eq k v alist adds the binding k, v into the list alist (erase it if already present).

val mem : ?eq:( 'a -> 'a -> bool ) -> 'a -> ( 'a, _ ) t -> bool

mem ?eq k alist returns true iff k is a key in alist.

  • since 0.16
val update : + eq:( 'a -> 'a -> bool ) -> + f:( 'b option -> 'b option ) -> + 'a -> + ( 'a, 'b ) t -> + ( 'a, 'b ) t

update ~eq ~f k alist updates alist on the key k, by calling f (get alist k) and removing k if it returns None, mapping k to v' if it returns Some v'.

  • since 0.16
val remove : eq:( 'a -> 'a -> bool ) -> 'a -> ( 'a, 'b ) t -> ( 'a, 'b ) t

remove ~eq k alist returns the alist without the first pair with key k, if any.

  • since 0.17
val keys : ( 'a, 'b ) t -> 'a list

keys alist returns a list of all keys of alist.

  • since 3.8
val values : ( 'a, 'b ) t -> 'b list

values alist returns a list of all values of alist.

  • since 3.8
val map_values : ( 'b -> 'c ) -> ( 'a, 'b ) t -> ( 'a, 'c ) t

map_values f alist applies function f to all values of alist.

  • since 3.8
\ No newline at end of file diff --git a/3.10/containers/CCListLabels/Infix/index.html b/3.10/containers/CCListLabels/Infix/index.html new file mode 100644 index 00000000..db65812e --- /dev/null +++ b/3.10/containers/CCListLabels/Infix/index.html @@ -0,0 +1,9 @@ + +Infix (containers.CCListLabels.Infix)

Module CCListLabels.Infix

val (>|=) : 'a CCList.t -> ( 'a -> 'b ) -> 'b CCList.t

l >|= f is the infix version of map with reversed arguments.

val (@) : 'a CCList.t -> 'a CCList.t -> 'a CCList.t

l1 @ l2 concatenates two lists l1 and l2. As append.

val (<*>) : ( 'a -> 'b ) CCList.t -> 'a CCList.t -> 'b CCList.t

funs <*> l is product (fun f x -> f x) funs l.

val (<$>) : ( 'a -> 'b ) -> 'a CCList.t -> 'b CCList.t

f <$> l is like map.

val (>>=) : 'a CCList.t -> ( 'a -> 'b CCList.t ) -> 'b CCList.t

l >>= f is flat_map f l.

val (--) : int -> int -> int CCList.t

i -- j is the infix alias for range. Bounds included.

val (--^) : int -> int -> int CCList.t

i --^ j is the infix alias for range'. Second bound j excluded.

  • since 0.17
val let+ : 'a CCList.t -> ( 'a -> 'b ) -> 'b CCList.t
val and+ : 'a CCList.t -> 'b CCList.t -> ('a * 'b) CCList.t
val let* : 'a CCList.t -> ( 'a -> 'b CCList.t ) -> 'b CCList.t
val and* : 'a CCList.t -> 'b CCList.t -> ('a * 'b) CCList.t
val and& : 'a list -> 'b list -> ('a * 'b) list

(and&) is combine_shortest. It allows to perform a synchronized product between two lists, stopping gently at the shortest. Usable both with let+ and let*.

# let f xs ys zs =
+    let+ x = xs
+    and& y = ys
+    and& z = zs in
+    x + y + z;;
+val f : int list -> int list -> int list -> int list = <fun>
+# f [1;2] [5;6;7] [10;10];;
+- : int list = [16; 18]
  • since 3.1
\ No newline at end of file diff --git a/3.10/containers/CCListLabels/Ref/index.html b/3.10/containers/CCListLabels/Ref/index.html new file mode 100644 index 00000000..05163d97 --- /dev/null +++ b/3.10/containers/CCListLabels/Ref/index.html @@ -0,0 +1,2 @@ + +Ref (containers.CCListLabels.Ref)

Module CCListLabels.Ref

type 'a t = 'a list Stdlib.ref
val push : 'a t -> 'a -> unit

push rlist e adds an element e at the head of rlist.

val pop : 'a t -> 'a option

pop rlist removes and returns Some e (the first element of rlist) or None if the rlist is empty

val pop_exn : 'a t -> 'a

pop_exn rlist removes and returns the first element of rlist. Unsafe version of pop.

  • raises Failure

    if the list is empty.

val create : unit -> 'a t

create () creates a new empty reference list.

val clear : _ t -> unit

clear rlist removes all elements of rlist.

val lift : ( 'a list -> 'b ) -> 'a t -> 'b

lift f rlist applies a list function f to the content of rlist.

val push_list : 'a t -> 'a list -> unit

push_list rlist l adds elements of the list l at the beginning of the list ref rlist. Elements at the end of the list l will be at the beginning of the list ref rlist.

\ No newline at end of file diff --git a/3.10/containers/CCListLabels/Traverse/argument-1-M/index.html b/3.10/containers/CCListLabels/Traverse/argument-1-M/index.html new file mode 100644 index 00000000..8116d303 --- /dev/null +++ b/3.10/containers/CCListLabels/Traverse/argument-1-M/index.html @@ -0,0 +1,2 @@ + +M (containers.CCListLabels.Traverse.1-M)

Parameter Traverse.1-M

type 'a t
val return : 'a -> 'a t

return is the Monadic return.

val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t

(>>=) is the Monadic bind.

\ No newline at end of file diff --git a/3.10/containers/CCListLabels/Traverse/index.html b/3.10/containers/CCListLabels/Traverse/index.html new file mode 100644 index 00000000..e388c3d7 --- /dev/null +++ b/3.10/containers/CCListLabels/Traverse/index.html @@ -0,0 +1,2 @@ + +Traverse (containers.CCListLabels.Traverse)

Module CCListLabels.Traverse

Parameters

module M : MONAD

Signature

val sequence_m : 'a M.t t -> 'a t M.t
val fold_m : f:( 'b -> 'a -> 'b M.t ) -> init:'b -> 'a t -> 'b M.t
val map_m : f:( 'a -> 'b M.t ) -> 'a t -> 'b t M.t
val map_m_par : f:( 'a -> 'b M.t ) -> 'a t -> 'b t M.t

map_m_par ~f (x :: l) is like map_m but f x and f l are evaluated "in parallel" before combining their result (for instance in Lwt).

\ No newline at end of file diff --git a/3.10/containers/CCListLabels/index.html b/3.10/containers/CCListLabels/index.html new file mode 100644 index 00000000..df933579 --- /dev/null +++ b/3.10/containers/CCListLabels/index.html @@ -0,0 +1,136 @@ + +CCListLabels (containers.CCListLabels)

Module CCListLabels

Complements to ListLabels

type 'a iter = ( 'a -> unit ) -> unit

Fast internal iterator.

  • since 2.8
type 'a gen = unit -> 'a option
type 'a printer = Stdlib.Format.formatter -> 'a -> unit
type 'a random_gen = Stdlib.Random.State.t -> 'a
include module type of Stdlib.ListLabels
val length : 'a list -> int
val hd : 'a list -> 'a
val tl : 'a list -> 'a list
val nth : 'a list -> int -> 'a
val rev : 'a list -> 'a list
val rev_append : 'a list -> 'a list -> 'a list
val concat : 'a list list -> 'a list
val iter : f:( 'a -> unit ) -> 'a list -> unit
val rev_map : f:( 'a -> 'b ) -> 'a list -> 'b list
val concat_map : f:( 'a -> 'b list ) -> 'a list -> 'b list
val fold_left_map : + f:( 'a -> 'b -> 'a * 'c ) -> + init:'a -> + 'b list -> + 'a * 'c list
val fold_left : f:( 'a -> 'b -> 'a ) -> init:'a -> 'b list -> 'a
val iter2 : f:( 'a -> 'b -> unit ) -> 'a list -> 'b list -> unit
val map2 : f:( 'a -> 'b -> 'c ) -> 'a list -> 'b list -> 'c list
val rev_map2 : f:( 'a -> 'b -> 'c ) -> 'a list -> 'b list -> 'c list
val fold_left2 : + f:( 'a -> 'b -> 'c -> 'a ) -> + init:'a -> + 'b list -> + 'c list -> + 'a
val fold_right2 : + f:( 'a -> 'b -> 'c -> 'c ) -> + 'a list -> + 'b list -> + init:'c -> + 'c
val for_all : f:( 'a -> bool ) -> 'a list -> bool
val exists : f:( 'a -> bool ) -> 'a list -> bool
val for_all2 : f:( 'a -> 'b -> bool ) -> 'a list -> 'b list -> bool
val exists2 : f:( 'a -> 'b -> bool ) -> 'a list -> 'b list -> bool
val memq : 'a -> set:'a list -> bool
val find : f:( 'a -> bool ) -> 'a list -> 'a
val find_all : f:( 'a -> bool ) -> 'a list -> 'a list
val filteri : f:( int -> 'a -> bool ) -> 'a list -> 'a list
val partition : f:( 'a -> bool ) -> 'a list -> 'a list * 'a list
val assq : 'a -> ('a * 'b) list -> 'b
val mem_assq : 'a -> map:('a * 'b) list -> bool
val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list
val sort : cmp:( 'a -> 'a -> int ) -> 'a list -> 'a list
val stable_sort : cmp:( 'a -> 'a -> int ) -> 'a list -> 'a list
val fast_sort : cmp:( 'a -> 'a -> int ) -> 'a list -> 'a list
val merge : cmp:( 'a -> 'a -> int ) -> 'a list -> 'a list -> 'a list
type 'a t = 'a list
val empty : 'a t

empty is [].

val is_empty : _ t -> bool

is_empty l returns true iff l = [].

  • since 0.11
val map : f:( 'a -> 'b ) -> 'a t -> 'b t

map ~f [a0; a1; …; an] applies function f in turn to [a0; a1; …; an]. Safe version of List.map.

val cons : 'a -> 'a t -> 'a t

cons x l is x::l.

  • since 0.12
val append : 'a t -> 'a t -> 'a t

append l1 l2 returns the list that is the concatenation of l1 and l2. Safe version of List.append.

val cons' : 'a t -> 'a -> 'a t

cons' l x is the same as x :: l. This is convenient for fold functions such as List.fold_left or Array.fold_left.

  • since 3.3
val cons_maybe : 'a option -> 'a t -> 'a t

cons_maybe (Some x) l is x :: l. cons_maybe None l is l.

  • since 0.13
val filter : f:( 'a -> bool ) -> 'a t -> 'a t

filter ~f l returns all the elements of the list l that satisfy the predicate f. The order of the elements in the input list l is preserved. Safe version of List.filter.

val fold_right : f:( 'a -> 'b -> 'b ) -> 'a t -> init:'b -> 'b

fold_right ~f [a1; …; an] ~init is f a1 (f a2 ( … (f an init) … )). Safe version of List.fold_right.

val fold_while : + f:( 'a -> 'b -> 'a * [ `Stop | `Continue ] ) -> + init:'a -> + 'b t -> + 'a

fold_while ~f ~init l folds until a stop condition via ('a, `Stop) is indicated by the accumulator.

  • since 0.8
val fold_map : + f:( 'acc -> 'a -> 'acc * 'b ) -> + init:'acc -> + 'a list -> + 'acc * 'b list

fold_map ~f ~init l is a fold_left-like function, but it also maps the list to another list.

  • since 0.14
val fold_map_i : + f:( 'acc -> int -> 'a -> 'acc * 'b ) -> + init:'acc -> + 'a list -> + 'acc * 'b list

fold_map_i ~f ~init l is a foldi-like function, but it also maps the list to another list.

  • since 2.8
val fold_on_map : + f:( 'a -> 'b ) -> + reduce:( 'acc -> 'b -> 'acc ) -> + init:'acc -> + 'a list -> + 'acc

fold_on_map ~f ~reduce ~init l combines map ~f and fold_left ~reduce ~init in one operation.

  • since 2.8
val scan_left : f:( 'acc -> 'a -> 'acc ) -> init:'acc -> 'a list -> 'acc list

scan_left ~f ~init l returns the list [init; f init x0; f (f init x0) x1; …] where x0, x1, etc. are the elements of l.

  • since 1.2, but only
  • since 2.2 with labels
val reduce : f:( 'a -> 'a -> 'a ) -> 'a list -> 'a option

reduce f (hd::tl) returns Some (fold_left f hd tl). If l is empty, then None is returned.

  • since 3.2
val reduce_exn : f:( 'a -> 'a -> 'a ) -> 'a list -> 'a

reduce_exn is the unsafe version of reduce.

  • raises Invalid_argument

    if the given list is empty.

  • since 3.2
val fold_map2 : + f:( 'acc -> 'a -> 'b -> 'acc * 'c ) -> + init:'acc -> + 'a list -> + 'b list -> + 'acc * 'c list

fold_map2 ~f ~init l1 l2 is to fold_map what List.map2 is to List.map.

  • raises Invalid_argument

    if the lists do not have the same length.

  • since 0.16
val fold_filter_map : + f:( 'acc -> 'a -> 'acc * 'b option ) -> + init:'acc -> + 'a list -> + 'acc * 'b list

fold_filter_map ~f ~init l is a fold_left-like function, but also generates a list of output in a way similar to filter_map.

  • since 0.17
val fold_filter_map_i : + f:( 'acc -> int -> 'a -> 'acc * 'b option ) -> + init:'acc -> + 'a list -> + 'acc * 'b list

fold_filter_map_i ~f ~init l is a foldi-like function, but also generates a list of output in a way similar to filter_map.

  • since 2.8
val fold_flat_map : + f:( 'acc -> 'a -> 'acc * 'b list ) -> + init:'acc -> + 'a list -> + 'acc * 'b list

fold_flat_map ~f ~init 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 fold_flat_map_i : + f:( 'acc -> int -> 'a -> 'acc * 'b list ) -> + init:'acc -> + 'a list -> + 'acc * 'b list

fold_flat_map_i ~f ~init l is a fold_left-like function, but it also maps the list to a list of lists that is then flatten'd.

  • since 2.8
val count : f:( 'a -> bool ) -> 'a list -> int

count ~f l counts how many elements of l satisfy predicate f.

  • since 1.5, but only
  • since 2.2 with labels
val count_true_false : f:( 'a -> bool ) -> 'a list -> int * int

count_true_false ~f l returns a pair (int1,int2) where int1 is the number of elements in l that satisfy the predicate f, and int2 the number of elements that do not satisfy f.

  • since 2.4
val init : int -> f:( int -> 'a ) -> 'a t

init len ~f is f 0; f 1; …; f (len-1).

  • raises Invalid_argument

    if len < 0.

  • since 0.6
val combine : 'a list -> 'b list -> ('a * 'b) list

combine [a1; …; an] [b1; …; bn] is [(a1,b1); …; (an,bn)]. Transform two lists into a list of pairs. Like List.combine but tail-recursive.

  • raises Invalid_argument

    if the lists have distinct lengths.

  • since 1.2, but only
  • since 2.2 with labels
val combine_gen : 'a list -> 'b list -> ('a * 'b) gen

combine_gen l1 l2 transforms two lists into a gen of pairs. Lazy version of combine. Unlike combine, it does not fail if the lists have different lengths; instead, the output has as many pairs as the smallest input list.

  • since 1.2, but only
  • since 2.2 with labels
val combine_shortest : 'a list -> 'b list -> ('a * 'b) list

combine_shortest [a1; …; am] [b1; …; bn] is [(a1,b1); …; (am,bm)] if m <= n. Like combine but stops at the shortest list rather than raising.

  • since 3.1
val split : ('a * 'b) t -> 'a t * 'b t

split [(a1,b1); …; (an,bn)] is ([a1; …; an], [b1; …; bn]). Transform a list of pairs into a pair of lists. A tail-recursive version of List.split.

  • since 1.2, but only
  • since 2.2 with labels
val compare : ( 'a -> 'a -> int ) -> 'a t -> 'a t -> int

compare cmp l1 l2 compares the two lists l1 and l2 using the given comparison function cmp.

val compare_lengths : 'a t -> 'b t -> int

compare_lengths l1 l2 compare the lengths of the two lists l1 and l2. Equivalent to compare (length l1) (length l2) but more efficient.

  • since 1.5, but only
  • since 2.2 with labels
val compare_length_with : 'a t -> int -> int

compare_length_with l x compares the length of the list l to an integer x. Equivalent to compare (length l) x but more efficient.

  • since 1.5, but only
  • since 2.2 with labels
val equal : ( 'a -> 'a -> bool ) -> 'a t -> 'a t -> bool

equal p l1 l2 returns true if l1 and l2 are equal.

val flat_map : f:( 'a -> 'b t ) -> 'a t -> 'b t

flat_map ~f l maps and flattens at the same time (safe). Evaluation order is not guaranteed.

val flat_map_i : f:( int -> 'a -> 'b t ) -> 'a t -> 'b t

flat_map_i ~f l maps with index and flattens at the same time (safe). Evaluation order is not guaranteed.

  • since 2.8
val flatten : 'a t t -> 'a t

flatten [l1]; [l2]; … concatenates a list of lists. Safe version of List.flatten.

val product : f:( 'a -> 'b -> 'c ) -> 'a t -> 'b t -> 'c t

product ~f l1 l2 computes the cartesian product of the two lists, with the given combinator f.

val fold_product : f:( 'c -> 'a -> 'b -> 'c ) -> init:'c -> 'a t -> 'b t -> 'c

fold_product ~f ~init l1 l2 applies the function f with the accumulator init on all the pair of elements of l1 and l2. Fold on the cartesian product.

val cartesian_product : 'a t t -> 'a t t

cartesian_product [[l1];[l2]; …; [ln]] produces the cartesian product of this list of lists, by returning all the ways of picking one element per sublist. NOTE the order of the returned list is unspecified. For example:

# cartesian_product [[1;2];[3];[4;5;6]] |> sort =
+[[1;3;4];[1;3;5];[1;3;6];[2;3;4];[2;3;5];[2;3;6]];;
+# cartesian_product [[1;2];[];[4;5;6]] = [];;
+# cartesian_product [[1;2];[3];[4];[5];[6]] |> sort =
+[[1;3;4;5;6];[2;3;4;5;6]];;

invariant: cartesian_product l = map_product id l.

  • since 1.2, but only
  • since 2.2 with labels
val map_product_l : f:( 'a -> 'b list ) -> 'a list -> 'b list list

map_product_l ~f l maps each element of l to a list of objects of type 'b using f. We obtain [l1; l2; …; ln] where length l=n and li : 'b list. Then, it returns all the ways of picking exactly one element per li.

  • since 1.2, but only
  • since 2.2 with labels
val diagonal : 'a t -> ('a * 'a) t

diagonal l returns all pairs of distinct positions of the list l, that is the list of List.nth i l, List.nth j l if i < j.

val partition_map_either : + f:( 'a -> ( 'b, 'c ) CCEither.t ) -> + 'a list -> + 'b list * 'c list

partition_map_either ~f l maps f on l and gather results in lists:

  • if f x = Left y, adds y to the first list.
  • if f x = Right z, adds z to the second list.
  • since 3.3
val partition_filter_map : + f:( 'a -> [< `Left of 'b | `Right of 'c | `Drop ] ) -> + 'a list -> + 'b list * 'c list

partition_filter_map ~f l maps f on l and gather results in lists:

  • if f x = `Left y, adds y to the first list.
  • if f x = `Right z, adds z to the second list.
  • if f x = `Drop, ignores x.
  • since 0.11
val partition_map : + f:( 'a -> [< `Left of 'b | `Right of 'c | `Drop ] ) -> + 'a list -> + 'b list * 'c list
  • deprecated

    use partition_filter_map instead

val group_by : + ?hash:( 'a -> int ) -> + ?eq:( 'a -> 'a -> bool ) -> + 'a t -> + 'a list t

group_by ?hash ?eq l groups equal elements, regardless of their order of appearance. precondition: for any x and y, if eq x y then hash x = hash y must hold.

  • since 2.3
val join : join_row:( 'a -> 'b -> 'c option ) -> 'a t -> 'b t -> 'c t

join ~join_row a b combines every element of a with every element of b using join_row. If join_row returns None, then the two elements do not combine. Assume that b allows for multiple iterations.

  • since 2.3
val join_by : + ?eq:( 'key -> 'key -> bool ) -> + ?hash:( 'key -> int ) -> + ( 'a -> 'key ) -> + ( 'b -> 'key ) -> + merge:( 'key -> 'a -> 'b -> 'c option ) -> + 'a t -> + 'b t -> + 'c t

join_by ?eq ?hash key1 key2 ~merge la lb is a binary operation that takes two sequences a and b, projects their elements resp. with key1 and key2, and combine values (x,y) from (a,b) with the same key using merge. If merge returns None, the combination of values is discarded. precondition: for any x and y, if eq x y then hash x = hash y must hold.

  • since 2.3
val join_all_by : + ?eq:( 'key -> 'key -> bool ) -> + ?hash:( 'key -> int ) -> + ( 'a -> 'key ) -> + ( 'b -> 'key ) -> + merge:( 'key -> 'a list -> 'b list -> 'c option ) -> + 'a t -> + 'b t -> + 'c t

join_all_by ?eq ?hash key1 key2 ~merge la lb is a binary operation that takes two sequences a and b, projects their elements resp. with key1 and key2, and, for each key k occurring in at least one of them:

  • compute the list l1 of elements of a that map to k
  • compute the list l2 of elements of b that map to k
  • call merge k l1 l2. If merge returns None, the combination of values is discarded, otherwise it returns Some c and c is inserted in the result.
  • since 2.3
val group_join_by : + ?eq:( 'a -> 'a -> bool ) -> + ?hash:( 'a -> int ) -> + ( 'b -> 'a ) -> + 'a t -> + 'b t -> + ('a * 'b list) t

group_join_by ?eq ?hash key la lb associates to every element x of the first sequence, all the elements y of the second sequence such that eq x (key y). Elements of the first sequences without corresponding values in the second one are mapped to [] precondition: for any x and y, if eq x y then hash x = hash y must hold.

  • since 2.3
val sublists_of_len : + ?last:( 'a list -> 'a list option ) -> + ?offset:int -> + len:int -> + 'a list -> + 'a list list

sublists_of_len ?last ?offset n l returns sub-lists of l that have length n. By default, these sub-lists are non overlapping: sublists_of_len 2 [1;2;3;4;5;6] returns [1;2]; [3;4]; [5;6].

Examples:

  • sublists_of_len 2 [1;2;3;4;5;6] = [[1;2]; [3;4]; [5;6]].
  • sublists_of_len 2 ~offset:3 [1;2;3;4;5;6] = [1;2];[4;5].
  • sublists_of_len 3 ~last:CCOption.return [1;2;3;4] = [1;2;3];[4].
  • sublists_of_len 2 [1;2;3;4;5] = [[1;2]; [3;4]].
  • parameter offset

    the number of elements skipped between two consecutive sub-lists. By default it is n. If offset < n, the sub-lists will overlap; if offset > n, some elements will not appear at all.

  • parameter last

    if provided and the last group of elements g is such that length g < n, last g is called. If last g = Some g', g' is appended; otherwise g is dropped. If last = CCOption.return, it will simply keep the last group. By default, last = fun _ -> None, i.e. the last group is dropped if shorter than n.

  • raises Invalid_argument

    if offset <= 0 or n <= 0. See CCList.sublists_of_len for more details.

  • since 1.0, but only
  • since 1.5 with labels
val chunks : int -> 'a list -> 'a list list

chunks n l returns consecutives chunks of size at most n from l. Each item of l will occur in exactly one chunk. Only the last chunk might be of length smaller than n. Invariant: (chunks n l |> List.flatten) = l.

  • since 3.2
val intersperse : x:'a -> 'a list -> 'a list

intersperse ~x l inserts the element x between adjacent elements of the list l.

  • since 2.1, but only
  • since 2.2 with labels
val interleave : 'a list -> 'a list -> 'a list

interleave [x1…xn] [y1…ym] is [x1,y1,x2,y2,…] and finishes with the suffix of the longest list.

  • since 2.1, but only
  • since 2.2 with labels
val pure : 'a -> 'a t

pure x is return x.

val mguard : bool -> unit t

mguard c is pure () if c is true, [] otherwise. This is useful to define a list by comprehension, e.g.:

# let square_even xs =
+      let* x = xs in
+      let* () = mguard (x mod 2 = 0) in
+      return @@ x * x;;
+val square_even : int list -> int list = <fun>
+# square_even [1;2;4;3;5;2];;
+- : int list = [4; 16; 4]
  • since 3.1
val return : 'a -> 'a t

return x is x.

val take : int -> 'a t -> 'a t

take n l takes the n first elements of the list l, drop the rest.

val drop : int -> 'a t -> 'a t

drop n l drops the n first elements of the list l, keep the rest.

val hd_tl : 'a t -> 'a * 'a t

hd_tl (x :: l) returns hd, l.

  • raises Failure

    if the list is empty.

  • since 0.16
val take_drop : int -> 'a t -> 'a t * 'a t

take_drop n l returns l1, l2 such that l1 @ l2 = l and length l1 = min (length l) n.

val take_while : f:( 'a -> bool ) -> 'a t -> 'a t

take_while ~f l returns the longest prefix of l for which f is true.

  • since 0.13
val drop_while : f:( 'a -> bool ) -> 'a t -> 'a t

drop_while ~f l drops the longest prefix of l for which f is true.

  • since 0.13
val take_drop_while : f:( 'a -> bool ) -> 'a t -> 'a t * 'a t

take_drop_while ~f l = take_while ~f l, drop_while ~f l.

  • since 1.2, but only
  • since 2.2 with labels
val last : int -> 'a t -> 'a t

last n l takes the last n elements of l (or less if l doesn't have that many elements).

val head_opt : 'a t -> 'a option

head_opt l returns Some x (the first element of the list l) or None if the list l is empty.

  • since 0.20
val tail_opt : 'a t -> 'a t option

tail_opt l returns Some l' (the given list l without its first element) or None if the list l is empty.

  • since 2.0
val last_opt : 'a t -> 'a option

last_opt l returns Some x (the last element of l) or None if the list l is empty.

  • since 0.20
val find_pred : f:( 'a -> bool ) -> 'a t -> 'a option

find_pred ~f l finds the first element of l that satisfies f, or returns None if no element satisfies f.

  • since 0.11
val find_opt : f:( 'a -> bool ) -> 'a t -> 'a option

find_opt ~f l is the safe version of find.

  • since 1.5, but only
  • since 2.2 with labels
val find_pred_exn : f:( 'a -> bool ) -> 'a t -> 'a

find_pred_exn ~f l is the unsafe version of find_pred.

  • raises Not_found

    if no such element is found.

  • since 0.11
val find_map : f:( 'a -> 'b option ) -> 'a t -> 'b option

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
val find_mapi : f:( int -> 'a -> 'b option ) -> 'a t -> 'b option

find_mapi ~f l is like find_map, but also pass the index to the predicate function.

  • since 0.11
val find_idx : f:( 'a -> bool ) -> 'a t -> (int * 'a) option

find_idx ~f x returns Some (i,x) where x is the i-th element of l, and f x holds. Otherwise returns None.

val remove : eq:( 'a -> 'a -> bool ) -> key:'a -> 'a t -> 'a t

remove ~eq ~key l removes every instance of key from l. Tail-recursive.

  • parameter eq

    equality function.

  • since 0.11
val filter_map : f:( 'a -> 'b option ) -> 'a t -> 'b t

filter_map ~f l is the sublist of l containing only elements for which f returns Some e. Map and remove elements at the same time.

val keep_some : 'a option t -> 'a t

keep_some l retains only elements of the form Some x. Like filter_map CCFun.id.

  • since 1.3, but only
  • since 2.2 with labels
val keep_ok : ( 'a, _ ) Stdlib.result t -> 'a t

keep_ok l retains only elements of the form Ok x.

  • since 1.3, but only
  • since 2.2 with labels
val all_some : 'a option t -> 'a t option

all_some l returns Some l' if all elements of l are of the form Some x, or None otherwise.

  • since 1.3, but only
  • since 2.2 with labels
val all_ok : ( 'a, 'err ) Stdlib.result t -> ( 'a t, 'err ) Stdlib.result

all_ok l returns Ok l' if all elements of l are of the form Ok x, or Error e otherwise (with the first error met).

  • since 1.3, but only
  • since 2.2 with labels
val sorted_mem : cmp:( 'a -> 'a -> int ) -> 'a -> 'a list -> bool

sorted_mem ~cmp x l and mem x l give the same result for any sorted list l, but potentially more efficiently.

  • since 3.5
val sorted_merge : cmp:( 'a -> 'a -> int ) -> 'a list -> 'a list -> 'a list

sorted_merge ~cmp l1 l2 merges elements from both sorted list using the given comparison function cmp.

val sorted_diff : cmp:( 'a -> 'a -> int ) -> 'a list -> 'a list -> 'a list

sorted_diff ~cmp l1 l2 returns the elements in l1 that are not in l2. Both lists are assumed to be sorted with respect to cmp and duplicate elements in the input lists are treated individually; for example, sorted_diff ~cmp [1;1;1;2;2;3] [1;2;2] would be [1;1;3]. It is the left inverse of sorted_merge; that is, sorted_diff ~cmp (sorted_merge ~cmp l1 l2) l2 is always equal to l1 for sorted lists l1 and l2.

  • since 3.5
val sort_uniq : cmp:( 'a -> 'a -> int ) -> 'a list -> 'a list

sort_uniq ~cmp l sorts the list l using the given comparison function cmp and remove duplicate elements.

val sorted_merge_uniq : + cmp:( 'a -> 'a -> int ) -> + 'a list -> + 'a list -> + 'a list

sorted_merge_uniq ~cmp l1 l2 merges the sorted lists l1 and l2 and removes duplicates.

  • since 0.10
val sorted_diff_uniq : cmp:( 'a -> 'a -> int ) -> 'a list -> 'a list -> 'a list

sorted_diff_uniq ~cmp l1 l2 collects the elements in l1 that are not in l2 and then remove duplicates. Both lists are assumed to be sorted with respect to cmp and duplicate elements in the input lists are treated individually; for example, sorted_diff_uniq ~cmp [1;1;1;2;2] [1;2;2;2] would be [1]. sorted_diff_uniq ~cmp l1 l2 and uniq_succ ~eq (sorted_diff ~cmp l1 l2) always give the same result for sorted l1 and l2 and compatible cmp and eq.

  • since 3.5
val is_sorted : cmp:( 'a -> 'a -> int ) -> 'a list -> bool

is_sorted ~cmp l returns true iff l is sorted (according to given order).

  • parameter cmp

    the comparison function.

  • since 0.17
val sorted_insert : + cmp:( 'a -> 'a -> int ) -> + ?uniq:bool -> + 'a -> + 'a list -> + 'a list

sorted_insert ~cmp ?uniq x l inserts x into l such that, if l was sorted, then sorted_insert x l is sorted too.

  • parameter uniq

    if true and x is already in sorted position in l, then x is not duplicated. Default false (x will be inserted in any case).

  • since 0.17
val sorted_remove : + cmp:( 'a -> 'a -> int ) -> + ?all:bool -> + 'a -> + 'a list -> + 'a list

sorted_remove ~cmp x l removes x from a sorted list l such that the return value is sorted too. By default, it is the left inverse of sorted_insert; that is, sorted_remove ~cmp x (sorted_insert ~cmp x l) is equal to l for any sorted list l.

  • parameter all

    if true then all occurrences of x will be removed. Otherwise, only the first x will be removed (if any). Default false (only the first will be removed).

  • since 3.5
val uniq_succ : eq:( 'a -> 'a -> bool ) -> 'a list -> 'a list

uniq_succ ~eq l removes duplicate elements that occur one next to the other. Examples: uniq_succ [1;2;1] = [1;2;1]. uniq_succ [1;1;2] = [1;2].

  • since 0.10
val group_succ : eq:( 'a -> 'a -> bool ) -> 'a list -> 'a list list

group_succ ~eq l groups together consecutive elements that are equal according to eq.

  • since 0.11

Indices

val mapi : f:( int -> 'a -> 'b ) -> 'a t -> 'b t

mapi ~f l is like map, but the function f is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

val iteri : f:( int -> 'a -> unit ) -> 'a t -> unit

iteri ~f l is like iter, but the function f is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

val iteri2 : f:( int -> 'a -> 'b -> unit ) -> 'a t -> 'b t -> unit

iteri2 ~f l1 l2 applies f to the two lists l1 and l2 simultaneously. The integer passed to f indicates the index of element.

  • raises Invalid_argument

    when lists do not have the same length.

  • since 2.0, but only
  • since 2.2 with labels
val foldi : f:( 'b -> int -> 'a -> 'b ) -> init:'b -> 'a t -> 'b

foldi ~f ~init l is like fold but it also passes in the index of each element, from 0 to length l - 1 as additional argument to the folded function f. Tail-recursive.

val foldi2 : f:( 'c -> int -> 'a -> 'b -> 'c ) -> init:'c -> 'a t -> 'b t -> 'c

foldi2 ~f ~init l1 l2 folds on the two lists l1 and l2, with index of each element passed to the function f. Computes f(… (f init i_0 l1_0 l2_0) …) i_n l1_n l2_n .

  • raises Invalid_argument

    when lists do not have the same length.

  • since 2.0, but only
  • since 2.2 with labels
val get_at_idx : int -> 'a t -> 'a option

get_at_idx i l returns Some i-th element of the given list l or None if the list l is too short. If the index is negative, it will get element starting from the end of the list l.

val nth_opt : 'a t -> int -> 'a option

nth_opt l n returns Some n-th element of l. Safe version of nth.

  • raises Invalid_argument

    if the int is negative.

  • since 1.5, but only
  • since 2.2 with labels
val get_at_idx_exn : int -> 'a t -> 'a

get_at_idx_exn i l gets the i-th element of l, or

  • raises Not_found

    if the index is invalid. The first element has index 0. If the index is negative, it will get element starting from the end of the list.

val set_at_idx : int -> 'a -> 'a t -> 'a t

set_at_idx i x l replaces the i-th element with x (removes the old one), or does nothing if index is too high. If the index is negative, it will set element starting from the end of the list.

val insert_at_idx : int -> 'a -> 'a t -> 'a t

insert_at_idx i x l inserts x at i-th position, between the two existing elements. If the index is too high, append at the end of the list. If the index is negative, it will insert element starting from the end of the list.

val remove_at_idx : int -> 'a t -> 'a t

remove_at_idx i l removes element at given index i. Does nothing if the index is too high. If the index is negative, it will remove element starting from the end of the list.

Set Operators

Those operations maintain the invariant that the list does not contain duplicates (if it already satisfies it).

val add_nodup : eq:( 'a -> 'a -> bool ) -> 'a -> 'a t -> 'a t

add_nodup ~eq x set adds x to set if it was not already present. Linear time.

  • since 0.11
val remove_one : eq:( 'a -> 'a -> bool ) -> 'a -> 'a t -> 'a t

remove_one ~eq x set removes one occurrence of x from set. Linear time.

  • since 0.11
val mem : ?eq:( 'a -> 'a -> bool ) -> 'a -> 'a t -> bool

mem ?eq x l is true iff x is equal to an element of l. A comparator function eq can be provided. Linear time.

val subset : eq:( 'a -> 'a -> bool ) -> 'a t -> 'a t -> bool

subset ~eq l1 l2 tests if all elements of the list l1 are contained in the list l2 by applying eq.

val uniq : eq:( 'a -> 'a -> bool ) -> 'a t -> 'a t

uniq ~eq l removes duplicates in l w.r.t the equality predicate eq. 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

union ~eq l1 l2 is the union of the lists l1 and l2 w.r.t. the equality predicate eq. Complexity is product of length of inputs.

val inter : eq:( 'a -> 'a -> bool ) -> 'a t -> 'a t -> 'a t

inter ~eq l1 l2 is the intersection of the lists l1 and l2 w.r.t. the equality predicate eq. Complexity is product of length of inputs.

Other Constructors

val range_by : step:int -> int -> int -> int t

range_by ~step i j iterates on integers from i to j included, where the difference between successive elements is step. Use a negative step for a decreasing list.

  • raises Invalid_argument

    if step=0.

  • since 0.18
val range : int -> int -> int t

range i j iterates on integers from i to j included. It works both for decreasing and increasing ranges.

val range' : int -> int -> int t

range' i j is like range but the second bound j is excluded. For instance range' 0 5 = [0;1;2;3;4].

val replicate : int -> 'a -> 'a t

replicate n x replicates the given element x n times.

val repeat : int -> 'a t -> 'a t

repeat n l concatenates the list l with itself n times.

Association Lists

module Assoc : sig ... end
val assoc : eq:( 'a -> 'a -> bool ) -> 'a -> ('a * 'b) t -> 'b

assoc ~eq k alist returns the value v associated with key k in alist. Like Assoc.get_exn.

  • since 2.0
val assoc_opt : eq:( 'a -> 'a -> bool ) -> 'a -> ('a * 'b) t -> 'b option

assoc_opt ~eq k alist returns Some v if the given key k is present into alist, or None if not present. Like Assoc.get.

  • since 1.5, but only
  • since 2.0 with labels
val assq_opt : 'a -> ('a * 'b) t -> 'b option

assq_opt k alist returns Some v if the given key k is present into alist. Like Assoc.assoc_opt but use physical equality instead of structural equality to compare keys. Safe version of assq.

  • since 1.5, but only
  • since 2.0 with labels
val mem_assoc : ?eq:( 'a -> 'a -> bool ) -> 'a -> ('a * _) t -> bool

mem_assoc ?eq k alist returns true iff k is a key in alist. Like Assoc.mem.

  • since 2.0
val remove_assoc : eq:( 'a -> 'a -> bool ) -> 'a -> ('a * 'b) t -> ('a * 'b) t

remove_assoc ~eq k alist returns the alist without the first pair with key k, if any. Like Assoc.remove.

  • since 2.0

References on Lists

module Ref : sig ... end
module type MONAD = sig ... end
module Traverse (M : MONAD) : sig ... end

Conversions

val random : 'a random_gen -> 'a t random_gen
val random_non_empty : 'a random_gen -> 'a t random_gen
val random_len : int -> 'a random_gen -> 'a t random_gen
val random_choose : 'a t -> 'a random_gen

random_choose l randomly chooses an element in the list l.

  • raises Not_found

    if the list is empty.

val random_sequence : 'a random_gen t -> 'a t random_gen
val to_string : + ?start:string -> + ?stop:string -> + ?sep:string -> + ( 'a -> string ) -> + 'a t -> + string

to_string ?start ?stop ?sep item_to_string l print l to a string using sep as a separator between elements of l.

  • since 2.7
val to_iter : 'a t -> 'a iter

to_iter l returns a iter of the elements of the list l.

  • since 2.8
val to_seq : 'a t -> 'a Stdlib.Seq.t

to_seq l returns a Seq.t of the elements of the list l. Renamed from to_std_seq since 3.0.

  • since 3.0
val of_iter : 'a iter -> 'a t

of_iter iter builds a list from a given iter. In the result, elements appear in the same order as they did in the source iter.

  • since 2.8
val of_seq_rev : 'a Stdlib.Seq.t -> 'a t

of_seq_rev seq builds a list from a given Seq.t, in reverse order. Renamed from of_std_seq_rev since 3.0.

  • since 3.0
val of_seq : 'a Stdlib.Seq.t -> 'a t

of_seq seq builds a list from a given Seq.t. In the result, elements appear in the same order as they did in the source Seq.t. Renamed from of_std_seq since 3.0.

  • since 3.0
val to_gen : 'a t -> 'a gen

to_gen l returns a gen of the elements of the list l.

val of_gen : 'a gen -> 'a t

of_gen gen builds a list from a given gen. In the result, elements appear in the same order as they did in the source gen.

Infix Operators

It is convenient to openCCList.Infix to access the infix operators without cluttering the scope too much.

module Infix : module type of CCList.Infix
include module type of Infix
val (>|=) : 'a CCList.t -> ( 'a -> 'b ) -> 'b CCList.t

l >|= f is the infix version of map with reversed arguments.

val (@) : 'a CCList.t -> 'a CCList.t -> 'a CCList.t

l1 @ l2 concatenates two lists l1 and l2. As append.

val (<*>) : ( 'a -> 'b ) CCList.t -> 'a CCList.t -> 'b CCList.t

funs <*> l is product (fun f x -> f x) funs l.

val (<$>) : ( 'a -> 'b ) -> 'a CCList.t -> 'b CCList.t

f <$> l is like map.

val (>>=) : 'a CCList.t -> ( 'a -> 'b CCList.t ) -> 'b CCList.t

l >>= f is flat_map f l.

val (--) : int -> int -> int CCList.t

i -- j is the infix alias for range. Bounds included.

val (--^) : int -> int -> int CCList.t

i --^ j is the infix alias for range'. Second bound j excluded.

  • since 0.17
val let+ : 'a CCList.t -> ( 'a -> 'b ) -> 'b CCList.t
val and+ : 'a CCList.t -> 'b CCList.t -> ('a * 'b) CCList.t
val let* : 'a CCList.t -> ( 'a -> 'b CCList.t ) -> 'b CCList.t
val and* : 'a CCList.t -> 'b CCList.t -> ('a * 'b) CCList.t
val and& : 'a list -> 'b list -> ('a * 'b) list

(and&) is combine_shortest. It allows to perform a synchronized product between two lists, stopping gently at the shortest. Usable both with let+ and let*.

# let f xs ys zs =
+    let+ x = xs
+    and& y = ys
+    and& z = zs in
+    x + y + z;;
+val f : int list -> int list -> int list -> int list = <fun>
+# f [1;2] [5;6;7] [10;10];;
+- : int list = [16; 18]
  • since 3.1

IO

val pp : + ?pp_start:unit printer -> + ?pp_stop:unit printer -> + ?pp_sep:unit printer -> + 'a printer -> + 'a t printer

pp ?pp_start ?pp_stop ?pp_sep ppf l prints the contents of a list.

\ No newline at end of file diff --git a/3.10/containers/CCListLabels/module-type-MONAD/index.html b/3.10/containers/CCListLabels/module-type-MONAD/index.html new file mode 100644 index 00000000..bd856d85 --- /dev/null +++ b/3.10/containers/CCListLabels/module-type-MONAD/index.html @@ -0,0 +1,2 @@ + +MONAD (containers.CCListLabels.MONAD)

Module type CCListLabels.MONAD

Monadic Operations

type 'a t
val return : 'a -> 'a t

return is the Monadic return.

val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t

(>>=) is the Monadic bind.

\ No newline at end of file diff --git a/3.10/containers/CCMap/.dummy b/3.10/containers/CCMap/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCMap/Make/index.html b/3.10/containers/CCMap/Make/index.html new file mode 100644 index 00000000..84cc3052 --- /dev/null +++ b/3.10/containers/CCMap/Make/index.html @@ -0,0 +1,34 @@ + +Make (containers.CCMap.Make)

Module CCMap.Make

Parameters

module O : Stdlib.Map.OrderedType

Signature

include Stdlib.Map.S + with type 'a t = 'a Stdlib.Map.Make(O).t + with type key = O.t
type key = O.t
type 'a t = 'a Stdlib.Map.Make(O).t
val empty : 'a t
val is_empty : 'a t -> bool
val mem : key -> 'a t -> bool
val add : key -> 'a -> 'a t -> 'a t
val singleton : key -> 'a -> 'a t
val remove : key -> 'a t -> 'a t
val merge : + ( key -> 'a option -> 'b option -> 'c option ) -> + 'a t -> + 'b t -> + 'c t
val union : ( key -> 'a -> 'a -> 'a option ) -> 'a t -> 'a t -> 'a t
val compare : ( 'a -> 'a -> int ) -> 'a t -> 'a t -> int
val equal : ( 'a -> 'a -> bool ) -> 'a t -> 'a t -> bool
val iter : ( key -> 'a -> unit ) -> 'a t -> unit
val fold : ( key -> 'a -> 'b -> 'b ) -> 'a t -> 'b -> 'b
val for_all : ( key -> 'a -> bool ) -> 'a t -> bool
val exists : ( key -> 'a -> bool ) -> 'a t -> bool
val filter : ( key -> 'a -> bool ) -> 'a t -> 'a t
val filter_map : ( key -> 'a -> 'b option ) -> 'a t -> 'b t
val partition : ( key -> 'a -> bool ) -> 'a t -> 'a t * 'a t
val cardinal : 'a t -> int
val bindings : 'a t -> (key * 'a) list
val min_binding : 'a t -> key * 'a
val max_binding : 'a t -> key * 'a
val choose : 'a t -> key * 'a
val split : key -> 'a t -> 'a t * 'a option * 'a t
val find : key -> 'a t -> 'a
val find_last : ( key -> bool ) -> 'a t -> key * 'a
val find_last_opt : ( key -> bool ) -> 'a t -> (key * 'a) option
val map : ( 'a -> 'b ) -> 'a t -> 'b t
val mapi : ( key -> 'a -> 'b ) -> 'a t -> 'b t
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t
val get : key -> 'a t -> 'a option

get k m returns Some v if the current binding of k in m is v, or None if the key k is not present. Safe version of find.

val get_or : key -> 'a t -> default:'a -> 'a

get_or k m ~default returns the value associated to k if present, and returns default otherwise (if k doesn't belong in m).

  • since 0.16
val update : key -> ( 'a option -> 'a option ) -> 'a t -> 'a t

update k f m calls f (Some v) if find k m = v, otherwise it calls f None. In any case, if the result is None k is removed from m, and if the result is Some v' then add k v' m is returned.

val choose_opt : 'a t -> (key * 'a) option

choose_opt m returns one binding of the given map m, or None if m is empty. Safe version of choose.

  • since 1.5
val min_binding_opt : 'a t -> (key * 'a) option

min_binding_opt m returns the smallest binding of the given map m, or None if m is empty. Safe version of min_binding.

  • since 1.5
val max_binding_opt : 'a t -> (key * 'a) option

max_binding_opt m returns the largest binding of the given map m, or None if m is empty. Safe version of max_binding.

  • since 1.5
val find_opt : key -> 'a t -> 'a option

find_opt k m returns Some v if the current binding of k in m is v, or None if the key k is not present. Safe version of find.

  • since 1.5
val find_first : ( key -> bool ) -> 'a t -> key * 'a

find_first f m where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists. See Map.S.find_first.

  • since 1.5
val find_first_opt : ( key -> bool ) -> 'a t -> (key * 'a) option

find_first_opt f m where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists. Safe version of find_first.

  • since 1.5
val merge_safe : + f:( key -> [ `Left of 'a | `Right of 'b | `Both of 'a * 'b ] -> 'c option ) -> + 'a t -> + 'b t -> + 'c t

merge_safe ~f a b merges the maps a and b together.

  • since 0.17
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> 'a t

add_seq m seq adds the given Seq.t of bindings to the map m. Like add_list. Renamed from add_std_seq since 3.0.

  • since 3.0
val add_seq_with : + f:( key -> 'a -> 'a -> 'a ) -> + 'a t -> + (key * 'a) Stdlib.Seq.t -> + 'a t

add_seq ~f m l adds the given seq l of bindings to the map m, using f to combine values that have the same key. If a key occurs several times, all its bindings are combined using the function f, with f key v1 v2 being called with v1 occurring later in the seq than v2.

  • since 3.3
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

of_seq seq builds a map from the given Seq.t of bindings. Like of_list. Renamed from of_std_seq since 3.0.

  • since 3.0
val of_seq_with : + f:( key -> 'a -> 'a -> 'a ) -> + (key * 'a) Stdlib.Seq.t -> + 'a t

of_seq_with ~f l builds a map from the given seq l of bindings k_i -> v_i, added in order using add. If a key occurs several times, all its bindings are combined using the function f, with f key v1 v2 being called with v1 occurring later in the seq than v2.

  • since 3.3
val add_iter : 'a t -> (key * 'a) iter -> 'a t

add_iter m iter adds the given iter of bindings to the map m. Like add_list.

  • since 2.8
val add_iter_with : + f:( key -> 'a -> 'a -> 'a ) -> + 'a t -> + (key * 'a) iter -> + 'a t

add_iter ~f m l adds the given iter l of bindings to the map m, using f to combine values that have the same key. If a key occurs several times, all its bindings are combined using the function f, with f key v1 v2 being called with v1 occurring later in the seq than v2.

  • since 3.3
val of_iter : (key * 'a) iter -> 'a t

of_iter iter builds a map from the given iter of bindings. Like of_list.

  • since 2.8
val of_iter_with : f:( key -> 'a -> 'a -> 'a ) -> (key * 'a) iter -> 'a t

of_iter_with ~f l builds a map from the given iter l of bindings k_i -> v_i, added in order using add. If a key occurs several times, all its bindings are combined using the function f, with f key v1 v2 being called with v1 occurring later in the iter than v2.

  • since 3.3
val to_iter : 'a t -> (key * 'a) iter

to_iter m iterates on the whole map m, creating an iter of bindings. Like to_list.

  • since 2.8
val of_list : (key * 'a) list -> 'a t

of_list l builds a map from the given list l of bindings k_i -> v_i, added in order using add. If a key occurs several times, only its last binding will be present in the result.

val of_list_with : f:( key -> 'a -> 'a -> 'a ) -> (key * 'a) list -> 'a t

of_list_with ~f l builds a map from the given list l of bindings k_i -> v_i, added in order using add. If a key occurs several times, all its bindings are combined using the function f, with f key v1 v2 being called with v1 occurring later in the list than v2.

  • since 3.3
val add_list : 'a t -> (key * 'a) list -> 'a t

add_list m l adds the given list l of bindings to the map m.

  • since 0.14
val add_list_with : + f:( key -> 'a -> 'a -> 'a ) -> + 'a t -> + (key * 'a) list -> + 'a t

add_list ~f m l adds the given list l of bindings to the map m, using f to combine values that have the same key. If a key occurs several times, all its bindings are combined using the function f, with f key v1 v2 being called with v1 occurring later in the seq than v2.

  • since 3.3
val keys : _ t -> key iter

keys m iterates on the keys of m only, creating an iter of keys.

  • since 0.15
val values : 'a t -> 'a iter

values m iterates on the values of m only, creating an iter of values.

  • since 0.15
val to_list : 'a t -> (key * 'a) list

to_list m builds a list of the bindings of the given map m. The order is unspecified.

val pp : + ?pp_start:unit printer -> + ?pp_stop:unit printer -> + ?pp_arrow:unit printer -> + ?pp_sep:unit printer -> + key printer -> + 'a printer -> + 'a t printer

pp ?pp_start ?pp_stop ?pp_arrow ?pp_sep pp_key pp_v m pretty-prints the contents of the map.

\ No newline at end of file diff --git a/3.10/containers/CCMap/index.html b/3.10/containers/CCMap/index.html new file mode 100644 index 00000000..1a760e5e --- /dev/null +++ b/3.10/containers/CCMap/index.html @@ -0,0 +1,4 @@ + +CCMap (containers.CCMap)

Module CCMap

Extensions of Standard Map

Provide useful functions and iterators on Map.S

type 'a iter = ( 'a -> unit ) -> unit

Fast internal iterator.

  • since 2.8
type 'a printer = Stdlib.Format.formatter -> 'a -> unit
module type OrderedType = Stdlib.Map.OrderedType
module type S = sig ... end
module Make + (O : Stdlib.Map.OrderedType) : + S with type 'a t = 'a Stdlib.Map.Make(O).t and type key = O.t
\ No newline at end of file diff --git a/3.10/containers/CCMap/module-type-S/index.html b/3.10/containers/CCMap/module-type-S/index.html new file mode 100644 index 00000000..717991f2 --- /dev/null +++ b/3.10/containers/CCMap/module-type-S/index.html @@ -0,0 +1,32 @@ + +S (containers.CCMap.S)

Module type CCMap.S

include Stdlib.Map.S
type key
type !+'a t
val empty : 'a t
val is_empty : 'a t -> bool
val mem : key -> 'a t -> bool
val add : key -> 'a -> 'a t -> 'a t
val singleton : key -> 'a -> 'a t
val remove : key -> 'a t -> 'a t
val merge : + ( key -> 'a option -> 'b option -> 'c option ) -> + 'a t -> + 'b t -> + 'c t
val union : ( key -> 'a -> 'a -> 'a option ) -> 'a t -> 'a t -> 'a t
val compare : ( 'a -> 'a -> int ) -> 'a t -> 'a t -> int
val equal : ( 'a -> 'a -> bool ) -> 'a t -> 'a t -> bool
val iter : ( key -> 'a -> unit ) -> 'a t -> unit
val fold : ( key -> 'a -> 'b -> 'b ) -> 'a t -> 'b -> 'b
val for_all : ( key -> 'a -> bool ) -> 'a t -> bool
val exists : ( key -> 'a -> bool ) -> 'a t -> bool
val filter : ( key -> 'a -> bool ) -> 'a t -> 'a t
val filter_map : ( key -> 'a -> 'b option ) -> 'a t -> 'b t
val partition : ( key -> 'a -> bool ) -> 'a t -> 'a t * 'a t
val cardinal : 'a t -> int
val bindings : 'a t -> (key * 'a) list
val min_binding : 'a t -> key * 'a
val max_binding : 'a t -> key * 'a
val choose : 'a t -> key * 'a
val split : key -> 'a t -> 'a t * 'a option * 'a t
val find : key -> 'a t -> 'a
val find_last : ( key -> bool ) -> 'a t -> key * 'a
val find_last_opt : ( key -> bool ) -> 'a t -> (key * 'a) option
val map : ( 'a -> 'b ) -> 'a t -> 'b t
val mapi : ( key -> 'a -> 'b ) -> 'a t -> 'b t
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t
val get : key -> 'a t -> 'a option

get k m returns Some v if the current binding of k in m is v, or None if the key k is not present. Safe version of find.

val get_or : key -> 'a t -> default:'a -> 'a

get_or k m ~default returns the value associated to k if present, and returns default otherwise (if k doesn't belong in m).

  • since 0.16
val update : key -> ( 'a option -> 'a option ) -> 'a t -> 'a t

update k f m calls f (Some v) if find k m = v, otherwise it calls f None. In any case, if the result is None k is removed from m, and if the result is Some v' then add k v' m is returned.

val choose_opt : 'a t -> (key * 'a) option

choose_opt m returns one binding of the given map m, or None if m is empty. Safe version of choose.

  • since 1.5
val min_binding_opt : 'a t -> (key * 'a) option

min_binding_opt m returns the smallest binding of the given map m, or None if m is empty. Safe version of min_binding.

  • since 1.5
val max_binding_opt : 'a t -> (key * 'a) option

max_binding_opt m returns the largest binding of the given map m, or None if m is empty. Safe version of max_binding.

  • since 1.5
val find_opt : key -> 'a t -> 'a option

find_opt k m returns Some v if the current binding of k in m is v, or None if the key k is not present. Safe version of find.

  • since 1.5
val find_first : ( key -> bool ) -> 'a t -> key * 'a

find_first f m where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists. See Map.S.find_first.

  • since 1.5
val find_first_opt : ( key -> bool ) -> 'a t -> (key * 'a) option

find_first_opt f m where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists. Safe version of find_first.

  • since 1.5
val merge_safe : + f:( key -> [ `Left of 'a | `Right of 'b | `Both of 'a * 'b ] -> 'c option ) -> + 'a t -> + 'b t -> + 'c t

merge_safe ~f a b merges the maps a and b together.

  • since 0.17
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> 'a t

add_seq m seq adds the given Seq.t of bindings to the map m. Like add_list. Renamed from add_std_seq since 3.0.

  • since 3.0
val add_seq_with : + f:( key -> 'a -> 'a -> 'a ) -> + 'a t -> + (key * 'a) Stdlib.Seq.t -> + 'a t

add_seq ~f m l adds the given seq l of bindings to the map m, using f to combine values that have the same key. If a key occurs several times, all its bindings are combined using the function f, with f key v1 v2 being called with v1 occurring later in the seq than v2.

  • since 3.3
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

of_seq seq builds a map from the given Seq.t of bindings. Like of_list. Renamed from of_std_seq since 3.0.

  • since 3.0
val of_seq_with : + f:( key -> 'a -> 'a -> 'a ) -> + (key * 'a) Stdlib.Seq.t -> + 'a t

of_seq_with ~f l builds a map from the given seq l of bindings k_i -> v_i, added in order using add. If a key occurs several times, all its bindings are combined using the function f, with f key v1 v2 being called with v1 occurring later in the seq than v2.

  • since 3.3
val add_iter : 'a t -> (key * 'a) iter -> 'a t

add_iter m iter adds the given iter of bindings to the map m. Like add_list.

  • since 2.8
val add_iter_with : + f:( key -> 'a -> 'a -> 'a ) -> + 'a t -> + (key * 'a) iter -> + 'a t

add_iter ~f m l adds the given iter l of bindings to the map m, using f to combine values that have the same key. If a key occurs several times, all its bindings are combined using the function f, with f key v1 v2 being called with v1 occurring later in the seq than v2.

  • since 3.3
val of_iter : (key * 'a) iter -> 'a t

of_iter iter builds a map from the given iter of bindings. Like of_list.

  • since 2.8
val of_iter_with : f:( key -> 'a -> 'a -> 'a ) -> (key * 'a) iter -> 'a t

of_iter_with ~f l builds a map from the given iter l of bindings k_i -> v_i, added in order using add. If a key occurs several times, all its bindings are combined using the function f, with f key v1 v2 being called with v1 occurring later in the iter than v2.

  • since 3.3
val to_iter : 'a t -> (key * 'a) iter

to_iter m iterates on the whole map m, creating an iter of bindings. Like to_list.

  • since 2.8
val of_list : (key * 'a) list -> 'a t

of_list l builds a map from the given list l of bindings k_i -> v_i, added in order using add. If a key occurs several times, only its last binding will be present in the result.

val of_list_with : f:( key -> 'a -> 'a -> 'a ) -> (key * 'a) list -> 'a t

of_list_with ~f l builds a map from the given list l of bindings k_i -> v_i, added in order using add. If a key occurs several times, all its bindings are combined using the function f, with f key v1 v2 being called with v1 occurring later in the list than v2.

  • since 3.3
val add_list : 'a t -> (key * 'a) list -> 'a t

add_list m l adds the given list l of bindings to the map m.

  • since 0.14
val add_list_with : + f:( key -> 'a -> 'a -> 'a ) -> + 'a t -> + (key * 'a) list -> + 'a t

add_list ~f m l adds the given list l of bindings to the map m, using f to combine values that have the same key. If a key occurs several times, all its bindings are combined using the function f, with f key v1 v2 being called with v1 occurring later in the seq than v2.

  • since 3.3
val keys : _ t -> key iter

keys m iterates on the keys of m only, creating an iter of keys.

  • since 0.15
val values : 'a t -> 'a iter

values m iterates on the values of m only, creating an iter of values.

  • since 0.15
val to_list : 'a t -> (key * 'a) list

to_list m builds a list of the bindings of the given map m. The order is unspecified.

val pp : + ?pp_start:unit printer -> + ?pp_stop:unit printer -> + ?pp_arrow:unit printer -> + ?pp_sep:unit printer -> + key printer -> + 'a printer -> + 'a t printer

pp ?pp_start ?pp_stop ?pp_arrow ?pp_sep pp_key pp_v m pretty-prints the contents of the map.

\ No newline at end of file diff --git a/3.10/containers/CCMonomorphic/.dummy b/3.10/containers/CCMonomorphic/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCMonomorphic/index.html b/3.10/containers/CCMonomorphic/index.html new file mode 100644 index 00000000..7abfef01 --- /dev/null +++ b/3.10/containers/CCMonomorphic/index.html @@ -0,0 +1,2 @@ + +CCMonomorphic (containers.CCMonomorphic)

Module CCMonomorphic

Shadow unsafe functions and operators from Stdlib

val (=) : int -> int -> bool
val (<>) : int -> int -> bool
val (<) : int -> int -> bool
val (>) : int -> int -> bool
val (<=) : int -> int -> bool
val (>=) : int -> int -> bool
val compare : int -> int -> int
val min : int -> int -> int
val max : int -> int -> int

Infix operators for Floats

val (=.) : float -> float -> bool
  • since 2.1
val (<>.) : float -> float -> bool
  • since 2.1
val (<.) : float -> float -> bool
  • since 2.1
val (>.) : float -> float -> bool
  • since 2.1
val (<=.) : float -> float -> bool
  • since 2.1
val (>=.) : float -> float -> bool
  • since 2.1

Shadow Dangerous Operators

val (==) : [ `Consider_using_CCEqual_physical ]
val (!=) : [ `Consider_using_CCEqual_physical ]
  • since 2.1
\ No newline at end of file diff --git a/3.10/containers/CCNativeint/.dummy b/3.10/containers/CCNativeint/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCNativeint/Infix/index.html b/3.10/containers/CCNativeint/Infix/index.html new file mode 100644 index 00000000..0d1b50de --- /dev/null +++ b/3.10/containers/CCNativeint/Infix/index.html @@ -0,0 +1,2 @@ + +Infix (containers.CCNativeint.Infix)

Module CCNativeint.Infix

val (+) : t -> t -> t

x + y is the sum of x and y. Addition.

val (-) : t -> t -> t

x - y is the difference of x and y. Subtraction.

val (~-) : t -> t

~- x is the negation of x. Unary negation.

val (*) : t -> t -> t

x * y is the product of x and y. Multiplication.

val (/) : t -> t -> t

x / y is the integer quotient of x and y. Integer division. Raise Division_by_zero if the second argument y is zero. This division rounds the real quotient of its arguments towards zero, as specified for Stdlib.(/).

val (mod) : t -> t -> t

x mod y is the integer remainder of x / y. If y <> zero, the result of x mod y satisfies the following properties: zero <= x mod y < abs y and x = ((x / y) * y) + (x mod y). If y = 0, x mod y raises Division_by_zero.

val (**) : t -> t -> t

Alias to pow

  • since 3.0
val (--) : t -> t -> t iter

Alias to range.

  • since 3.0
val (--^) : t -> t -> t iter

Alias to range'.

  • since 3.0
val (land) : t -> t -> t

x land y is the bitwise logical and of x and y.

val (lor) : t -> t -> t

x lor y is the bitwise logical or of x and y.

val (lxor) : t -> t -> t

x lxor y is the bitwise logical exclusive or of x and y.

val lnot : t -> t

lnot x is the bitwise logical negation of x (the bits of x are inverted).

val (lsl) : t -> int -> t

x lsl y shifts x to the left by y bits. The result is unspecified if y < 0 or y >= bitsize, where bitsize is 32 on a 32-bit platform and 64 on a 64-bit platform.

val (lsr) : t -> int -> t

x lsr y shifts x to the right by y bits. This is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of x. The result is unspecified if y < 0 or y >= bitsize.

val (asr) : t -> int -> t

x asr y shifts x to the right by y bits. This is an arithmetic shift: the sign bit of x is replicated and inserted in the vacated bits. The result is unspecified if y < 0 or y >= bitsize.

val (=) : t -> t -> bool
val (<>) : t -> t -> bool
val (>) : t -> t -> bool
val (>=) : t -> t -> bool
val (<=) : t -> t -> bool
val (<) : t -> t -> bool
\ No newline at end of file diff --git a/3.10/containers/CCNativeint/index.html b/3.10/containers/CCNativeint/index.html new file mode 100644 index 00000000..01c3f7bc --- /dev/null +++ b/3.10/containers/CCNativeint/index.html @@ -0,0 +1,2 @@ + +CCNativeint (containers.CCNativeint)

Module CCNativeint

Helpers for processor-native integers

This module provides operations on the type nativeint of signed 32-bit integers (on 32-bit platforms) or signed 64-bit integers (on 64-bit platforms). This integer type has exactly the same width as that of a pointer type in the C compiler. All arithmetic operations over nativeint are taken modulo 232 or 264 depending on the word size of the architecture.

Performance notice: values of type nativeint occupy more memory space than values of type int, and arithmetic operations on nativeint are generally slower than those on int. Use nativeint only when the application requires the extra bit of precision over the int type.

include module type of struct include Stdlib.Nativeint end
val zero : nativeint
val one : nativeint
val minus_one : nativeint
val neg : nativeint -> nativeint
val add : nativeint -> nativeint -> nativeint
val sub : nativeint -> nativeint -> nativeint
val mul : nativeint -> nativeint -> nativeint
val div : nativeint -> nativeint -> nativeint
val unsigned_div : nativeint -> nativeint -> nativeint
val rem : nativeint -> nativeint -> nativeint
val unsigned_rem : nativeint -> nativeint -> nativeint
val succ : nativeint -> nativeint
val pred : nativeint -> nativeint
val abs : nativeint -> nativeint
val size : int
val max_int : nativeint
val min_int : nativeint
val logand : nativeint -> nativeint -> nativeint
val logor : nativeint -> nativeint -> nativeint
val logxor : nativeint -> nativeint -> nativeint
val lognot : nativeint -> nativeint
val shift_left : nativeint -> int -> nativeint
val shift_right : nativeint -> int -> nativeint
val shift_right_logical : nativeint -> int -> nativeint
val of_int : int -> nativeint
val to_int : nativeint -> int
val unsigned_to_int : nativeint -> int option
val of_float : float -> nativeint
val to_float : nativeint -> float
val of_int32 : int32 -> nativeint
val to_int32 : nativeint -> int32
val to_string : nativeint -> string
type t = nativeint
val compare : t -> t -> int
val unsigned_compare : t -> t -> int
val equal : t -> t -> bool
val format : string -> nativeint -> string
val min : t -> t -> t

min x y returns the minimum of the two integers x and y.

  • since 3.0
val max : t -> t -> t

max x y returns the maximum of the two integers x and y.

  • since 3.0
val hash : t -> int

hash x computes the hash of x. Like Stdlib.abs(to_intx).

val sign : t -> int

sign x return 0 if x = 0, -1 if x < 0 and 1 if x > 0. Same as compare x zero.

  • since 3.0
val pow : t -> t -> t

pow base exponent returns base raised to the power of exponent. pow x y = x^y for positive integers x and y. Raises Invalid_argument if x = y = 0 or y < 0.

  • since 0.11
val floor_div : t -> t -> t

floor_div x n is integer division rounding towards negative infinity. It satisfies x = m * floor_div x n + rem x n.

  • since 3.0
type 'a printer = Stdlib.Format.formatter -> 'a -> unit
type 'a random_gen = Stdlib.Random.State.t -> 'a
type 'a iter = ( 'a -> unit ) -> unit
val range_by : step:t -> t -> t -> t iter

range_by ~step i j iterates on integers from i to j included, where the difference between successive elements is step. Use a negative step for a decreasing list.

  • raises Invalid_argument

    if step=0.

  • since 3.0
val range : t -> t -> t iter

range i j iterates on integers from i to j included . It works both for decreasing and increasing ranges.

  • since 3.0
val range' : t -> t -> t iter

range' i j is like range but the second bound j is excluded. For instance range' 0 5 = Iter.of_list [0;1;2;3;4].

  • since 3.0
val random : t -> t random_gen
val random_small : t random_gen
val random_range : t -> t -> t random_gen

Conversion

val of_string : string -> t option

of_string s is the safe version of of_string_exn. Like of_string_exn, but return None instead of raising.

val of_string_opt : string -> t option

of_string_opt s is an alias to of_string.

val of_string_exn : string -> t

of_string_exn s converts the given string s into a native integer. Alias to Nativeint.of_string. Convert the given string to a native integer. The string is read in decimal (by default, or if the string begins with 0u) or in hexadecimal, octal or binary if the string begins with 0x, 0o or 0b respectively.

The 0u prefix reads the input as an unsigned integer in the range [0, 2*CCNativeint.max_int+1]. If the input exceeds CCNativeint.max_int it is converted to the signed integer CCInt64.min_int + input - CCNativeint.max_int - 1.

Raise Failure "Nativeint.of_string" if the given string is not a valid representation of an integer, or if the integer represented exceeds the range of integers representable in type nativeint.

val to_string_binary : t -> string

to_string_binary x returns the string representation of the integer x, in binary.

  • since 3.0

Printing

val pp : t printer

pp ppf x prints the integer x on ppf.

  • since 3.0
val pp_binary : t printer

pp_binary ppf x prints x on ppf. Print as "0b00101010".

  • since 3.0

Infix Operators

module Infix : sig ... end
include module type of Infix
val (+) : t -> t -> t

x + y is the sum of x and y. Addition.

val (-) : t -> t -> t

x - y is the difference of x and y. Subtraction.

val (~-) : t -> t

~- x is the negation of x. Unary negation.

val (*) : t -> t -> t

x * y is the product of x and y. Multiplication.

val (/) : t -> t -> t

x / y is the integer quotient of x and y. Integer division. Raise Division_by_zero if the second argument y is zero. This division rounds the real quotient of its arguments towards zero, as specified for Stdlib.(/).

val (mod) : t -> t -> t

x mod y is the integer remainder of x / y. If y <> zero, the result of x mod y satisfies the following properties: zero <= x mod y < abs y and x = ((x / y) * y) + (x mod y). If y = 0, x mod y raises Division_by_zero.

val (**) : t -> t -> t

Alias to pow

  • since 3.0
val (--) : t -> t -> t iter

Alias to range.

  • since 3.0
val (--^) : t -> t -> t iter

Alias to range'.

  • since 3.0
val (land) : t -> t -> t

x land y is the bitwise logical and of x and y.

val (lor) : t -> t -> t

x lor y is the bitwise logical or of x and y.

val (lxor) : t -> t -> t

x lxor y is the bitwise logical exclusive or of x and y.

val lnot : t -> t

lnot x is the bitwise logical negation of x (the bits of x are inverted).

val (lsl) : t -> int -> t

x lsl y shifts x to the left by y bits. The result is unspecified if y < 0 or y >= bitsize, where bitsize is 32 on a 32-bit platform and 64 on a 64-bit platform.

val (lsr) : t -> int -> t

x lsr y shifts x to the right by y bits. This is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of x. The result is unspecified if y < 0 or y >= bitsize.

val (asr) : t -> int -> t

x asr y shifts x to the right by y bits. This is an arithmetic shift: the sign bit of x is replicated and inserted in the vacated bits. The result is unspecified if y < 0 or y >= bitsize.

val (=) : t -> t -> bool
val (<>) : t -> t -> bool
val (>) : t -> t -> bool
val (>=) : t -> t -> bool
val (<=) : t -> t -> bool
val (<) : t -> t -> bool
\ No newline at end of file diff --git a/3.10/containers/CCOpt/.dummy b/3.10/containers/CCOpt/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCOpt/Infix/index.html b/3.10/containers/CCOpt/Infix/index.html new file mode 100644 index 00000000..478fd2d3 --- /dev/null +++ b/3.10/containers/CCOpt/Infix/index.html @@ -0,0 +1,2 @@ + +Infix (containers.CCOpt.Infix)

Module CCOpt.Infix

val (>|=) : 'a t -> ( 'a -> 'b ) -> 'b t

o >|= f is map f o.

val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t

o >>= f is the monadic bind.

val (<*>) : ( 'a -> 'b ) t -> 'a t -> 'b t

f <*> o returns Some (f x) if o is Some x and None if o is None.

val (<$>) : ( 'a -> 'b ) -> 'a t -> 'b t

f <$> o is like map f o.

val (<+>) : 'a t -> 'a t -> 'a t

o1 <+> o2 is o1 if o1 is Some _, o2 if o1 is None.

Let operators on OCaml >= 4.08.0, nothing otherwise

  • since 2.8
val let+ : 'a t -> ( 'a -> 'b ) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ( 'a -> 'b t ) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t
\ No newline at end of file diff --git a/3.10/containers/CCOpt/index.html b/3.10/containers/CCOpt/index.html new file mode 100644 index 00000000..f18a340e --- /dev/null +++ b/3.10/containers/CCOpt/index.html @@ -0,0 +1,7 @@ + +CCOpt (containers.CCOpt)

Module CCOpt

Previous Option module

include module type of CCOption
type +'a t = 'a option
val map : ( 'a -> 'b ) -> 'a t -> 'b t

map f o applies the function f to the element inside o, if any.

val map_or : default:'b -> ( 'a -> 'b ) -> 'a t -> 'b

map_or ~default f o is f x if o = Some x, default otherwise.

  • since 0.16
val map_lazy : ( unit -> 'b ) -> ( 'a -> 'b ) -> 'a t -> 'b

map_lazy default_fn f o is f x if o = Some x, default_fn () otherwise.

  • since 1.2
val is_some : _ t -> bool

is_some (Some x) returns true otherwise it returns false.

val is_none : _ t -> bool

is_none None returns true otherwise it returns false.

  • since 0.11
val compare : ( 'a -> 'a -> int ) -> 'a t -> 'a t -> int

compare comp o1 o2 compares two options o1 and o2, using custom comparators comp for the value. None is always assumed to be less than Some _.

val equal : ( 'a -> 'a -> bool ) -> 'a t -> 'a t -> bool

equal p o1 o2 tests for equality between option types o1 and o2, using a custom equality predicate p.

val return : 'a -> 'a t

return x is a monadic return, that is return x = Some x.

val some : 'a -> 'a t

Alias to return.

  • since 3.5
val none : 'a t

Alias to None.

  • since 3.5
val flat_map : ( 'a -> 'b t ) -> 'a t -> 'b t

flat_map f o is equivalent to map followed by flatten. Flip version of >>=.

val bind : 'a t -> ( 'a -> 'b t ) -> 'b t

bind o f is f v if o is Some v, None otherwise. Monadic bind.

  • since 3.0
val map2 : ( 'a -> 'b -> 'c ) -> 'a t -> 'b t -> 'c t

map2 f o1 o2 maps 'a option and 'b option to a 'c option using f.

val iter : ( 'a -> unit ) -> 'a t -> unit

iter f o applies f to o. Iterate on 0 or 1 element.

val fold : ( 'a -> 'b -> 'a ) -> 'a -> 'b t -> 'a

fold f init o is f init x if o is Some x, or init if o is None. Fold on 0 or 1 element.

val filter : ( 'a -> bool ) -> 'a t -> 'a t

filter f o returns Some x if o is Some x and f x is true, or None if f x is false or if o is None. Filter on 0 or 1 element.

  • since 0.5
val if_ : ( 'a -> bool ) -> 'a -> 'a option

if_ f x is Some x if f x, None otherwise.

  • since 0.17
val exists : ( 'a -> bool ) -> 'a t -> bool

exists f o returns true iff there exists an element for which the provided function f evaluates to true.

  • since 0.17
val for_all : ( 'a -> bool ) -> 'a t -> bool

for_all f o returns true iff the provided function f evaluates to true for all elements.

  • since 0.17
val get_or : default:'a -> 'a t -> 'a

get_or ~default o extracts the value from o, or returns default if o is None.

  • since 0.18
val value : 'a t -> default:'a -> 'a

value o ~default is similar to the Stdlib's Option.value and to get_or.

  • since 2.8
val get_exn : 'a t -> 'a

get_exn o returns x if o is Some x or fails if o is None.

  • raises Invalid_argument

    if the option is None.

  • deprecated

    use get_exn_or instead

val get_exn_or : string -> 'a t -> 'a

get_exn_or msg o returns x if o is Some x or fails with Invalid_argument msg if o is None.

  • raises Invalid_argument

    if the option is None.

  • since 3.4
val get_lazy : ( unit -> 'a ) -> 'a t -> 'a

get_lazy default_fn o unwraps o, but if o is None it returns default_fn () instead.

  • since 0.6.1
val sequence_l : 'a t list -> 'a list t

sequence_l [x1; x2; …; xn] returns Some [y1; y2; …; yn] if every xi is Some yi. Otherwise, if the list contains at least one None, the result is None.

val wrap : ?handler:( exn -> bool ) -> ( 'a -> 'b ) -> 'a -> 'b option

wrap ?handler f x calls f x and returns Some y if f x = y. If f x raises any exception, the result is None. This can be useful to wrap functions such as Map.S.find.

  • parameter handler

    the exception handler, which returns true if the exception is to be caught.

val wrap2 : + ?handler:( exn -> bool ) -> + ( 'a -> 'b -> 'c ) -> + 'a -> + 'b -> + 'c option

wrap2 ?handler f x y is similar to wrap but for binary functions.

Applicative

val pure : 'a -> 'a t

pure x is an alias to return.

Alternatives

val or_ : else_:'a t -> 'a t -> 'a t

or_ ~else_ o is o if o is Some _, else_ if o is None.

  • since 1.2
val or_lazy : else_:( unit -> 'a t ) -> 'a t -> 'a t

or_lazy ~else_ o is o if o is Some _, else_ () if o is None.

  • since 1.2
val choice : 'a t list -> 'a t

choice lo returns the first non-None element of the list lo, or None.

val flatten : 'a t t -> 'a t

flatten oo transforms Some x into x.

  • since 2.2
val return_if : bool -> 'a -> 'a t

return_if b x applies Some or None depending on the boolean b. More precisely, return_if false x is None, and return_if true x is Some x.

  • since 2.2

Infix Operators

  • since 0.16
module Infix : sig ... end
include module type of Infix
val (>|=) : 'a t -> ( 'a -> 'b ) -> 'b t

o >|= f is map f o.

val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t

o >>= f is the monadic bind.

val (<*>) : ( 'a -> 'b ) t -> 'a t -> 'b t

f <*> o returns Some (f x) if o is Some x and None if o is None.

val (<$>) : ( 'a -> 'b ) -> 'a t -> 'b t

f <$> o is like map f o.

val (<+>) : 'a t -> 'a t -> 'a t

o1 <+> o2 is o1 if o1 is Some _, o2 if o1 is None.

Let operators on OCaml >= 4.08.0, nothing otherwise

  • since 2.8
val let+ : 'a t -> ( 'a -> 'b ) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ( 'a -> 'b t ) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t

Conversion and IO

val to_list : 'a t -> 'a list

to_list o returns [x] if o is Some x or the empty list [] if o is None.

val of_list : 'a list -> 'a t

of_list l returns Some x (x being the head of the list l), or None if l is the empty list.

val to_result : 'e -> 'a t -> ( 'a, 'e ) Stdlib.result

to_result e o returns Ok x if o is Some x, or Error e if o is None.

  • since 1.2
val to_result_lazy : ( unit -> 'e ) -> 'a t -> ( 'a, 'e ) Stdlib.result

to_result_lazy f o returns Ok x if o is Some x or Error f if o is None.

  • since 1.2
val of_result : ( 'a, _ ) Stdlib.result -> 'a t

of_result result returns an option from a result.

  • since 1.2
type 'a iter = ( 'a -> unit ) -> unit
type 'a gen = unit -> 'a option
type 'a printer = Stdlib.Format.formatter -> 'a -> unit
type 'a random_gen = Stdlib.Random.State.t -> 'a
val random : 'a random_gen -> 'a t random_gen
val choice_iter : 'a t iter -> 'a t

choice_iter iter is similar to choice, but works on iter. It returns the first Some x occurring in iter, or None otherwise.

  • since 3.0
val choice_seq : 'a t Stdlib.Seq.t -> 'a t

choice_seq seq works on Seq.t. It returns the first Some x occurring in seq, or None otherwise.

  • since 3.0
val to_gen : 'a t -> 'a gen

to_gen o is o as a gen. Some x is the singleton gen containing x and None is the empty gen.

val to_seq : 'a t -> 'a Stdlib.Seq.t

to_seq o is o as a sequence Seq.t. Some x is the singleton sequence containing x and None is the empty sequence. Same as Stdlib.Option.to_seq Renamed from to_std_seq since 3.0.

  • since 3.0
val to_iter : 'a t -> 'a iter

to_iter o returns an internal iterator, like in the library Iter.

  • since 2.8
val pp : 'a printer -> 'a t printer

pp ppf o pretty-prints option o using ppf.

\ No newline at end of file diff --git a/3.10/containers/CCOption/.dummy b/3.10/containers/CCOption/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCOption/Infix/index.html b/3.10/containers/CCOption/Infix/index.html new file mode 100644 index 00000000..a41aee2b --- /dev/null +++ b/3.10/containers/CCOption/Infix/index.html @@ -0,0 +1,2 @@ + +Infix (containers.CCOption.Infix)

Module CCOption.Infix

val (>|=) : 'a t -> ( 'a -> 'b ) -> 'b t

o >|= f is map f o.

val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t

o >>= f is the monadic bind.

val (<*>) : ( 'a -> 'b ) t -> 'a t -> 'b t

f <*> o returns Some (f x) if o is Some x and None if o is None.

val (<$>) : ( 'a -> 'b ) -> 'a t -> 'b t

f <$> o is like map f o.

val (<+>) : 'a t -> 'a t -> 'a t

o1 <+> o2 is o1 if o1 is Some _, o2 if o1 is None.

Let operators on OCaml >= 4.08.0, nothing otherwise

  • since 2.8
val let+ : 'a t -> ( 'a -> 'b ) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ( 'a -> 'b t ) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t
\ No newline at end of file diff --git a/3.10/containers/CCOption/index.html b/3.10/containers/CCOption/index.html new file mode 100644 index 00000000..ea567616 --- /dev/null +++ b/3.10/containers/CCOption/index.html @@ -0,0 +1,7 @@ + +CCOption (containers.CCOption)

Module CCOption

Basic operations on the option type.

This module replaces `CCOpt`.

type +'a t = 'a option
val map : ( 'a -> 'b ) -> 'a t -> 'b t

map f o applies the function f to the element inside o, if any.

val map_or : default:'b -> ( 'a -> 'b ) -> 'a t -> 'b

map_or ~default f o is f x if o = Some x, default otherwise.

  • since 0.16
val map_lazy : ( unit -> 'b ) -> ( 'a -> 'b ) -> 'a t -> 'b

map_lazy default_fn f o is f x if o = Some x, default_fn () otherwise.

  • since 1.2
val is_some : _ t -> bool

is_some (Some x) returns true otherwise it returns false.

val is_none : _ t -> bool

is_none None returns true otherwise it returns false.

  • since 0.11
val compare : ( 'a -> 'a -> int ) -> 'a t -> 'a t -> int

compare comp o1 o2 compares two options o1 and o2, using custom comparators comp for the value. None is always assumed to be less than Some _.

val equal : ( 'a -> 'a -> bool ) -> 'a t -> 'a t -> bool

equal p o1 o2 tests for equality between option types o1 and o2, using a custom equality predicate p.

val return : 'a -> 'a t

return x is a monadic return, that is return x = Some x.

val some : 'a -> 'a t

Alias to return.

  • since 3.5
val none : 'a t

Alias to None.

  • since 3.5
val flat_map : ( 'a -> 'b t ) -> 'a t -> 'b t

flat_map f o is equivalent to map followed by flatten. Flip version of >>=.

val bind : 'a t -> ( 'a -> 'b t ) -> 'b t

bind o f is f v if o is Some v, None otherwise. Monadic bind.

  • since 3.0
val map2 : ( 'a -> 'b -> 'c ) -> 'a t -> 'b t -> 'c t

map2 f o1 o2 maps 'a option and 'b option to a 'c option using f.

val iter : ( 'a -> unit ) -> 'a t -> unit

iter f o applies f to o. Iterate on 0 or 1 element.

val fold : ( 'a -> 'b -> 'a ) -> 'a -> 'b t -> 'a

fold f init o is f init x if o is Some x, or init if o is None. Fold on 0 or 1 element.

val filter : ( 'a -> bool ) -> 'a t -> 'a t

filter f o returns Some x if o is Some x and f x is true, or None if f x is false or if o is None. Filter on 0 or 1 element.

  • since 0.5
val if_ : ( 'a -> bool ) -> 'a -> 'a option

if_ f x is Some x if f x, None otherwise.

  • since 0.17
val exists : ( 'a -> bool ) -> 'a t -> bool

exists f o returns true iff there exists an element for which the provided function f evaluates to true.

  • since 0.17
val for_all : ( 'a -> bool ) -> 'a t -> bool

for_all f o returns true iff the provided function f evaluates to true for all elements.

  • since 0.17
val get_or : default:'a -> 'a t -> 'a

get_or ~default o extracts the value from o, or returns default if o is None.

  • since 0.18
val value : 'a t -> default:'a -> 'a

value o ~default is similar to the Stdlib's Option.value and to get_or.

  • since 2.8
val get_exn : 'a t -> 'a

get_exn o returns x if o is Some x or fails if o is None.

  • raises Invalid_argument

    if the option is None.

  • deprecated

    use get_exn_or instead

val get_exn_or : string -> 'a t -> 'a

get_exn_or msg o returns x if o is Some x or fails with Invalid_argument msg if o is None.

  • raises Invalid_argument

    if the option is None.

  • since 3.4
val get_lazy : ( unit -> 'a ) -> 'a t -> 'a

get_lazy default_fn o unwraps o, but if o is None it returns default_fn () instead.

  • since 0.6.1
val sequence_l : 'a t list -> 'a list t

sequence_l [x1; x2; …; xn] returns Some [y1; y2; …; yn] if every xi is Some yi. Otherwise, if the list contains at least one None, the result is None.

val wrap : ?handler:( exn -> bool ) -> ( 'a -> 'b ) -> 'a -> 'b option

wrap ?handler f x calls f x and returns Some y if f x = y. If f x raises any exception, the result is None. This can be useful to wrap functions such as Map.S.find.

  • parameter handler

    the exception handler, which returns true if the exception is to be caught.

val wrap2 : + ?handler:( exn -> bool ) -> + ( 'a -> 'b -> 'c ) -> + 'a -> + 'b -> + 'c option

wrap2 ?handler f x y is similar to wrap but for binary functions.

Applicative

val pure : 'a -> 'a t

pure x is an alias to return.

Alternatives

val or_ : else_:'a t -> 'a t -> 'a t

or_ ~else_ o is o if o is Some _, else_ if o is None.

  • since 1.2
val or_lazy : else_:( unit -> 'a t ) -> 'a t -> 'a t

or_lazy ~else_ o is o if o is Some _, else_ () if o is None.

  • since 1.2
val choice : 'a t list -> 'a t

choice lo returns the first non-None element of the list lo, or None.

val flatten : 'a t t -> 'a t

flatten oo transforms Some x into x.

  • since 2.2
val return_if : bool -> 'a -> 'a t

return_if b x applies Some or None depending on the boolean b. More precisely, return_if false x is None, and return_if true x is Some x.

  • since 2.2

Infix Operators

module Infix : sig ... end
include module type of Infix
val (>|=) : 'a t -> ( 'a -> 'b ) -> 'b t

o >|= f is map f o.

val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t

o >>= f is the monadic bind.

val (<*>) : ( 'a -> 'b ) t -> 'a t -> 'b t

f <*> o returns Some (f x) if o is Some x and None if o is None.

val (<$>) : ( 'a -> 'b ) -> 'a t -> 'b t

f <$> o is like map f o.

val (<+>) : 'a t -> 'a t -> 'a t

o1 <+> o2 is o1 if o1 is Some _, o2 if o1 is None.

Let operators on OCaml >= 4.08.0, nothing otherwise

  • since 2.8
val let+ : 'a t -> ( 'a -> 'b ) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ( 'a -> 'b t ) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t

Conversion and IO

val to_list : 'a t -> 'a list

to_list o returns [x] if o is Some x or the empty list [] if o is None.

val of_list : 'a list -> 'a t

of_list l returns Some x (x being the head of the list l), or None if l is the empty list.

val to_result : 'e -> 'a t -> ( 'a, 'e ) Stdlib.result

to_result e o returns Ok x if o is Some x, or Error e if o is None.

  • since 1.2
val to_result_lazy : ( unit -> 'e ) -> 'a t -> ( 'a, 'e ) Stdlib.result

to_result_lazy f o returns Ok x if o is Some x or Error f if o is None.

  • since 1.2
val of_result : ( 'a, _ ) Stdlib.result -> 'a t

of_result result returns an option from a result.

  • since 1.2
type 'a iter = ( 'a -> unit ) -> unit
type 'a gen = unit -> 'a option
type 'a printer = Stdlib.Format.formatter -> 'a -> unit
type 'a random_gen = Stdlib.Random.State.t -> 'a
val random : 'a random_gen -> 'a t random_gen
val choice_iter : 'a t iter -> 'a t

choice_iter iter is similar to choice, but works on iter. It returns the first Some x occurring in iter, or None otherwise.

  • since 3.0
val choice_seq : 'a t Stdlib.Seq.t -> 'a t

choice_seq seq works on Seq.t. It returns the first Some x occurring in seq, or None otherwise.

  • since 3.0
val to_gen : 'a t -> 'a gen

to_gen o is o as a gen. Some x is the singleton gen containing x and None is the empty gen.

val to_seq : 'a t -> 'a Stdlib.Seq.t

to_seq o is o as a sequence Seq.t. Some x is the singleton sequence containing x and None is the empty sequence. Same as Stdlib.Option.to_seq Renamed from to_std_seq since 3.0.

  • since 3.0
val to_iter : 'a t -> 'a iter

to_iter o returns an internal iterator, like in the library Iter.

  • since 2.8
val pp : 'a printer -> 'a t printer

pp ppf o pretty-prints option o using ppf.

\ No newline at end of file diff --git a/3.10/containers/CCOrd/.dummy b/3.10/containers/CCOrd/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCOrd/Infix/index.html b/3.10/containers/CCOrd/Infix/index.html new file mode 100644 index 00000000..bc5194e0 --- /dev/null +++ b/3.10/containers/CCOrd/Infix/index.html @@ -0,0 +1,2 @@ + +Infix (containers.CCOrd.Infix)

Module CCOrd.Infix

val (<?>) : int -> ('a t * 'a * 'a) -> int

c1 <?> (ord, x, y) returns the same as c1 if c1 is not 0; otherwise it uses ord to compare the two values x and y, of type 'a.

val (>|=) : 'b t -> ( 'a -> 'b ) -> 'a t

Infix equivalent of map.

\ No newline at end of file diff --git a/3.10/containers/CCOrd/index.html b/3.10/containers/CCOrd/index.html new file mode 100644 index 00000000..cf887ef3 --- /dev/null +++ b/3.10/containers/CCOrd/index.html @@ -0,0 +1,6 @@ + +CCOrd (containers.CCOrd)

Module CCOrd

Order combinators

Comparisons

type 'a t = 'a -> 'a -> int

Comparison (total ordering) between two elements, that returns an int.

val poly : 'a t

Polymorphic "magic" comparison. Use with care, as it will fail on some types.

  • since 3.6
val compare : 'a t

Polymorphic "magic" comparison.

  • deprecated

    since 3.6 in favor of poly. The reason is that compare is easily shadowed, can shadow other comparators, and is just generally not very descriptive.

val opp : 'a t -> 'a t

Opposite order. For example, opp cmp a b < 0 iff cmp b a > 0. This can be used to sort values in the opposite order, among other things.

val equiv : int -> int -> bool

Returns true iff the two comparison results are the same.

val int : int t
val string : string t
val bool : bool t
val float : float t

Lexicographic Combination

val (<?>) : int -> ('a t * 'a * 'a) -> int

c1 <?> (ord, x, y) returns the same as c1 if c1 is not 0; otherwise it uses ord to compare the two values x and y, of type 'a.

Example:

CCInt.compare 1 3
+<?> (String.compare, "a", "b")
+<?> (CCBool.compare, true, false)

Same example, using only CCOrd::

CCOrd.(int 1 3
+  <?> (string, "a", "b")
+  <?> (bool, true, false))
val option : 'a t -> 'a option t

Comparison of optional values. None is smaller than any Some _.

  • since 0.15
val pair : 'a t -> 'b t -> ('a * 'b) t
val triple : 'a t -> 'b t -> 'c t -> ('a * 'b * 'c) t
val list : 'a t -> 'a list t

Lexicographic combination on lists.

val array : 'a t -> 'a array t
val map : ( 'a -> 'b ) -> 'b t -> 'a t

map f ord is the comparison function that, given objects x and y, projects x and y using f (e.g. using a record field) and then compares those projections with ord. Example: map fst CCInt.compare compares values of type (int * 'a) by their first component.

val (>|=) : 'b t -> ( 'a -> 'b ) -> 'a t

Infix equivalent of map.

module Infix : sig ... end
\ No newline at end of file diff --git a/3.10/containers/CCPair/.dummy b/3.10/containers/CCPair/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCPair/index.html b/3.10/containers/CCPair/index.html new file mode 100644 index 00000000..f16133d6 --- /dev/null +++ b/3.10/containers/CCPair/index.html @@ -0,0 +1,28 @@ + +CCPair (containers.CCPair)

Module CCPair

Tuple Functions

type ('a, 'b) t = 'a * 'b
val make : 'a -> 'b -> ( 'a, 'b ) t

Make a tuple from its components.

  • since 0.16
val map_fst : ( 'a -> 'b ) -> ('a * 'c) -> 'b * 'c

map_fst f (x, y) returns (f x, y). Renamed from map1 since 3.0.

val map_snd : ( 'a -> 'b ) -> ('c * 'a) -> 'c * 'b

map_snd f (x, y) returns (x, f y). Renamed from map2 since 3.0.

val map : ( 'a -> 'c ) -> ( 'b -> 'd ) -> ('a * 'b) -> 'c * 'd

Synonym to (***). Map on both sides of a tuple.

val map_same : ( 'a -> 'b ) -> ('a * 'a) -> 'b * 'b

Like map but specialized for pairs with elements of the same type.

val map2 : + ( 'a1 -> 'b1 -> 'c1 ) -> + ( 'a2 -> 'b2 -> 'c2 ) -> + ('a1 * 'a2) -> + ('b1 * 'b2) -> + 'c1 * 'c2

map2 f g (a,b) (x,y) return (f a x, g b y).

  • since 3.0
val map_same2 : ( 'a -> 'b -> 'c ) -> ('a * 'a) -> ('b * 'b) -> 'c * 'c

map_same2 f (a,b) (x,y) return (f a x, f b y).

  • since 3.0
val fst_map : ( 'a -> 'b ) -> ('a * _) -> 'b

Compose the given function with fst. Rename from map_fst since 3.0.

  • since 0.3.3
val snd_map : ( 'a -> 'b ) -> (_ * 'a) -> 'b

Compose the given function with snd. Rename from map_snd since 3.0.

  • since 0.3.3
val iter : ( 'a -> 'b -> unit ) -> ('a * 'b) -> unit
val swap : ('a * 'b) -> 'b * 'a

Swap the components of the tuple.

val (<<<) : ( 'a -> 'b ) -> ('a * 'c) -> 'b * 'c

Map on the left side of the tuple.

val (>>>) : ( 'a -> 'b ) -> ('c * 'a) -> 'c * 'b

Map on the right side of the tuple.

val (***) : ( 'a -> 'c ) -> ( 'b -> 'd ) -> ('a * 'b) -> 'c * 'd

Map on both sides of a tuple.

val (&&&) : ( 'a -> 'b ) -> ( 'a -> 'c ) -> 'a -> 'b * 'c

f &&& g is fun x -> f x, g x. It splits the computations into two parts.

val merge : ( 'a -> 'b -> 'c ) -> ('a * 'b) -> 'c

Uncurrying (merges the two components of a tuple).

val fold : ( 'a -> 'b -> 'c ) -> ('a * 'b) -> 'c

Synonym to merge.

  • since 0.3.3
val dup : 'a -> 'a * 'a

dup x = (x,x) (duplicate the value).

  • since 0.3.3
val dup_map : ( 'a -> 'b ) -> 'a -> 'a * 'b

dup_map f x = (x, f x). Duplicates the value and applies the function to the second copy.

  • since 0.3.3
val equal : + ( 'a -> 'a -> bool ) -> + ( 'b -> 'b -> bool ) -> + ('a * 'b) -> + ('a * 'b) -> + bool
val compare : + ( 'a -> 'a -> int ) -> + ( 'b -> 'b -> int ) -> + ('a * 'b) -> + ('a * 'b) -> + int
val to_string : + ?sep:string -> + ( 'a -> string ) -> + ( 'b -> string ) -> + ('a * 'b) -> + string

Print tuple in a string

  • since 2.7
type 'a printer = Stdlib.Format.formatter -> 'a -> unit
val pp : + ?pp_start:unit printer -> + ?pp_stop:unit printer -> + ?pp_sep:unit printer -> + 'a printer -> + 'b printer -> + ('a * 'b) printer

Print a pair given an optional separator, an optional start and stop and a method for printing each of its elements.

\ No newline at end of file diff --git a/3.10/containers/CCParse/.dummy b/3.10/containers/CCParse/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCParse/Debug_/index.html b/3.10/containers/CCParse/Debug_/index.html new file mode 100644 index 00000000..4e6aaa98 --- /dev/null +++ b/3.10/containers/CCParse/Debug_/index.html @@ -0,0 +1,2 @@ + +Debug_ (containers.CCParse.Debug_)

Module CCParse.Debug_

Debugging utils. EXPERIMENTAL

val trace_fail : string -> 'a t -> 'a t

trace_fail name p behaves like p, but prints the error message of p on stderr whenever p fails.

  • parameter name

    used as a prefix of all trace messages.

val trace_success : string -> print:( 'a -> string ) -> 'a t -> 'a t

trace_success name ~print p behaves like p, but prints successful runs of p using print.

val trace_success_or_fail : string -> print:( 'a -> string ) -> 'a t -> 'a t

Trace both error or success

\ No newline at end of file diff --git a/3.10/containers/CCParse/Error/index.html b/3.10/containers/CCParse/Error/index.html new file mode 100644 index 00000000..36d4b78e --- /dev/null +++ b/3.10/containers/CCParse/Error/index.html @@ -0,0 +1,2 @@ + +Error (containers.CCParse.Error)

Module CCParse.Error

Errors

type t

A parse error.

  • since 3.6
val position : t -> position

Returns position of the error

val line_and_column : t -> int * int

Line and column numbers of the error position.

val msg : t -> string
val to_string : t -> string

Prints the error

val pp : Stdlib.Format.formatter -> t -> unit

Pretty prints the error

\ No newline at end of file diff --git a/3.10/containers/CCParse/Infix/index.html b/3.10/containers/CCParse/Infix/index.html new file mode 100644 index 00000000..04160559 --- /dev/null +++ b/3.10/containers/CCParse/Infix/index.html @@ -0,0 +1,2 @@ + +Infix (containers.CCParse.Infix)

Module CCParse.Infix

val (>|=) : 'a t -> ( 'a -> 'b ) -> 'b t

Alias to map. p >|= f parses an item x using p, and returns f x.

val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t

Alias to bind. p >>= f results in a new parser which behaves as p then, in case of success, applies f to the result.

val (<*>) : ( 'a -> 'b ) t -> 'a t -> 'b t

Applicative.

val (<*) : 'a t -> _ t -> 'a t

a <* b parses a into x, parses b and ignores its result, and returns x.

val (*>) : _ t -> 'a t -> 'a t

a *> b parses a, then parses b into x, and returns x. The result of a is ignored.

val (<|>) : 'a t -> 'a t -> 'a t

Alias to or_.

a <|> b tries to parse a, and if a fails without consuming any input, backtracks and tries to parse b, otherwise it fails as a.

val (<?>) : 'a t -> string -> 'a t

a <?> msg behaves like a, but if a fails, a <?> msg fails with msg instead. Useful as the last choice in a series of <|>. For example: a <|> b <|> c <?> "expected one of a, b, c".

val (|||) : 'a t -> 'b t -> ('a * 'b) t

Alias to both. a ||| b parses a, then b, then returns the pair of their results.

  • since 3.6

Let operators on OCaml >= 4.08.0, nothing otherwise

  • since 2.8
val let+ : 'a t -> ( 'a -> 'b ) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ( 'a -> 'b t ) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t
\ No newline at end of file diff --git a/3.10/containers/CCParse/Position/index.html b/3.10/containers/CCParse/Position/index.html new file mode 100644 index 00000000..6cee78eb --- /dev/null +++ b/3.10/containers/CCParse/Position/index.html @@ -0,0 +1,2 @@ + +Position (containers.CCParse.Position)

Module CCParse.Position

Positions in input

type t = position
val line : t -> int

Line number, 0 based

val column : t -> int

Column number, 0 based

val line_and_column : t -> int * int

Line and column number

val pp : Stdlib.Format.formatter -> t -> unit

Unspecified pretty-printed version of the position.

\ No newline at end of file diff --git a/3.10/containers/CCParse/Slice/index.html b/3.10/containers/CCParse/Slice/index.html new file mode 100644 index 00000000..11d468a2 --- /dev/null +++ b/3.10/containers/CCParse/Slice/index.html @@ -0,0 +1,2 @@ + +Slice (containers.CCParse.Slice)

Module CCParse.Slice

Functions on slices.

type t = slice
val is_empty : t -> bool

Is the slice empty?

val length : t -> int

Length of the slice

val to_string : t -> string

Convert the slice into a string. Linear time and memory in length slice

\ No newline at end of file diff --git a/3.10/containers/CCParse/U/index.html b/3.10/containers/CCParse/U/index.html new file mode 100644 index 00000000..c30f2485 --- /dev/null +++ b/3.10/containers/CCParse/U/index.html @@ -0,0 +1,15 @@ + +U (containers.CCParse.U)

Module CCParse.U

Utils

This is useful to parse OCaml-like values in a simple way. All the parsers are whitespace-insensitive (they skip whitespace).

val list : ?start:string -> ?stop:string -> ?sep:string -> 'a t -> 'a list t

list p parses a list of p, with the OCaml conventions for start token "[", stop token "]" and separator ";". Whitespace between items are skipped.

val int : int t

Parse an int in decimal representation.

val in_paren : 'a t -> 'a t

in_paren p parses an opening "(",p , and then ")".

  • since 3.6
val in_parens_opt : 'a t -> 'a t

in_parens_opt p parses p in an arbitrary number of nested parenthesis (possibly 0).

  • since 3.6
val option : 'a t -> 'a option t

option p parses "Some <x>" into Some x if p parses "<x>" into x, and parses "None" into None.

  • since 3.6
val hexa_int : int t

Parse an int int hexadecimal format. Accepts an optional 0x prefix, and ignores capitalization.

  • since 3.6
val word : string t

Non empty string of alpha num, start with alpha.

val bool : bool t

Accepts "true" or "false"

  • since 3.6
val pair : + ?start:string -> + ?stop:string -> + ?sep:string -> + 'a t -> + 'b t -> + ('a * 'b) t

Parse a pair using OCaml syntactic conventions. The default is "(a, b)".

val triple : + ?start:string -> + ?stop:string -> + ?sep:string -> + 'a t -> + 'b t -> + 'c t -> + ('a * 'b * 'c) t

Parse a triple using OCaml syntactic conventions. The default is "(a, b, c)".

\ No newline at end of file diff --git a/3.10/containers/CCParse/index.html b/3.10/containers/CCParse/index.html new file mode 100644 index 00000000..5f3f010b --- /dev/null +++ b/3.10/containers/CCParse/index.html @@ -0,0 +1,48 @@ + +CCParse (containers.CCParse)

Module CCParse

Very Simple Parser Combinators

These combinators can be used to write very simple parsers, for example to extract data from a line-oriented file, or as a replacement to Scanf.

A few examples

Some more advanced example(s) can be found in the /examples directory.

Parse a tree
open CCParse;;
+
+type tree = L of int | N of tree * tree;;
+
+let mk_leaf x = L x
+let mk_node x y = N(x,y)
+
+let ptree = fix @@ fun self ->
+  skip_space *>
+    ( (char '(' *> (pure mk_node <*> self <*> self) <* char ')')
+      <|>
+        (U.int >|= mk_leaf) )
+;;
+
+parse_string_exn ptree "(1 (2 3))" ;;
+parse_string_exn ptree "((1 2) (3 (4 5)))" ;;
Parse a list of words
open Containers.Parse;;
+let p = U.list ~sep:"," U.word;;
+parse_string_exn p "[abc , de, hello ,world  ]";;
Stress Test

This makes a list of 100_000 integers, prints it and parses it back.

let p = CCParse.(U.list ~sep:"," U.int);;
+
+let l = CCList.(1 -- 100_000);;
+let l_printed =
+  CCFormat.(to_string (within "[" "]" (list ~sep:(return ",@,") int))) l;;
+
+let l' = CCParse.parse_string_exn p l_printed;;
+
+assert (l=l');;

Stability guarantees

Some functions are marked "experimental" and are still subject to change.

type position

A position in the input. Typically it'll point at the beginning of an error location.

module Position : sig ... end
module Error : sig ... end
type +'a or_error = ( 'a, Error.t ) Stdlib.result

'a or_error is either Ok x for some result x : 'a, or an error Error.t.

See stringify_result and Error.to_string to print the error message.

exception ParseError of Error.t

Input

Combinators

type 'a t

The abstract type of parsers that return a value of type 'a (or fail).

  • raises ParseError

    in case of failure.

  • since 3.6 the type is private.
val return : 'a -> 'a t

Always succeeds, without consuming its input.

val pure : 'a -> 'a t

Synonym to return.

val map : ( 'a -> 'b ) -> 'a t -> 'b t
val map2 : ( 'a -> 'b -> 'c ) -> 'a t -> 'b t -> 'c t
val map3 : ( 'a -> 'b -> 'c -> 'd ) -> 'a t -> 'b t -> 'c t -> 'd t
val bind : ( 'a -> 'b t ) -> 'a t -> 'b t

bind f p results in a new parser which behaves as p then, in case of success, applies f to the result.

  • since 3.6
val ap : ( 'a -> 'b ) t -> 'a t -> 'b t

Applicative.

  • since 3.6
val eoi : unit t

Expect the end of input, fails otherwise.

val empty : unit t

Succeed with ().

  • since 3.6
val fail : string -> 'a t

fail msg fails with the given message. It can trigger a backtrack.

val failf : ( 'a, unit, string, 'b t ) Stdlib.format4 -> 'a

Format.sprintf version of fail.

val fail_lazy : ( unit -> string ) -> 'a t

Like fail, but only produce an error message on demand.

  • since 3.6
val parsing : string -> 'a t -> 'a t

parsing s p behaves the same as p, with the information that we are parsing s, if p fails. The message s is added to the error, it does not replace it, not does the location change (the error still points to the same location as in p).

val set_error_message : string -> 'a t -> 'a t

set_error_message msg p behaves like p, but if p fails, set_error_message msg p fails with msg instead and at the current position. The internal error message of p is just discarded.

  • since 3.6
val pos : position t

pos returns the current position in the buffer.

EXPERIMENTAL

  • since 3.7
val with_pos : 'a t -> ('a * position) t

with_pos p behaves like p, but returns the (starting) position along with p's result.

EXPERIMENTAL

  • since 3.6
val any_char : char t

any_char parses any character. It still fails if the end of input was reached.

  • since 3.6
val any_char_n : int -> string t

any_char_n len parses exactly len characters from the input. Fails if the input doesn't contain at least len chars.

  • since 3.6
val char : char -> char t

char c parses the character c and nothing else.

type slice

A slice of the input, as returned by some combinators such as split_1 or split_list or take.

The idea is that one can use some parsers to cut the input into slices, e.g. split into lines, or split a line into fields (think CSV or TSV). Then a variety of parsers can be used on each slice to extract data from it using recurse.

Slices contain enough information to make it possible for recurse slice p to report failures (if p fails) using locations from the original input, not relative to the slice. Therefore, even after splitting the input into lines using, say, each_line, a failure to parse the 500th line will be reported at line 500 and not at line 1.

EXPERIMENTAL

  • since 3.6
module Slice : sig ... end

Functions on slices.

val recurse : slice -> 'a t -> 'a t

recurse slice p parses the slice (most likely obtained via another combinator, such as split_1 or split_n), using p.

The slice contains a position which is used to relocate error messages to their position in the whole input, not just relative to the slice.

EXPERIMENTAL

  • since 3.6
val set_current_slice : slice -> unit t

set_current_slice slice replaces the parser's state with slice.

EXPERIMENTAL

  • since 3.6
val chars_fold : + f: + ( 'acc -> + char -> + [ `Continue of 'acc + | `Consume_and_stop of 'acc + | `Stop of 'acc + | `Fail of string ] ) -> + 'acc -> + ('acc * slice) t

chars_fold f acc0 folds over characters of the input. Each char c is passed, along with the current accumulator, to f; f can either:

  • stop, by returning `Stop acc. In this case the final accumulator acc is returned, and c is not consumed.
  • consume char and stop, by returning `Consume_and_stop acc.
  • fail, by returning `Fail msg. In this case the parser fails with the given message.
  • continue, by returning `Continue acc. The parser continues to the next char with the new accumulator.

This is a generalization of of chars_if that allows one to transform characters on the fly, skip some, handle escape sequences, etc. It can also be useful as a base component for a lexer.

  • returns

    a pair of the final accumular, and the slice matched by the fold.

  • since 3.6
val chars_fold_transduce : + f: + ( 'acc -> + char -> + [ `Continue of 'acc + | `Yield of 'acc * char + | `Consume_and_stop + | `Stop + | `Fail of string ] ) -> + 'acc -> + ('acc * string) t

Same as char_fold but with the following differences:

  • returns a string along with the accumulator, rather than the slice of all the characters accepted by `Continue _. The string is built from characters returned by `Yield.
  • new case `Yield (acc, c) adds c to the returned string and continues parsing with acc.
  • since 3.6
val take : int -> slice t

take len parses exactly len characters from the input. Fails if the input doesn't contain at least len chars.

  • since 3.6
val take_if : ( char -> bool ) -> slice t

take_if f takes characters as long as they satisfy the predicate f.

  • since 3.6
val take1_if : ?descr:string -> ( char -> bool ) -> slice t

take1_if f takes characters as long as they satisfy the predicate f. Fails if no character satisfies f.

  • parameter descr

    describes what kind of character was expected, in case of error

  • since 3.6
val char_if : ?descr:string -> ( char -> bool ) -> char t

char_if f parses a character c if f c = true. Fails if the next char does not satisfy f.

  • parameter descr

    describes what kind of character was expected, in case of error

val chars_if : ( char -> bool ) -> string t

chars_if f parses a string of chars that satisfy f. Cannot fail.

val chars1_if : ?descr:string -> ( char -> bool ) -> string t

Like chars_if, but accepts only non-empty strings. chars1_if p fails if the string accepted by chars_if p is empty. chars1_if p is equivalent to take1_if p >|= Slice.to_string.

  • parameter descr

    describes what kind of character was expected, in case of error

val endline : char t

Parse '\n'.

val space : char t

Tab or space.

val white : char t

Tab or space or newline.

val skip_chars : ( char -> bool ) -> unit t

Skip 0 or more chars satisfying the predicate.

val skip_space : unit t

Skip ' ' and '\t'.

val skip_white : unit t

Skip ' ' and '\t' and '\n'.

val is_alpha : char -> bool

Is the char a letter?

val is_num : char -> bool

Is the char a digit?

val is_alpha_num : char -> bool

Is the char a letter or a digit?

val is_space : char -> bool

True on ' ' and '\t'.

val is_white : char -> bool

True on ' ' and '\t' and '\n'.

val suspend : ( unit -> 'a t ) -> 'a t

suspend f is the same as f (), but evaluates f () only when needed.

A practical use case is to implement recursive parsers manually, as described in fix. The parser is let rec p () = …, and suspend p can be used in the definition to use p.

val string : string -> string t

string s parses exactly the string s, and nothing else.

val exact : string -> string t

Alias to string.

  • since 3.6
val many : 'a t -> 'a list t

many p parses p repeatedly, until p fails, and collects the results into a list.

val optional : _ t -> unit t

optional p tries to parse p, and return () whether it succeeded or failed. Cannot fail itself. It consumes input if p succeeded (as much as p consumed), but consumes not input if p failed.

  • since 3.6
val try_ : 'a t -> 'a t

try_ p is just like p (it used to play a role in backtracking semantics but no more).

  • deprecated

    since 3.6 it can just be removed. See try_opt if you want to detect failure.

val try_opt : 'a t -> 'a option t

try_opt p tries to parse using p, and return Some x if p succeeded with x (and consumes what p consumed). Otherwise it returns None and consumes nothing. This cannot fail.

  • since 3.6
val many_until : until:_ t -> 'a t -> 'a list t

many_until ~until p parses as many p as it can until the until parser successfully returns. If p fails before that then many_until ~until p fails as well. Typically until can be a closing ')' or another termination condition, and what is consumed by until is also consumed by many_until ~until p.

EXPERIMENTAL

  • since 3.6
val try_or : 'a t -> f:( 'a -> 'b t ) -> else_:'b t -> 'b t

try_or p1 ~f ~else_:p2 attempts to parse x using p1, and then becomes f x. If p1 fails, then it becomes p2. This can be useful if f is expensive but only ever works if p1 matches (e.g. after an opening parenthesis or some sort of prefix).

  • since 3.6
val try_or_l : ?msg:string -> ?else_:'a t -> (unit t * 'a t) list -> 'a t

try_or_l ?else_ l tries each pair (test, p) in order. If the n-th test succeeds, then try_or_l l behaves like n-th p, whether p fails or not. If test consumes input, the state is restored before calling p. If they all fail, and else_ is defined, then it behaves like else_. If all fail, and else_ is None, then it fails as well.

This is a performance optimization compared to (<|>). We commit to a branch if the test succeeds, without backtracking at all. It can also provide better error messages, because failures in the parser will not be reported as failures in try_or_l.

See lookahead_ignore for a convenient way of writing the test conditions.

  • parameter msg

    error message if all options fail

    EXPERIMENTAL

  • since 3.6
val or_ : 'a t -> 'a t -> 'a t

or_ p1 p2 tries to parse p1, and if it fails, tries p2 from the same position.

  • since 3.6
val both : 'a t -> 'b t -> ('a * 'b) t

both a b parses a, then b, then returns the pair of their results.

  • since 3.6
val many1 : 'a t -> 'a list t

many1 p is like many p excepts it fails if the list is empty (i.e. it needs p to succeed at least once).

val skip : _ t -> unit t

skip p parses zero or more times p and ignores its result. It is eager, meaning it will continue as long as p succeeds. As soon as p fails, skip p stops consuming any input.

val sep : by:_ t -> 'a t -> 'a list t

sep ~by p parses a list of p separated by by.

val sep_until : until:_ t -> by:_ t -> 'a t -> 'a list t

Same as sep but stop when until parses successfully.

  • since 3.6
val sep1 : by:_ t -> 'a t -> 'a list t

sep1 ~by p parses a non empty list of p, separated by by.

val lookahead : 'a t -> 'a t

lookahead p behaves like p, except it doesn't consume any input.

EXPERIMENTAL

  • since 3.6
val lookahead_ignore : 'a t -> unit t

lookahead_ignore p tries to parse input with p, and succeeds if p succeeds. However it doesn't consume any input and returns (), so in effect its only use-case is to detect whether p succeeds, e.g. in try_or_l.

EXPERIMENTAL

  • since 3.6
val fix : ( 'a t -> 'a t ) -> 'a t

Fixpoint combinator. fix (fun self -> p) is the parser p, in which self refers to the parser p itself (which is useful to parse recursive structures.

An alternative, manual implementation to let p = fix (fun self -> q) is:

let rec p () =
+ let self = suspend p in
+ q
val line : slice t

Parse a line, '\n' excluded, and position the cursor after the '\n'.

  • since 3.6
val line_str : string t

line_str is line >|= Slice.to_string. It parses the next line and turns the slice into a string. The state points to the character immediately after the '\n' character.

  • since 3.6
val each_line : 'a t -> 'a list t

each_line p runs p on each line of the input. EXPERIMENTAL

  • since 3.6
val split_1 : on_char:char -> (slice * slice option) t

split_1 ~on_char looks for on_char in the input, and returns a pair sl1, sl2, where:

  • sl1 is the slice of the input the precedes the first occurrence of on_char, or the whole input if on_char cannot be found. It does not contain on_char.
  • sl2 is the slice that comes after on_char, or None if on_char couldn't be found. It doesn't contain the first occurrence of on_char (if any).

The parser is now positioned at the end of the input.

EXPERIMENTAL

  • since 3.6
val split_list : on_char:char -> slice list t

split_list ~on_char splits the input on all occurrences of on_char, returning a list of slices.

EXPERIMENTAL

  • since 3.6
val split_list_at_most : on_char:char -> int -> slice list t

split_list_at_most ~on_char n applies split_1 ~on_char at most n times, to get a list of n+1 elements. The last element might contain on_char. This is useful to limit the amount of work done by split_list.

EXPERIMENTAL

  • since 3.6
val split_2 : on_char:char -> (slice * slice) t

split_2 ~on_char splits the input into exactly 2 fields, and fails if the split yields less or more than 2 items. EXPERIMENTAL

  • since 3.6
val split_3 : on_char:char -> (slice * slice * slice) t

See split_2 EXPERIMENTAL

  • since 3.6
val split_4 : on_char:char -> (slice * slice * slice * slice) t

See split_2 EXPERIMENTAL

  • since 3.6
val each_split : on_char:char -> 'a t -> 'a list t

split_list_map ~on_char p uses split_list ~on_char to split the input, then parses each chunk of the input thus obtained using p.

The difference with sep ~by:(char on_char) p is that sep calls p first, and only tries to find on_char after p returns. While it is more flexible, this technique also means p has to be careful not to consume on_char by error.

A useful specialization of this is each_line, which is basically each_split ~on_char:'\n' p.

EXPERIMENTAL

  • since 3.6
val all : slice t

all returns all the unconsumed input as a slice, and consumes it. Use Slice.to_string to turn it into a string.

Note that lookahead all can be used to peek at the rest of the input without consuming anything.

  • since 3.6
val all_str : string t

all_str accepts all the remaining chars and extracts them into a string. Similar to all but with a string.

EXPERIMENTAL

  • since 3.6
val memo : 'a t -> 'a t

Memoize the parser. memo p will behave like p, but when called in a state (read: position in input) it has already processed, memo p returns a result directly. The implementation uses an underlying hashtable. This can be costly in memory, but improve the run time a lot if there is a lot of backtracking involving p.

Do not call memo inside other functions, especially with (>>=), map, etc. being so prevalent. Instead the correct way to use it is in a toplevel definition:

let my_expensive_parser = memo (foo *> bar >>= fun i -> …)

This function is not thread-safe.

val fix_memo : ( 'a t -> 'a t ) -> 'a t

Like fix, but the fixpoint is memoized.

Infix

module Infix : sig ... end
include module type of Infix
val (>|=) : 'a t -> ( 'a -> 'b ) -> 'b t

Alias to map. p >|= f parses an item x using p, and returns f x.

val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t

Alias to bind. p >>= f results in a new parser which behaves as p then, in case of success, applies f to the result.

val (<*>) : ( 'a -> 'b ) t -> 'a t -> 'b t

Applicative.

val (<*) : 'a t -> _ t -> 'a t

a <* b parses a into x, parses b and ignores its result, and returns x.

val (*>) : _ t -> 'a t -> 'a t

a *> b parses a, then parses b into x, and returns x. The result of a is ignored.

val (<|>) : 'a t -> 'a t -> 'a t

Alias to or_.

a <|> b tries to parse a, and if a fails without consuming any input, backtracks and tries to parse b, otherwise it fails as a.

val (<?>) : 'a t -> string -> 'a t

a <?> msg behaves like a, but if a fails, a <?> msg fails with msg instead. Useful as the last choice in a series of <|>. For example: a <|> b <|> c <?> "expected one of a, b, c".

val (|||) : 'a t -> 'b t -> ('a * 'b) t

Alias to both. a ||| b parses a, then b, then returns the pair of their results.

  • since 3.6

Let operators on OCaml >= 4.08.0, nothing otherwise

  • since 2.8
val let+ : 'a t -> ( 'a -> 'b ) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ( 'a -> 'b t ) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t

Parse input

val stringify_result : 'a or_error -> ( 'a, string ) Stdlib.result

Turn a Error.t-oriented result into a more basic string result.

  • since 3.6
val parse_string : 'a t -> string -> ( 'a, string ) Stdlib.result

Parse a string using the parser.

val parse_string_e : 'a t -> string -> 'a or_error

Version of parse_string that returns a more detailed error.

val parse_string_exn : 'a t -> string -> 'a
  • raises ParseError

    if it fails.

val parse_file : 'a t -> string -> ( 'a, string ) Stdlib.result

parse_file p filename parses file named filename with p by opening the file and reading it whole.

val parse_file_e : 'a t -> string -> 'a or_error

Version of parse_file that returns a more detailed error.

val parse_file_exn : 'a t -> string -> 'a

Same as parse_file, but

  • raises ParseError

    if it fails.

module U : sig ... end
module Debug_ : sig ... end

Debugging utils. EXPERIMENTAL

\ No newline at end of file diff --git a/3.10/containers/CCRandom/.dummy b/3.10/containers/CCRandom/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCRandom/index.html b/3.10/containers/CCRandom/index.html new file mode 100644 index 00000000..aeefe889 --- /dev/null +++ b/3.10/containers/CCRandom/index.html @@ -0,0 +1,17 @@ + +CCRandom (containers.CCRandom)

Module CCRandom

Random Generators

include module type of struct include Stdlib.Random end
val init : int -> unit
val full_init : int array -> unit
val self_init : unit -> unit
val bits : unit -> int
val full_int : int -> int
val int32 : Stdlib.Int32.t -> Stdlib.Int32.t
val nativeint : Stdlib.Nativeint.t -> Stdlib.Nativeint.t
val int64 : Stdlib.Int64.t -> Stdlib.Int64.t
val bool : unit -> bool
val bits32 : unit -> Stdlib.Int32.t
val bits64 : unit -> Stdlib.Int64.t
val nativebits : unit -> Stdlib.Nativeint.t
module State = Stdlib__Random.State
val get_state : unit -> State.t
val set_state : State.t -> unit
type state = Stdlib.Random.State.t
type 'a t = state -> 'a

Random generator for values of type 'a.

type 'a random_gen = 'a t
val return : 'a -> 'a t

return x is the generator that always returns x. Example: let random_int = return 4 (* fair dice roll *).

val flat_map : ( 'a -> 'b t ) -> 'a t -> 'b t

flat_map f g st is f (g st) st.

val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t

Monadic bind.

val map : ( 'a -> 'b ) -> 'a t -> 'b t

map f g st is f (g st).

val (>|=) : 'a t -> ( 'a -> 'b ) -> 'b t
val delay : ( unit -> 'a t ) -> 'a t

Delay evaluation. Useful for side-effectful generators that need some code to run for every call. Example:

let gensym = let r = ref 0 in fun () -> incr r; !r ;;
+
+delay (fun () ->
+  let name = gensym() in
+  small_int >>= fun i -> return (name,i)
+)
  • since 0.4
val choose : 'a t list -> 'a option t

Choose a generator within the list.

val choose_exn : 'a t list -> 'a t

Like choose but without option.

  • raises Invalid_argument

    if the list is empty.

val choose_array : 'a t array -> 'a option t

Choose a generator within the array.

val choose_return : 'a list -> 'a t

Choose among the list.

  • raises Invalid_argument

    if the list is empty.

val replicate : int -> 'a t -> 'a list t

replicate n g makes a list of n elements which are all generated randomly using g.

val sample_without_duplicates : + cmp:( 'a -> 'a -> int ) -> + int -> + 'a t -> + 'a list t

sample_without_replacement n g makes a list of n elements which are all generated randomly using g with the added constraint that none of the generated random values are equal.

  • raises Invalid_argument

    if n <= 0.

  • since 2.4
val list_seq : 'a t list -> 'a list t

Build random lists from lists of random generators.

  • since 0.4
exception Pick_from_empty
  • since 0.16
val pick_list : 'a list -> 'a t

Pick an element at random from the list.

  • raises Pick_from_empty

    if the list is empty.

  • since 0.16
val pick_array : 'a array -> 'a t

Pick an element at random from the array.

  • raises Pick_from_empty

    if the array is empty.

  • since 0.16
val small_int : int t

A small int (100).

val int : int -> int t

Random int within the given range.

val int_range : int -> int -> int t

Inclusive range.

val small_float : float t

A reasonably small float (100.0).

  • since 0.6.1
val float : float -> float t

Random float within the given range.

  • since 0.6.1
val float_range : float -> float -> float t

Inclusive range. float_range a b assumes a < b.

  • since 0.6.1
val split : int -> (int * int) option t

Split a positive value n into n1,n2 where n = n1 + n2.

  • returns

    None if the value is too small.

val split_list : int -> len:int -> int list option t

Split a value n into a list of values whose sum is n and whose length is length. The list is never empty and does not contain 0.

  • raises Invalid_argument

    if len <= 1.

  • returns

    None if the value is too small.

val retry : ?max:int -> 'a option t -> 'a option t

retry g calls g until it returns some value, or until the maximum number of retries was reached. If g fails, then it counts for one iteration, and the generator retries.

  • parameter max:

    maximum number of retries. Default 10.

val try_successively : 'a option t list -> 'a option t

try_successively l tries each generator of l, one after the other. If some generator succeeds its result is returned, else the next generator is tried.

val (<?>) : 'a option t -> 'a option t -> 'a option t

a <?> b is a choice operator. It first tries a, and returns its result if successful. If a fails, then b is returned.

val fix : + ?sub1:( 'a t -> 'a t ) list -> + ?sub2:( 'a t -> 'a t -> 'a t ) list -> + ?subn:(int t * ( 'a list t -> 'a t )) list -> + base:'a t -> + int t -> + 'a t

Recursion combinators, for building recursive values. The integer generator is used to provide fuel. The sub_ generators should use their arguments only once!

  • parameter sub1

    cases that recurse on one value.

  • parameter sub2

    cases that use the recursive gen twice.

  • parameter subn

    cases that use a list of recursive cases.

Applicative
val pure : 'a -> 'a t
val (<*>) : ( 'a -> 'b ) t -> 'a t -> 'b t

Let operators on OCaml >= 4.08.0, nothing otherwise

  • since 2.8
val let+ : 'a t -> ( 'a -> 'b ) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ( 'a -> 'b t ) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t
Run a generator
val run : ?st:state -> 'a t -> 'a

Using a random state (possibly the one in argument) run a generator.

\ No newline at end of file diff --git a/3.10/containers/CCRef/.dummy b/3.10/containers/CCRef/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCRef/index.html b/3.10/containers/CCRef/index.html new file mode 100644 index 00000000..a4b1dcc1 --- /dev/null +++ b/3.10/containers/CCRef/index.html @@ -0,0 +1,2 @@ + +CCRef (containers.CCRef)

Module CCRef

Helpers for references

type 'a printer = Stdlib.Format.formatter -> 'a -> unit
type 'a ord = 'a -> 'a -> int
type 'a eq = 'a -> 'a -> bool
type 'a iter = ( 'a -> unit ) -> unit
type 'a t = 'a Stdlib.ref
val map : ( 'a -> 'b ) -> 'a t -> 'b t

Transform the value.

val create : 'a -> 'a t

Alias to ref.

val iter : ( 'a -> unit ) -> 'a t -> unit

Call the function on the content of the reference.

val update : ( 'a -> 'a ) -> 'a t -> unit

Update the reference's content with the given function.

val incr_then_get : int t -> int

incr_then_get r increments r and returns its new value, think ++r.

  • since 0.17
val get_then_incr : int t -> int

get_then_incr r increments r and returns its old value, think r++.

  • since 0.17
val swap : 'a t -> 'a t -> unit

swap t1 t2 puts !t2 in t1 and !t1 in t2.

  • since 1.4
val protect : 'a t -> 'a -> ( unit -> 'b ) -> 'b

protect r x f sets r := x; calls f(); restores r to its old value; and returns the result of f().

  • since NEXT_RELEASE
val compare : 'a ord -> 'a t ord
val equal : 'a eq -> 'a t eq
val to_list : 'a t -> 'a list
val to_iter : 'a t -> 'a iter
  • since 3.0
val pp : 'a printer -> 'a t printer
\ No newline at end of file diff --git a/3.10/containers/CCResult/.dummy b/3.10/containers/CCResult/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCResult/Infix/index.html b/3.10/containers/CCResult/Infix/index.html new file mode 100644 index 00000000..997b9fe4 --- /dev/null +++ b/3.10/containers/CCResult/Infix/index.html @@ -0,0 +1,2 @@ + +Infix (containers.CCResult.Infix)

Module CCResult.Infix

val (<$>) : ( 'a -> 'b ) -> ( 'a, 'err ) t -> ( 'b, 'err ) t

Infix version of map.

  • since 3.0
val (>|=) : ( 'a, 'err ) t -> ( 'a -> 'b ) -> ( 'b, 'err ) t

Infix version of map with reversed arguments.

val (>>=) : ( 'a, 'err ) t -> ( 'a -> ( 'b, 'err ) t ) -> ( 'b, 'err ) t

Monadic composition. e >>= f proceeds as f x if e is Ok x or returns e if e is an Error.

val (<*>) : ( 'a -> 'b, 'err ) t -> ( 'a, 'err ) t -> ( 'b, 'err ) t

a <*> b evaluates a and b, and, in case of success, returns Ok (a b). Otherwise, it fails, and the error of a is chosen over the error of b if both fail.

val let+ : ( 'a, 'e ) t -> ( 'a -> 'b ) -> ( 'b, 'e ) t
  • since 2.8
val and+ : ( 'a, 'e ) t -> ( 'b, 'e ) t -> ( 'a * 'b, 'e ) t
  • since 2.8
val let* : ( 'a, 'e ) t -> ( 'a -> ( 'b, 'e ) t ) -> ( 'b, 'e ) t
  • since 2.8
val and* : ( 'a, 'e ) t -> ( 'b, 'e ) t -> ( 'a * 'b, 'e ) t
  • since 2.8
\ No newline at end of file diff --git a/3.10/containers/CCResult/Traverse/argument-1-M/index.html b/3.10/containers/CCResult/Traverse/argument-1-M/index.html new file mode 100644 index 00000000..49b7bf94 --- /dev/null +++ b/3.10/containers/CCResult/Traverse/argument-1-M/index.html @@ -0,0 +1,2 @@ + +M (containers.CCResult.Traverse.1-M)

Parameter Traverse.1-M

type 'a t
val return : 'a -> 'a t

Monadic return.

val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t

Monadic bind.

\ No newline at end of file diff --git a/3.10/containers/CCResult/Traverse/index.html b/3.10/containers/CCResult/Traverse/index.html new file mode 100644 index 00000000..18e88a90 --- /dev/null +++ b/3.10/containers/CCResult/Traverse/index.html @@ -0,0 +1,2 @@ + +Traverse (containers.CCResult.Traverse)

Module CCResult.Traverse

Parameters

module M : MONAD

Signature

val sequence_m : ( 'a M.t, 'err ) t -> ( 'a, 'err ) t M.t
val fold_m : ( 'b -> 'a -> 'b M.t ) -> 'b -> ( 'a, 'err ) t -> 'b M.t
val map_m : ( 'a -> 'b M.t ) -> ( 'a, 'err ) t -> ( 'b, 'err ) t M.t
val retry_m : int -> ( unit -> ( 'a, 'err ) t M.t ) -> ( 'a, 'err list ) t M.t
\ No newline at end of file diff --git a/3.10/containers/CCResult/index.html b/3.10/containers/CCResult/index.html new file mode 100644 index 00000000..4ff1b883 --- /dev/null +++ b/3.10/containers/CCResult/index.html @@ -0,0 +1,17 @@ + +CCResult (containers.CCResult)

Module CCResult

Error Monad

Uses the new "result" type from OCaml 4.03.

type 'a iter = ( 'a -> unit ) -> unit

Fast internal iterator.

  • since 2.8
type 'a equal = 'a -> 'a -> bool
type 'a ord = 'a -> 'a -> int
type 'a printer = Stdlib.Format.formatter -> 'a -> unit

Basics

type nonrec (+'good, +'bad) result = ( 'good, 'bad ) Stdlib.result =
| Ok of 'good
| Error of 'bad
type (+'good, +'bad) t = ( 'good, 'bad ) result =
| Ok of 'good
| Error of 'bad
val return : 'a -> ( 'a, 'err ) t

Successfully return a value.

val fail : 'err -> ( 'a, 'err ) t

Fail with an error.

val of_exn : exn -> ( 'a, string ) t

of_exn e uses Printexc to print the exception as a string.

val of_exn_trace : exn -> ( 'a, string ) t

of_exn_trace e is similar to of_exn e, but it adds the stacktrace to the error message.

Remember to call Printexc.record_backtrace true and compile with the debug flag for this to work.

val fail_printf : + ( 'a, Stdlib.Buffer.t, unit, ( 'b, string ) t ) Stdlib.format4 -> + 'a

fail_printf format uses format to obtain an error message and then returns Error msg.

val fail_fprintf : + ( 'a, Stdlib.Format.formatter, unit, ( 'b, string ) t ) Stdlib.format4 -> + 'a

fail_fprintf format uses format to obtain an error message and then returns Error msg.

val add_ctx : string -> ( 'a, string ) t -> ( 'a, string ) t

add_ctx msg leaves Ok x untouched, but transforms Error s into Error s' where s' contains the additional context given by msg.

  • since 1.2
val add_ctxf : + ( 'a, Stdlib.Format.formatter, unit, ( 'b, string ) t -> ( 'b, string ) t ) + Stdlib.format4 -> + 'a

add_ctxf format_message is similar to add_ctx but with Format for printing the message (eagerly). Example:

add_ctxf "message(number %d, foo: %B)" 42 true (Error "error)"
  • since 1.2
val opt_map : ( 'a -> ( 'b, 'c ) t ) -> 'a option -> ( 'b option, 'c ) t

Map a fallible operation through an option.

  • since 3.7
val map : ( 'a -> 'b ) -> ( 'a, 'err ) t -> ( 'b, 'err ) t

Map on success.

val map_err : ( 'err1 -> 'err2 ) -> ( 'a, 'err1 ) t -> ( 'a, 'err2 ) t

Map on the error variant.

val map2 : + ( 'a -> 'b ) -> + ( 'err1 -> 'err2 ) -> + ( 'a, 'err1 ) t -> + ( 'b, 'err2 ) t

Like map, but also with a function that can transform the error message in case of failure.

val iter : ( 'a -> unit ) -> ( 'a, _ ) t -> unit

Apply the function only in case of Ok.

val iter_err : ( 'err -> unit ) -> ( _, 'err ) t -> unit

Apply the function in case of Error.

  • since 2.4
exception Get_error
val get_exn : ( 'a, _ ) t -> 'a

Extract the value x from Ok x, fails otherwise. You should be careful with this function, and favor other combinators whenever possible.

  • raises Get_error

    if the value is an error.

val get_or : ( 'a, _ ) t -> default:'a -> 'a

get_or e ~default returns x if e = Ok x, default otherwise.

val get_or_failwith : ( 'a, string ) t -> 'a

get_or_failwith e returns x if e = Ok x, fails otherwise.

  • raises Failure

    with msg if e = Error msg.

  • since 2.4
val get_lazy : ( 'b -> 'a ) -> ( 'a, 'b ) t -> 'a

get_lazy default_fn x unwraps x, but if x = Error e it returns default_fr e instead.

  • since 3.0
val map_or : ( 'a -> 'b ) -> ( 'a, 'c ) t -> default:'b -> 'b

map_or f e ~default returns f x if e = Ok x, default otherwise.

val catch : ( 'a, 'err ) t -> ok:( 'a -> 'b ) -> err:( 'err -> 'b ) -> 'b

catch e ~ok ~err calls either ok or err depending on the value of e.

val flat_map : ( 'a -> ( 'b, 'err ) t ) -> ( 'a, 'err ) t -> ( 'b, 'err ) t
val equal : err:'err equal -> 'a equal -> ( 'a, 'err ) t equal
val compare : err:'err ord -> 'a ord -> ( 'a, 'err ) t ord
val fold : ok:( 'a -> 'b ) -> error:( 'err -> 'b ) -> ( 'a, 'err ) t -> 'b

fold ~ok ~error e opens e and, if e = Ok x, returns ok x, otherwise e = Error s and it returns error s.

val fold_ok : ( 'a -> 'b -> 'a ) -> 'a -> ( 'b, _ ) t -> 'a

fold_ok f acc r will compute f acc x if r=Ok x, and return acc otherwise, as if the result were a mere option.

  • since 1.2
val is_ok : ( 'a, 'err ) t -> bool

Return true if Ok.

  • since 1.0
val is_error : ( 'a, 'err ) t -> bool

Return true if Error.

  • since 1.0

Wrappers

val guard : ( unit -> 'a ) -> ( 'a, exn ) t

guard f runs f () and returns its result wrapped in Ok. If f () raises some exception e, then it fails with Error e.

val guard_str : ( unit -> 'a ) -> ( 'a, string ) t

Like guard but uses of_exn to print the exception.

val guard_str_trace : ( unit -> 'a ) -> ( 'a, string ) t

Like guard_str but uses of_exn_trace instead of of_exn so that the stack trace is printed.

val wrap1 : ( 'a -> 'b ) -> 'a -> ( 'b, exn ) t

Like guard but gives the function one argument.

val wrap2 : ( 'a -> 'b -> 'c ) -> 'a -> 'b -> ( 'c, exn ) t

Like guard but gives the function two arguments.

val wrap3 : ( 'a -> 'b -> 'c -> 'd ) -> 'a -> 'b -> 'c -> ( 'd, exn ) t

Like guard but gives the function three arguments.

Applicative

val pure : 'a -> ( 'a, 'err ) t

Synonym of return.

val join : ( ( 'a, 'err ) t, 'err ) t -> ( 'a, 'err ) t

join t, in case of success, returns Ok o from Ok (Ok o). Otherwise, it fails with Error e where e is the unwrapped error of t.

val both : ( 'a, 'err ) t -> ( 'b, 'err ) t -> ( 'a * 'b, 'err ) t

both a b, in case of success, returns Ok (o, o') with the ok values of a and b. Otherwise, it fails, and the error of a is chosen over the error of b if both fail.

Infix

module Infix : sig ... end
include module type of Infix
val (<$>) : ( 'a -> 'b ) -> ( 'a, 'err ) t -> ( 'b, 'err ) t

Infix version of map.

  • since 3.0
val (>|=) : ( 'a, 'err ) t -> ( 'a -> 'b ) -> ( 'b, 'err ) t

Infix version of map with reversed arguments.

val (>>=) : ( 'a, 'err ) t -> ( 'a -> ( 'b, 'err ) t ) -> ( 'b, 'err ) t

Monadic composition. e >>= f proceeds as f x if e is Ok x or returns e if e is an Error.

val (<*>) : ( 'a -> 'b, 'err ) t -> ( 'a, 'err ) t -> ( 'b, 'err ) t

a <*> b evaluates a and b, and, in case of success, returns Ok (a b). Otherwise, it fails, and the error of a is chosen over the error of b if both fail.

val let+ : ( 'a, 'e ) t -> ( 'a -> 'b ) -> ( 'b, 'e ) t
  • since 2.8
val and+ : ( 'a, 'e ) t -> ( 'b, 'e ) t -> ( 'a * 'b, 'e ) t
  • since 2.8
val let* : ( 'a, 'e ) t -> ( 'a -> ( 'b, 'e ) t ) -> ( 'b, 'e ) t
  • since 2.8
val and* : ( 'a, 'e ) t -> ( 'b, 'e ) t -> ( 'a * 'b, 'e ) t
  • since 2.8

Collections

val flatten_l : ( 'a, 'err ) t list -> ( 'a list, 'err ) t

Same as map_l id: returns Ok [x1;…;xn] if l=[Ok x1; …; Ok xn], or the first error otherwise.

  • since 2.7
val map_l : ( 'a -> ( 'b, 'err ) t ) -> 'a list -> ( 'b list, 'err ) t

map_l f [a1; …; an] applies the function f to a1, …, an ,and, in case of success for every element, returns the list of Ok-value. Otherwise, it fails and returns the first error encountered. Tail-recursive.

val fold_l : ( 'b -> 'a -> ( 'b, 'err ) t ) -> 'b -> 'a list -> ( 'b, 'err ) t
val fold_iter : + ( 'b -> 'a -> ( 'b, 'err ) t ) -> + 'b -> + 'a iter -> + ( 'b, 'err ) t
  • since 3.0

Misc

val choose : ( 'a, 'err ) t list -> ( 'a, 'err list ) t

choose l selects a member of l that is a Ok _ value, or returns Error l otherwise, where l is the list of errors.

val retry : int -> ( unit -> ( 'a, 'err ) t ) -> ( 'a, 'err list ) t

retry n f calls f at most n times, returning the first result of f () that doesn't fail. If f fails n times, retry n f fails with the list of successive errors.

module type MONAD = sig ... end
module Traverse (M : MONAD) : sig ... end

Conversions

val to_opt : ( 'a, _ ) t -> 'a option

Convert a result to an option.

val of_opt : 'a option -> ( 'a, string ) t

of_opt opt converts Some v to Ok v and None to Error "of_opt".

val to_iter : ( 'a, _ ) t -> 'a iter
  • since 2.8
val to_seq : ( 'a, _ ) t -> 'a Stdlib.Seq.t

Renamed from to_std_seq since 3.0.

  • since 3.0
type ('a, 'b) error = [
| `Ok of 'a
| `Error of 'b
]
val of_err : ( 'a, 'b ) error -> ( 'a, 'b ) t
  • since 0.17
val to_err : ( 'a, 'b ) t -> ( 'a, 'b ) error
  • since 0.17

IO

val pp : 'a printer -> ( 'a, string ) t printer
val pp' : 'a printer -> 'e printer -> ( 'a, 'e ) t printer

Printer that is generic on the error type.

\ No newline at end of file diff --git a/3.10/containers/CCResult/module-type-MONAD/index.html b/3.10/containers/CCResult/module-type-MONAD/index.html new file mode 100644 index 00000000..b6c9e11c --- /dev/null +++ b/3.10/containers/CCResult/module-type-MONAD/index.html @@ -0,0 +1,2 @@ + +MONAD (containers.CCResult.MONAD)

Module type CCResult.MONAD

Monadic Operations

type 'a t
val return : 'a -> 'a t

Monadic return.

val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t

Monadic bind.

\ No newline at end of file diff --git a/3.10/containers/CCSeq/.dummy b/3.10/containers/CCSeq/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCSeq/Infix/index.html b/3.10/containers/CCSeq/Infix/index.html new file mode 100644 index 00000000..673bf9a8 --- /dev/null +++ b/3.10/containers/CCSeq/Infix/index.html @@ -0,0 +1,2 @@ + +Infix (containers.CCSeq.Infix)

Module CCSeq.Infix

val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t
val (>|=) : 'a t -> ( 'a -> 'b ) -> 'b t
val (<*>) : ( 'a -> 'b ) t -> 'a t -> 'b t
val (>>-) : 'a t -> ( 'a -> 'b t ) -> 'b t
val (<.>) : ( 'a -> 'b ) t -> 'a t -> 'b t
val (--) : int -> int -> int t
val (--^) : int -> int -> int t
\ No newline at end of file diff --git a/3.10/containers/CCSeq/Traverse/argument-1-M/index.html b/3.10/containers/CCSeq/Traverse/argument-1-M/index.html new file mode 100644 index 00000000..374d4eed --- /dev/null +++ b/3.10/containers/CCSeq/Traverse/argument-1-M/index.html @@ -0,0 +1,2 @@ + +M (containers.CCSeq.Traverse.1-M)

Parameter Traverse.1-M

type 'a t
val return : 'a -> 'a t
val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t
\ No newline at end of file diff --git a/3.10/containers/CCSeq/Traverse/index.html b/3.10/containers/CCSeq/Traverse/index.html new file mode 100644 index 00000000..1161e175 --- /dev/null +++ b/3.10/containers/CCSeq/Traverse/index.html @@ -0,0 +1,2 @@ + +Traverse (containers.CCSeq.Traverse)

Module CCSeq.Traverse

Parameters

module M : MONAD

Signature

val sequence_m : 'a M.t t -> 'a t M.t
val fold_m : ( 'b -> 'a -> 'b M.t ) -> 'b -> 'a t -> 'b M.t
val map_m : ( 'a -> 'b M.t ) -> 'a t -> 'b t M.t
\ No newline at end of file diff --git a/3.10/containers/CCSeq/index.html b/3.10/containers/CCSeq/index.html new file mode 100644 index 00000000..d3f85209 --- /dev/null +++ b/3.10/containers/CCSeq/index.html @@ -0,0 +1,7 @@ + +CCSeq (containers.CCSeq)

Module CCSeq

Helpers for the standard Seq type

See oseq for a richer API.

type 'a iter = ( 'a -> unit ) -> unit
type 'a gen = unit -> 'a option
type 'a equal = 'a -> 'a -> bool
type 'a ord = 'a -> 'a -> int
type 'a printer = Stdlib.Format.formatter -> 'a -> unit

Basics

include module type of Stdlib.Seq
type !'a t = unit -> 'a node
and !'a node = 'a Stdlib__Seq.node =
| Nil
| Cons of 'a * 'a t
exception Forced_twice
val once : 'a t -> 'a t
val transpose : 'a t t -> 'a t t
val partition_map : ( 'a -> ( 'b, 'c ) Stdlib.Either.t ) -> 'a t -> 'b t * 'c t
val partition : ( 'a -> bool ) -> 'a t -> 'a t * 'a t
val of_dispenser : ( unit -> 'a option ) -> 'a t
val to_dispenser : 'a t -> unit -> 'a option
val ints : int -> int t
val nil : 'a t
val empty : 'a t
val cons : 'a -> 'a t -> 'a t
val singleton : 'a -> 'a t
val init : int -> ( int -> 'a ) -> 'a t

init n f corresponds to the sequence f 0; f 1; ...; f (n-1).

  • raises Invalid_argument

    if n is negative.

  • since NEXT_RELEASE
val repeat : ?n:int -> 'a -> 'a t

repeat ~n x repeats x n times then stops. If n is omitted, then x is repeated forever.

val forever : ( unit -> 'a ) -> 'a t

forever f corresponds to the infinit sequence containing all the f ().

  • since NEXT_RELEASE
val cycle : 'a t -> 'a t

Cycle through the iterator infinitely. The iterator shouldn't be empty.

val iterate : ( 'a -> 'a ) -> 'a -> 'a t

iterate f a corresponds to the infinit sequence containing a, f a, f (f a), ...]

  • since NEXT_RELEASE
val unfold : ( 'b -> ('a * 'b) option ) -> 'b -> 'a t

unfold f acc calls f acc and:

  • if f acc = Some (x, acc'), yield x, continue with unfold f acc'.
  • if f acc = None, stops.
val is_empty : 'a t -> bool

is_empty xs checks in the sequence xs is empty

val head : 'a t -> 'a option

Head of the list.

val head_exn : 'a t -> 'a

Unsafe version of head.

  • raises Not_found

    if the list is empty.

val tail : 'a t -> 'a t option

Tail of the list.

val tail_exn : 'a t -> 'a t

Unsafe version of tail.

  • raises Not_found

    if the list is empty.

val uncons : 'a t -> ('a * 'a t) option

uncons xs return None if xs is empty other

  • since NEXT_RELEASE
val equal : 'a equal -> 'a t equal

Equality step by step. Eager.

val compare : 'a ord -> 'a t ord

Lexicographic comparison. Eager.

val fold : ( 'a -> 'b -> 'a ) -> 'a -> 'b t -> 'a

Fold on values.

val fold_left : ( 'a -> 'b -> 'a ) -> 'a -> 'b t -> 'a

Alias for fold

val foldi : ( 'a -> int -> 'b -> 'a ) -> 'a -> 'b t -> 'a

fold_lefti f init xs applies f acc i x where acc is the result of the previous computation or init for the first one, i is the index in the sequence (starts at 0) and x is the element of the sequence.

  • since NEXT_RELEASE
val fold_lefti : ( 'a -> int -> 'b -> 'a ) -> 'a -> 'b t -> 'a

Alias of foldi.

  • since NEXT_RELEASE
val iter : ( 'a -> unit ) -> 'a t -> unit
val iteri : ( int -> 'a -> unit ) -> 'a t -> unit

Iterate with index (starts at 0).

val length : _ t -> int

Number of elements in the list. Will not terminate if the list if infinite: use (for instance) take to make the list finite if necessary.

val take : int -> 'a t -> 'a t
val take_while : ( 'a -> bool ) -> 'a t -> 'a t
val drop : int -> 'a t -> 'a t
val drop_while : ( 'a -> bool ) -> 'a t -> 'a t
val map : ( 'a -> 'b ) -> 'a t -> 'b t
val mapi : ( int -> 'a -> 'b ) -> 'a t -> 'b t

Map with index (starts at 0).

val fmap : ( 'a -> 'b option ) -> 'a t -> 'b t
val filter : ( 'a -> bool ) -> 'a t -> 'a t
val append : 'a t -> 'a t -> 'a t
val product_with : ( 'a -> 'b -> 'c ) -> 'a t -> 'b t -> 'c t

Fair product of two (possibly infinite) lists into a new list. Lazy. The first parameter is used to combine each pair of elements.

val map_product : ( 'a -> 'b -> 'c ) -> 'a t -> 'b t -> 'c t

Alias of product_with.

  • since NEXT_RELEASE
val product : 'a t -> 'b t -> ('a * 'b) t

Specialization of product_with producing tuples.

val group : 'a equal -> 'a t -> 'a t t

group eq l groups together consecutive elements that satisfy eq. Lazy. For instance group (=) [1;1;1;2;2;3;3;1] yields [1;1;1]; [2;2]; [3;3]; [1].

val uniq : 'a equal -> 'a t -> 'a t

uniq eq l returns l but removes consecutive duplicates. Lazy. In other words, if several values that are equal follow one another, only the first of them is kept.

val for_all : ( 'a -> bool ) -> 'a t -> bool

for_all p [a1; ...; an] checks if all elements of the sequence satisfy the predicate p. That is, it returns (p a1) && ... && (p an) for a non-empty list and true if the sequence is empty. It consumes the sequence until it finds an element not satisfying the predicate.

  • since 3.3
val exists : ( 'a -> bool ) -> 'a t -> bool

exists p [a1; ...; an] checks if at least one element of the sequence satisfies the predicate p. That is, it returns (p a1) || ... || (p an) for a non-empty sequence and false if the list is empty. It consumes the sequence until it finds an element satisfying the predicate.

  • since 3.3
val find : ( 'a -> bool ) -> 'a t -> 'a option

find p [a1; ...; an] return Some ai for the first ai satisfying the predicate p and return None otherwise.

  • since NEXT_RELEASE
val find_map : ( 'a -> 'b option ) -> 'a t -> 'b option

find f [a1; ...; an] return Some (f ai) for the first ai such that f ai = Some _ and return None otherwise.

  • since NEXT_RELEASE
val scan : ( 'a -> 'b -> 'a ) -> 'a -> 'b t -> 'a t

scan f init xs is the sequence containing the intermediate result of fold f init xs.

  • since NEXT_RELEASE
val flat_map : ( 'a -> 'b t ) -> 'a t -> 'b t
val concat_map : ( 'a -> 'b t ) -> 'a t -> 'b t

Aliass of flat_map

  • since NEXT_RELEASE
val filter_map : ( 'a -> 'b option ) -> 'a t -> 'b t
val flatten : 'a t t -> 'a t
val concat : 'a t t -> 'a t

Alias of flatten.

  • since NEXT_RELEASE
val range : int -> int -> int t
val (--) : int -> int -> int t

a -- b is the range of integers containing a and b (therefore, never empty).

val (--^) : int -> int -> int t

a -- b is the integer range from a to b, where b is excluded.

Operations on two Collections

val fold2 : ( 'acc -> 'a -> 'b -> 'acc ) -> 'acc -> 'a t -> 'b t -> 'acc

Fold on two collections at once. Stop at soon as one of them ends.

val fold_left2 : ( 'acc -> 'a -> 'b -> 'acc ) -> 'acc -> 'a t -> 'b t -> 'acc

Alias for fold2.

  • since NEXT_RELEASE
val map2 : ( 'a -> 'b -> 'c ) -> 'a t -> 'b t -> 'c t

Map on two collections at once. Stop as soon as one of the arguments is exhausted.

val iter2 : ( 'a -> 'b -> unit ) -> 'a t -> 'b t -> unit

Iterate on two collections at once. Stop as soon as one of them ends.

val for_all2 : ( 'a -> 'b -> bool ) -> 'a t -> 'b t -> bool
val exists2 : ( 'a -> 'b -> bool ) -> 'a t -> 'b t -> bool
val merge : 'a ord -> 'a t -> 'a t -> 'a t

Merge two sorted iterators into a sorted iterator.

val sorted_merge : 'a ord -> 'a t -> 'a t -> 'a t

Alias of merge.

  • since NEXT_RELEASE
val zip : 'a t -> 'b t -> ('a * 'b) t

Combine elements pairwise. Stop as soon as one of the lists stops.

val unzip : ('a * 'b) t -> 'a t * 'b t

Split each tuple in the list.

val split : ('a * 'b) t -> 'a t * 'b t

Alias of unzip.

  • since NEXT_RELEASE
val zip_i : 'a t -> (int * 'a) t

zip_i seq zips the index of each element with the element itself.

  • since 3.8

Misc

val sort : cmp:'a ord -> 'a t -> 'a t

Eager sort. Require the iterator to be finite. O(n ln(n)) time and space.

val sort_uniq : cmp:'a ord -> 'a t -> 'a t

Eager sort that removes duplicate values. Require the iterator to be finite. O(n ln(n)) time and space.

val memoize : 'a t -> 'a t

Avoid recomputations by caching intermediate results.

Fair Combinations

val interleave : 'a t -> 'a t -> 'a t

Fair interleaving of both streams.

val fair_flat_map : ( 'a -> 'b t ) -> 'a t -> 'b t

Fair version of flat_map.

val fair_app : ( 'a -> 'b ) t -> 'a t -> 'b t

Fair version of (<*>).

Implementations

val return : 'a -> 'a t
val pure : 'a -> 'a t
val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t
val (>|=) : 'a t -> ( 'a -> 'b ) -> 'b t
val (<*>) : ( 'a -> 'b ) t -> 'a t -> 'b t
val (>>-) : 'a t -> ( 'a -> 'b t ) -> 'b t

Infix version of fair_flat_map.

val (<.>) : ( 'a -> 'b ) t -> 'a t -> 'b t

Infix version of fair_app.

Infix operators

module Infix : sig ... end
module type MONAD = sig ... end
module Traverse (M : MONAD) : sig ... end

Conversions

val of_list : 'a list -> 'a t
val to_list : 'a t -> 'a list

Gather all values into a list.

val of_array : 'a array -> 'a t

Iterate on the array.

val to_array : 'a t -> 'a array

Convert into array.

val to_rev_list : 'a t -> 'a list

Convert to a list, in reverse order. More efficient than to_list.

val to_iter : 'a t -> 'a iter
val to_gen : 'a t -> 'a gen
val of_gen : 'a gen -> 'a t

of_gen g consumes the generator and caches intermediate results.

val of_string : string -> char t

Iterate on characters.

  • since 3.7

IO

val pp : + ?pp_start:unit printer -> + ?pp_stop:unit printer -> + ?pp_sep:unit printer -> + 'a printer -> + 'a t printer

pp ~pp_start ~pp_stop ~pp_sep pp_item ppf s formats the sequence s on ppf. Each element is formatted with pp_item, pp_start is called at the beginning, pp_stop is called at the end, pp_sep is called between each elements. By defaults pp_start and pp_stop does nothing and pp_sep defaults to (fun out -> Format.fprintf out ",@ ").

\ No newline at end of file diff --git a/3.10/containers/CCSeq/module-type-MONAD/index.html b/3.10/containers/CCSeq/module-type-MONAD/index.html new file mode 100644 index 00000000..7ef5a853 --- /dev/null +++ b/3.10/containers/CCSeq/module-type-MONAD/index.html @@ -0,0 +1,2 @@ + +MONAD (containers.CCSeq.MONAD)

Module type CCSeq.MONAD

Monadic Operations

type 'a t
val return : 'a -> 'a t
val (>>=) : 'a t -> ( 'a -> 'b t ) -> 'b t
\ No newline at end of file diff --git a/3.10/containers/CCSet/.dummy b/3.10/containers/CCSet/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCSet/Make/index.html b/3.10/containers/CCSet/Make/index.html new file mode 100644 index 00000000..502d7311 --- /dev/null +++ b/3.10/containers/CCSet/Make/index.html @@ -0,0 +1,13 @@ + +Make (containers.CCSet.Make)

Module CCSet.Make

Parameters

module O : Stdlib.Set.OrderedType

Signature

include Stdlib.Set.S with type t = Stdlib.Set.Make(O).t with type elt = O.t
type elt = O.t
type t = Stdlib.Set.Make(O).t
val empty : t
val is_empty : t -> bool
val mem : elt -> t -> bool
val add : elt -> t -> t
val singleton : elt -> t
val remove : elt -> t -> t
val union : t -> t -> t
val inter : t -> t -> t
val disjoint : t -> t -> bool
val diff : t -> t -> t
val compare : t -> t -> int
val equal : t -> t -> bool
val subset : t -> t -> bool
val iter : ( elt -> unit ) -> t -> unit
val map : ( elt -> elt ) -> t -> t
val fold : ( elt -> 'a -> 'a ) -> t -> 'a -> 'a
val for_all : ( elt -> bool ) -> t -> bool
val exists : ( elt -> bool ) -> t -> bool
val filter : ( elt -> bool ) -> t -> t
val filter_map : ( elt -> elt option ) -> t -> t
val partition : ( elt -> bool ) -> t -> t * t
val cardinal : t -> int
val elements : t -> elt list
val min_elt : t -> elt
val max_elt : t -> elt
val choose : t -> elt
val split : elt -> t -> t * bool * t
val find : elt -> t -> elt
val of_list : elt list -> t
val to_seq_from : elt -> t -> elt Stdlib.Seq.t
val to_seq : t -> elt Stdlib.Seq.t
val to_rev_seq : t -> elt Stdlib.Seq.t
val min_elt_opt : t -> elt option

Safe version of min_elt.

  • since 1.5
val max_elt_opt : t -> elt option

Safe version of max_elt.

  • since 1.5
val choose_opt : t -> elt option

Safe version of choose.

  • since 1.5
val find_opt : elt -> t -> elt option

Safe version of find.

  • since 1.5
val find_first : ( elt -> bool ) -> t -> elt

Find minimum element satisfying predicate.

  • since 1.5
val find_first_opt : ( elt -> bool ) -> t -> elt option

Safe version of find_first.

  • since 1.5
val find_last : ( elt -> bool ) -> t -> elt

Find maximum element satisfying predicate.

  • since 1.5
val find_last_opt : ( elt -> bool ) -> t -> elt option

Safe version of find_last.

  • since 1.5
val of_iter : elt iter -> t

Build a set from the given iter of elements.

  • since 2.8
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given seq of elements.

  • since 3.0
val add_iter : t -> elt iter -> t
  • since 2.8
val add_seq : elt Stdlib.Seq.t -> t -> t
  • since 3.0
val to_iter : t -> elt iter

to_iter t converts the set t to a iter of the elements.

  • since 2.8
val add_list : t -> elt list -> t
  • since 0.14
val to_list : t -> elt list

to_list t converts the set t to a list of the elements.

val to_string : + ?start:string -> + ?stop:string -> + ?sep:string -> + ( elt -> string ) -> + t -> + string

Print the set in a string

  • since 2.7
val pp : + ?pp_start:unit printer -> + ?pp_stop:unit printer -> + ?pp_sep:unit printer -> + elt printer -> + t printer

Print the set.

\ No newline at end of file diff --git a/3.10/containers/CCSet/index.html b/3.10/containers/CCSet/index.html new file mode 100644 index 00000000..2f186499 --- /dev/null +++ b/3.10/containers/CCSet/index.html @@ -0,0 +1,4 @@ + +CCSet (containers.CCSet)

Module CCSet

Wrapper around Set

type 'a iter = ( 'a -> unit ) -> unit

Fast internal iterator.

  • since 2.8
type 'a printer = Stdlib.Format.formatter -> 'a -> unit
module type OrderedType = Stdlib.Set.OrderedType
module type S = sig ... end
module Make + (O : Stdlib.Set.OrderedType) : + S with type t = Stdlib.Set.Make(O).t and type elt = O.t
\ No newline at end of file diff --git a/3.10/containers/CCSet/module-type-S/index.html b/3.10/containers/CCSet/module-type-S/index.html new file mode 100644 index 00000000..5d9f051e --- /dev/null +++ b/3.10/containers/CCSet/module-type-S/index.html @@ -0,0 +1,13 @@ + +S (containers.CCSet.S)

Module type CCSet.S

include Stdlib.Set.S
type elt
type t
val empty : t
val is_empty : t -> bool
val mem : elt -> t -> bool
val add : elt -> t -> t
val singleton : elt -> t
val remove : elt -> t -> t
val union : t -> t -> t
val inter : t -> t -> t
val disjoint : t -> t -> bool
val diff : t -> t -> t
val compare : t -> t -> int
val equal : t -> t -> bool
val subset : t -> t -> bool
val iter : ( elt -> unit ) -> t -> unit
val map : ( elt -> elt ) -> t -> t
val fold : ( elt -> 'a -> 'a ) -> t -> 'a -> 'a
val for_all : ( elt -> bool ) -> t -> bool
val exists : ( elt -> bool ) -> t -> bool
val filter : ( elt -> bool ) -> t -> t
val filter_map : ( elt -> elt option ) -> t -> t
val partition : ( elt -> bool ) -> t -> t * t
val cardinal : t -> int
val elements : t -> elt list
val min_elt : t -> elt
val max_elt : t -> elt
val choose : t -> elt
val split : elt -> t -> t * bool * t
val find : elt -> t -> elt
val of_list : elt list -> t
val to_seq_from : elt -> t -> elt Stdlib.Seq.t
val to_seq : t -> elt Stdlib.Seq.t
val to_rev_seq : t -> elt Stdlib.Seq.t
val min_elt_opt : t -> elt option

Safe version of min_elt.

  • since 1.5
val max_elt_opt : t -> elt option

Safe version of max_elt.

  • since 1.5
val choose_opt : t -> elt option

Safe version of choose.

  • since 1.5
val find_opt : elt -> t -> elt option

Safe version of find.

  • since 1.5
val find_first : ( elt -> bool ) -> t -> elt

Find minimum element satisfying predicate.

  • since 1.5
val find_first_opt : ( elt -> bool ) -> t -> elt option

Safe version of find_first.

  • since 1.5
val find_last : ( elt -> bool ) -> t -> elt

Find maximum element satisfying predicate.

  • since 1.5
val find_last_opt : ( elt -> bool ) -> t -> elt option

Safe version of find_last.

  • since 1.5
val of_iter : elt iter -> t

Build a set from the given iter of elements.

  • since 2.8
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given seq of elements.

  • since 3.0
val add_iter : t -> elt iter -> t
  • since 2.8
val add_seq : elt Stdlib.Seq.t -> t -> t
  • since 3.0
val to_iter : t -> elt iter

to_iter t converts the set t to a iter of the elements.

  • since 2.8
val add_list : t -> elt list -> t
  • since 0.14
val to_list : t -> elt list

to_list t converts the set t to a list of the elements.

val to_string : + ?start:string -> + ?stop:string -> + ?sep:string -> + ( elt -> string ) -> + t -> + string

Print the set in a string

  • since 2.7
val pp : + ?pp_start:unit printer -> + ?pp_stop:unit printer -> + ?pp_sep:unit printer -> + elt printer -> + t printer

Print the set.

\ No newline at end of file diff --git a/3.10/containers/CCSexp/.dummy b/3.10/containers/CCSexp/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCSexp/Decoder/index.html b/3.10/containers/CCSexp/Decoder/index.html new file mode 100644 index 00000000..19d3b6be --- /dev/null +++ b/3.10/containers/CCSexp/Decoder/index.html @@ -0,0 +1,2 @@ + +Decoder (containers.CCSexp.Decoder)

Module CCSexp.Decoder

type t

Decoder

val of_lexbuf : Stdlib.Lexing.lexbuf -> t
val next : t -> sexp parse_result

Parse the next S-expression or return an error if the input isn't long enough or isn't a proper S-expression.

val to_list : t -> sexp list CCSexp_intf.or_error

Read all the values from this decoder.

  • since 2.8
val last_loc : t -> loc option

Last location for the decoder. In particular, after calling next, this gives the location of the last token used in the result, which is useful in case of error.

  • since 3.3
\ No newline at end of file diff --git a/3.10/containers/CCSexp/Make/Decoder/index.html b/3.10/containers/CCSexp/Make/Decoder/index.html new file mode 100644 index 00000000..28523306 --- /dev/null +++ b/3.10/containers/CCSexp/Make/Decoder/index.html @@ -0,0 +1,2 @@ + +Decoder (containers.CCSexp.Make.Decoder)

Module Make.Decoder

type t

Decoder

val of_lexbuf : Stdlib.Lexing.lexbuf -> t
val next : t -> sexp parse_result

Parse the next S-expression or return an error if the input isn't long enough or isn't a proper S-expression.

val to_list : t -> sexp list CCSexp_intf.or_error

Read all the values from this decoder.

  • since 2.8
val last_loc : t -> loc option

Last location for the decoder. In particular, after calling next, this gives the location of the last token used in the result, which is useful in case of error.

  • since 3.3
\ No newline at end of file diff --git a/3.10/containers/CCSexp/Make/argument-1-Sexp/index.html b/3.10/containers/CCSexp/Make/argument-1-Sexp/index.html new file mode 100644 index 00000000..0118101b --- /dev/null +++ b/3.10/containers/CCSexp/Make/argument-1-Sexp/index.html @@ -0,0 +1,2 @@ + +Sexp (containers.CCSexp.Make.1-Sexp)

Parameter Make.1-Sexp

include CCSexp_intf.BASIC_SEXP
type t
val atom : string -> t
val list : t list -> t
val match_ : t -> atom:( string -> 'a ) -> list:( t list -> 'a ) -> 'a
type loc
val make_loc : ( (int * int) -> (int * int) -> string -> loc ) option

If provided, builds a location from a pair of (line,column) positions, and a (possibly dummy) filename

val atom_with_loc : loc:loc -> string -> t
val list_with_loc : loc:loc -> t list -> t
\ No newline at end of file diff --git a/3.10/containers/CCSexp/Make/index.html b/3.10/containers/CCSexp/Make/index.html new file mode 100644 index 00000000..fb7cc0bb --- /dev/null +++ b/3.10/containers/CCSexp/Make/index.html @@ -0,0 +1,4 @@ + +Make (containers.CCSexp.Make)

Module CCSexp.Make

Functorized operations

This builds a parser and printer for S-expressions represented as in the Sexp argument.

Parameters

module Sexp : SEXP

Signature

include CCSexp_intf.S0 with type t = Sexp.t
type t = Sexp.t
type sexp = t

Re-exports

val atom : string -> t

Make an atom out of this string.

  • since 2.8
val list : t list -> t

Make a Sexpr of this list.

  • since 2.8

Constructors

val of_int : int -> t
val of_bool : bool -> t
val of_list : t list -> t
val of_rev_list : t list -> t

Reverse the list.

val of_float : float -> t
val of_unit : t
val of_pair : (t * t) -> t
val of_triple : (t * t * t) -> t
val of_quad : (t * t * t * t) -> t
val of_variant : string -> t list -> t

of_variant name args is used to encode algebraic variants into a S-expr. For instance of_variant "some" [of_int 1] represents the value Some 1.

val of_field : string -> t -> t

Used to represent one record field.

val of_record : (string * t) list -> t

Represent a record by its named fields.

Printing

val to_buf : Stdlib.Buffer.t -> t -> unit
val to_string : t -> string
val to_file : string -> t -> unit
val to_file_iter : string -> t CCSexp_intf.iter -> unit

Print the given iter of expressions to a file.

val to_chan : Stdlib.out_channel -> t -> unit
val pp : Stdlib.Format.formatter -> t -> unit

Pretty-printer nice on human eyes (including indentation).

val pp_noindent : Stdlib.Format.formatter -> t -> unit

Raw, direct printing as compact as possible.

Parsing

val parse_string : string -> t CCSexp_intf.or_error

Parse a string.

val parse_string_list : string -> t list CCSexp_intf.or_error

Parse a string into a list of S-exprs.

  • since 2.8
val parse_chan : Stdlib.in_channel -> t CCSexp_intf.or_error

Parse a S-expression from the given channel. Can read more data than necessary, so don't use this if you need finer-grained control (e.g. to read something else after the S-exp).

val parse_chan_gen : + Stdlib.in_channel -> + t CCSexp_intf.or_error CCSexp_intf.gen

Parse a channel into a generator of S-expressions.

val parse_chan_list : Stdlib.in_channel -> t list CCSexp_intf.or_error
val parse_file : string -> t CCSexp_intf.or_error

Open the file and read a S-exp from it.

val parse_file_list : string -> t list CCSexp_intf.or_error

Open the file and read a S-exp from it.

type loc = Sexp.loc

Locations for the S-expressions.

  • since 3.3

Parsing

type 'a parse_result =
| Yield of 'a
| Fail of string
| End

A parser of 'a can return Yield x when it parsed a value, or Fail e when a parse error was encountered, or End if the input was empty.

module Decoder : sig ... end
\ No newline at end of file diff --git a/3.10/containers/CCSexp/index.html b/3.10/containers/CCSexp/index.html new file mode 100644 index 00000000..16bdba3a --- /dev/null +++ b/3.10/containers/CCSexp/index.html @@ -0,0 +1,4 @@ + +CCSexp (containers.CCSexp)

Module CCSexp

Handling S-expressions

type 'a or_error = ( 'a, string ) Stdlib.result
type 'a gen = unit -> 'a option
module type SEXP = CCSexp_intf.SEXP
module type S = CCSexp_intf.S
module Make (Sexp : SEXP) : S with type t = Sexp.t and type loc = Sexp.loc

Basics

type t = [
| `Atom of string
| `List of t list
]

A simple, structural representation of S-expressions.

include S with type t := t
include CCSexp_intf.S0 with type t := t
type sexp = t

Re-exports

val list : t list -> t

Make a Sexpr of this list.

  • since 2.8

Constructors

val of_int : int -> t
val of_bool : bool -> t
val of_list : t list -> t
val of_rev_list : t list -> t

Reverse the list.

val of_float : float -> t
val of_unit : t
val of_pair : (t * t) -> t
val of_triple : (t * t * t) -> t
val of_quad : (t * t * t * t) -> t
val of_variant : string -> t list -> t

of_variant name args is used to encode algebraic variants into a S-expr. For instance of_variant "some" [of_int 1] represents the value Some 1.

val of_field : string -> t -> t

Used to represent one record field.

val of_record : (string * t) list -> t

Represent a record by its named fields.

Printing

val to_buf : Stdlib.Buffer.t -> t -> unit
val to_string : t -> string
val to_file : string -> t -> unit
val to_file_iter : string -> t CCSexp_intf.iter -> unit

Print the given iter of expressions to a file.

val to_chan : Stdlib.out_channel -> t -> unit
val pp : Stdlib.Format.formatter -> t -> unit

Pretty-printer nice on human eyes (including indentation).

val pp_noindent : Stdlib.Format.formatter -> t -> unit

Raw, direct printing as compact as possible.

Parsing

val parse_string : string -> t CCSexp_intf.or_error

Parse a string.

val parse_string_list : string -> t list CCSexp_intf.or_error

Parse a string into a list of S-exprs.

  • since 2.8
val parse_chan : Stdlib.in_channel -> t CCSexp_intf.or_error

Parse a S-expression from the given channel. Can read more data than necessary, so don't use this if you need finer-grained control (e.g. to read something else after the S-exp).

val parse_chan_gen : + Stdlib.in_channel -> + t CCSexp_intf.or_error CCSexp_intf.gen

Parse a channel into a generator of S-expressions.

val parse_chan_list : Stdlib.in_channel -> t list CCSexp_intf.or_error
val parse_file : string -> t CCSexp_intf.or_error

Open the file and read a S-exp from it.

val parse_file_list : string -> t list CCSexp_intf.or_error

Open the file and read a S-exp from it.

type loc

Locations for the S-expressions.

  • since 3.3

Parsing

type 'a parse_result =
| Yield of 'a
| Fail of string
| End

A parser of 'a can return Yield x when it parsed a value, or Fail e when a parse error was encountered, or End if the input was empty.

module Decoder : sig ... end
val equal : t -> t -> bool
  • since 3.0
val compare : t -> t -> int
  • since 3.0
val atom : string -> t

Build an atom directly from a string.

\ No newline at end of file diff --git a/3.10/containers/CCSexp_intf/.dummy b/3.10/containers/CCSexp_intf/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCSexp_intf/index.html b/3.10/containers/CCSexp_intf/index.html new file mode 100644 index 00000000..19bf898d --- /dev/null +++ b/3.10/containers/CCSexp_intf/index.html @@ -0,0 +1,2 @@ + +CCSexp_intf (containers.CCSexp_intf)

Module CCSexp_intf

type 'a or_error = ( 'a, string ) Stdlib.result
type 'a iter = ( 'a -> unit ) -> unit
type 'a gen = unit -> 'a option
module type BASIC_SEXP = sig ... end
module type SEXP = sig ... end
module type S0 = sig ... end
module type S = sig ... end
\ No newline at end of file diff --git a/3.10/containers/CCSexp_intf/module-type-BASIC_SEXP/index.html b/3.10/containers/CCSexp_intf/module-type-BASIC_SEXP/index.html new file mode 100644 index 00000000..9397eded --- /dev/null +++ b/3.10/containers/CCSexp_intf/module-type-BASIC_SEXP/index.html @@ -0,0 +1,2 @@ + +BASIC_SEXP (containers.CCSexp_intf.BASIC_SEXP)

Module type CCSexp_intf.BASIC_SEXP

Abstract representation of S-expressions

type t
val atom : string -> t
val list : t list -> t
val match_ : t -> atom:( string -> 'a ) -> list:( t list -> 'a ) -> 'a
\ No newline at end of file diff --git a/3.10/containers/CCSexp_intf/module-type-S/Decoder/index.html b/3.10/containers/CCSexp_intf/module-type-S/Decoder/index.html new file mode 100644 index 00000000..bd95738a --- /dev/null +++ b/3.10/containers/CCSexp_intf/module-type-S/Decoder/index.html @@ -0,0 +1,2 @@ + +Decoder (containers.CCSexp_intf.S.Decoder)

Module S.Decoder

type t

Decoder

val of_lexbuf : Stdlib.Lexing.lexbuf -> t
val next : t -> sexp parse_result

Parse the next S-expression or return an error if the input isn't long enough or isn't a proper S-expression.

val to_list : t -> sexp list or_error

Read all the values from this decoder.

  • since 2.8
val last_loc : t -> loc option

Last location for the decoder. In particular, after calling next, this gives the location of the last token used in the result, which is useful in case of error.

  • since 3.3
\ No newline at end of file diff --git a/3.10/containers/CCSexp_intf/module-type-S/index.html b/3.10/containers/CCSexp_intf/module-type-S/index.html new file mode 100644 index 00000000..e311c1d3 --- /dev/null +++ b/3.10/containers/CCSexp_intf/module-type-S/index.html @@ -0,0 +1,2 @@ + +S (containers.CCSexp_intf.S)

Module type CCSexp_intf.S

Operations over S-expressions (extended)

include S0
type t
type sexp = t

Re-exports

val atom : string -> t

Make an atom out of this string.

  • since 2.8
val list : t list -> t

Make a Sexpr of this list.

  • since 2.8

Constructors

val of_int : int -> t
val of_bool : bool -> t
val of_list : t list -> t
val of_rev_list : t list -> t

Reverse the list.

val of_float : float -> t
val of_unit : t
val of_pair : (t * t) -> t
val of_triple : (t * t * t) -> t
val of_quad : (t * t * t * t) -> t
val of_variant : string -> t list -> t

of_variant name args is used to encode algebraic variants into a S-expr. For instance of_variant "some" [of_int 1] represents the value Some 1.

val of_field : string -> t -> t

Used to represent one record field.

val of_record : (string * t) list -> t

Represent a record by its named fields.

Printing

val to_buf : Stdlib.Buffer.t -> t -> unit
val to_string : t -> string
val to_file : string -> t -> unit
val to_file_iter : string -> t iter -> unit

Print the given iter of expressions to a file.

val to_chan : Stdlib.out_channel -> t -> unit
val pp : Stdlib.Format.formatter -> t -> unit

Pretty-printer nice on human eyes (including indentation).

val pp_noindent : Stdlib.Format.formatter -> t -> unit

Raw, direct printing as compact as possible.

Parsing

val parse_string : string -> t or_error

Parse a string.

val parse_string_list : string -> t list or_error

Parse a string into a list of S-exprs.

  • since 2.8
val parse_chan : Stdlib.in_channel -> t or_error

Parse a S-expression from the given channel. Can read more data than necessary, so don't use this if you need finer-grained control (e.g. to read something else after the S-exp).

val parse_chan_gen : Stdlib.in_channel -> t or_error gen

Parse a channel into a generator of S-expressions.

val parse_chan_list : Stdlib.in_channel -> t list or_error
val parse_file : string -> t or_error

Open the file and read a S-exp from it.

val parse_file_list : string -> t list or_error

Open the file and read a S-exp from it.

type loc

Locations for the S-expressions.

  • since 3.3

Parsing

type 'a parse_result =
| Yield of 'a
| Fail of string
| End

A parser of 'a can return Yield x when it parsed a value, or Fail e when a parse error was encountered, or End if the input was empty.

module Decoder : sig ... end
\ No newline at end of file diff --git a/3.10/containers/CCSexp_intf/module-type-S0/index.html b/3.10/containers/CCSexp_intf/module-type-S0/index.html new file mode 100644 index 00000000..66486313 --- /dev/null +++ b/3.10/containers/CCSexp_intf/module-type-S0/index.html @@ -0,0 +1,2 @@ + +S0 (containers.CCSexp_intf.S0)

Module type CCSexp_intf.S0

Operations over S-expressions

type t
type sexp = t

Re-exports

val atom : string -> t

Make an atom out of this string.

  • since 2.8
val list : t list -> t

Make a Sexpr of this list.

  • since 2.8

Constructors

val of_int : int -> t
val of_bool : bool -> t
val of_list : t list -> t
val of_rev_list : t list -> t

Reverse the list.

val of_float : float -> t
val of_unit : t
val of_pair : (t * t) -> t
val of_triple : (t * t * t) -> t
val of_quad : (t * t * t * t) -> t
val of_variant : string -> t list -> t

of_variant name args is used to encode algebraic variants into a S-expr. For instance of_variant "some" [of_int 1] represents the value Some 1.

val of_field : string -> t -> t

Used to represent one record field.

val of_record : (string * t) list -> t

Represent a record by its named fields.

Printing

val to_buf : Stdlib.Buffer.t -> t -> unit
val to_string : t -> string
val to_file : string -> t -> unit
val to_file_iter : string -> t iter -> unit

Print the given iter of expressions to a file.

val to_chan : Stdlib.out_channel -> t -> unit
val pp : Stdlib.Format.formatter -> t -> unit

Pretty-printer nice on human eyes (including indentation).

val pp_noindent : Stdlib.Format.formatter -> t -> unit

Raw, direct printing as compact as possible.

Parsing

val parse_string : string -> t or_error

Parse a string.

val parse_string_list : string -> t list or_error

Parse a string into a list of S-exprs.

  • since 2.8
val parse_chan : Stdlib.in_channel -> t or_error

Parse a S-expression from the given channel. Can read more data than necessary, so don't use this if you need finer-grained control (e.g. to read something else after the S-exp).

val parse_chan_gen : Stdlib.in_channel -> t or_error gen

Parse a channel into a generator of S-expressions.

val parse_chan_list : Stdlib.in_channel -> t list or_error
val parse_file : string -> t or_error

Open the file and read a S-exp from it.

val parse_file_list : string -> t list or_error

Open the file and read a S-exp from it.

\ No newline at end of file diff --git a/3.10/containers/CCSexp_intf/module-type-SEXP/index.html b/3.10/containers/CCSexp_intf/module-type-SEXP/index.html new file mode 100644 index 00000000..fa5a1e21 --- /dev/null +++ b/3.10/containers/CCSexp_intf/module-type-SEXP/index.html @@ -0,0 +1,2 @@ + +SEXP (containers.CCSexp_intf.SEXP)

Module type CCSexp_intf.SEXP

Abstract representation of S-expressions (extended)

include BASIC_SEXP
type t
val atom : string -> t
val list : t list -> t
val match_ : t -> atom:( string -> 'a ) -> list:( t list -> 'a ) -> 'a
type loc
val make_loc : ( (int * int) -> (int * int) -> string -> loc ) option

If provided, builds a location from a pair of (line,column) positions, and a (possibly dummy) filename

val atom_with_loc : loc:loc -> string -> t
val list_with_loc : loc:loc -> t list -> t
\ No newline at end of file diff --git a/3.10/containers/CCSexp_lex/.dummy b/3.10/containers/CCSexp_lex/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCSexp_lex/index.html b/3.10/containers/CCSexp_lex/index.html new file mode 100644 index 00000000..e2c2bd40 --- /dev/null +++ b/3.10/containers/CCSexp_lex/index.html @@ -0,0 +1,2 @@ + +CCSexp_lex (containers.CCSexp_lex)

Module CCSexp_lex

type token =
| ATOM of string
| LIST_OPEN
| LIST_CLOSE
| SEXP_COMMENT
| EOI
exception Error of int * int * string
val error : Stdlib.Lexing.lexbuf -> string -> 'a
type unescape_state =
| Not_escaped
| Escaped
| Escaped_int_1 of int
| Escaped_int_2 of int
val char_equal : char -> char -> bool
val remove_quotes : Stdlib.Lexing.lexbuf -> string -> string
val __ocaml_lex_tables : Stdlib.Lexing.lex_tables
val token : Stdlib.Lexing.lexbuf -> token
val __ocaml_lex_token_rec : Stdlib.Lexing.lexbuf -> int -> token
\ No newline at end of file diff --git a/3.10/containers/CCShims_/.dummy b/3.10/containers/CCShims_/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCShims_/index.html b/3.10/containers/CCShims_/index.html new file mode 100644 index 00000000..9b620588 --- /dev/null +++ b/3.10/containers/CCShims_/index.html @@ -0,0 +1,2 @@ + +CCShims_ (containers.CCShims_)

Module CCShims_

module Stdlib = Stdlib
\ No newline at end of file diff --git a/3.10/containers/CCShims_syntax/.dummy b/3.10/containers/CCShims_syntax/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCShims_syntax/index.html b/3.10/containers/CCShims_syntax/index.html new file mode 100644 index 00000000..7f3fbb8a --- /dev/null +++ b/3.10/containers/CCShims_syntax/index.html @@ -0,0 +1,2 @@ + +CCShims_syntax (containers.CCShims_syntax)

Module CCShims_syntax

module type LET = sig ... end

Let operators on OCaml >= 4.08.0, nothing otherwise

\ No newline at end of file diff --git a/3.10/containers/CCShims_syntax/module-type-LET/index.html b/3.10/containers/CCShims_syntax/module-type-LET/index.html new file mode 100644 index 00000000..eb4bbf68 --- /dev/null +++ b/3.10/containers/CCShims_syntax/module-type-LET/index.html @@ -0,0 +1,2 @@ + +LET (containers.CCShims_syntax.LET)

Module type CCShims_syntax.LET

Let operators on OCaml >= 4.08.0, nothing otherwise

type 'a t
val let+ : 'a t -> ( 'a -> 'b ) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ( 'a -> 'b t ) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t
\ No newline at end of file diff --git a/3.10/containers/CCString/.dummy b/3.10/containers/CCString/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCString/Find/index.html b/3.10/containers/CCString/Find/index.html new file mode 100644 index 00000000..40788d7e --- /dev/null +++ b/3.10/containers/CCString/Find/index.html @@ -0,0 +1,2 @@ + +Find (containers.CCString.Find)

Module CCString.Find

type _ pattern
val compile : string -> [ `Direct ] pattern
val rcompile : string -> [ `Reverse ] pattern
val find : ?start:int -> pattern:[ `Direct ] pattern -> string -> int

find ~start ~pattern s searches for pattern in the string s, left-to-right.

  • returns

    the offset of the first match, -1 otherwise.

  • parameter start

    offset in string at which we start.

val rfind : ?start:int -> pattern:[ `Reverse ] pattern -> string -> int

rfind ~start ~pattern s searches for pattern in the string s, right-to-left.

  • returns

    the offset of the start of the first match from the right, -1 otherwise.

  • parameter start

    right-offset in string at which we start.

\ No newline at end of file diff --git a/3.10/containers/CCString/Infix/index.html b/3.10/containers/CCString/Infix/index.html new file mode 100644 index 00000000..8a453284 --- /dev/null +++ b/3.10/containers/CCString/Infix/index.html @@ -0,0 +1,2 @@ + +Infix (containers.CCString.Infix)

Module CCString.Infix

val (=) : t -> t -> bool
  • since 3.0
val (<>) : t -> t -> bool
  • since 3.0
val (<) : t -> t -> bool
  • since 3.0
val (<=) : t -> t -> bool
  • since 3.0
val (>=) : t -> t -> bool
  • since 3.0
val (>) : t -> t -> bool
  • since 3.0
\ No newline at end of file diff --git a/3.10/containers/CCString/Split/index.html b/3.10/containers/CCString/Split/index.html new file mode 100644 index 00000000..0bfe94f0 --- /dev/null +++ b/3.10/containers/CCString/Split/index.html @@ -0,0 +1,18 @@ + +Split (containers.CCString.Split)

Module CCString.Split

type drop_if_empty = {
first : bool;
last : bool;
}

Specification of what to do with empty blocks, as in split ~by:"-" "-a-b-".

  • {first=false; last=false} will return ""; "a"; "b"; ""
  • {first=true; last=false} will return "a"; "b" ""
  • {first=false; last=true} will return ""; "a"; "b"
  • {first=true; last=true} will return "a"; "b"

The default value of all remaining functions is Drop_none.

  • since 1.5
val no_drop : drop_if_empty

no_drop does not drop any group, even empty and on borders.

  • since 1.5
val list_ : + ?drop:drop_if_empty -> + by:string -> + string -> + (string * int * int) list

list_ ~drop ~by s splits the given string s along the given separator by. Should only be used with very small separators, otherwise use Containers_string.KMP.

  • returns

    a list of slices (s,index,length) that are separated by by. String.sub can then be used to actually extract a string from the slice.

  • raises Failure

    if by = "".

val gen : + ?drop:drop_if_empty -> + by:string -> + string -> + (string * int * int) gen

gen ~drop ~by s splits the given string s along the given separator by. Returns a gen of slices.

val iter : + ?drop:drop_if_empty -> + by:string -> + string -> + (string * int * int) iter

iter ~drop ~by s splits the given string s along the given separator by. Returns an iter of slices.

  • since 2.8
val seq : + ?drop:drop_if_empty -> + by:string -> + string -> + (string * int * int) Stdlib.Seq.t

seq ~drop ~by s splits the given string s along the given separator by. Returns a Seq.t of slices. Renamed from std_seq since 3.0.

  • since 3.0
Copying functions

Those split functions actually copy the substrings, which can be more convenient but less efficient in general.

val list_cpy : ?drop:drop_if_empty -> by:string -> string -> string list

list_cpy ~drop ~by s splits the given string s along the given separator by. Returns a list of strings.

val gen_cpy : ?drop:drop_if_empty -> by:string -> string -> string gen

gen_cpy ~drop ~by s splits the given string s along the given separator by. Returns a gen of strings.

val iter_cpy : ?drop:drop_if_empty -> by:string -> string -> string iter

iter_cpy ~drop ~by s splits the given string s along the given separator by. Returns an iter of strings.

  • since 2.8
val seq_cpy : ?drop:drop_if_empty -> by:string -> string -> string Stdlib.Seq.t

seq_cpy ~drop ~by s splits the given string s along the given separator by. Returns a Seq.t of strings. Renamed from std_seq_cpy since 3.0.

  • since 3.0
val left : by:string -> string -> (string * string) option

left ~by s splits on the first occurrence of by from the leftmost part of the string s.

  • since 0.12
val left_exn : by:string -> string -> string * string

left_exn ~by s splits on the first occurrence of by from the leftmost part of the string s.

  • raises Not_found

    if by is not part of the string s.

  • since 0.16
val right : by:string -> string -> (string * string) option

right ~by s splits on the first occurrence of by from the rightmost part of the string s.

  • since 0.12
val right_exn : by:string -> string -> string * string

right_exn ~by s splits on the first occurrence of by from the rightmost part of the string s.

  • raises Not_found

    if by is not part of the string s.

  • since 0.16
\ No newline at end of file diff --git a/3.10/containers/CCString/index.html b/3.10/containers/CCString/index.html new file mode 100644 index 00000000..9068d36c --- /dev/null +++ b/3.10/containers/CCString/index.html @@ -0,0 +1,7 @@ + +CCString (containers.CCString)

Module CCString

Basic String Utils

type 'a iter = ( 'a -> unit ) -> unit

Fast internal iterator.

  • since 2.8
type 'a gen = unit -> 'a option
include module type of struct include Stdlib.String end
type t = string
val make : int -> char -> string
val init : int -> ( int -> char ) -> string
val empty : string
val of_bytes : bytes -> string
val to_bytes : string -> bytes
val get : string -> int -> char
val concat : string -> string list -> string
val cat : string -> string -> string
val equal : t -> t -> bool
val starts_with : prefix:string -> string -> bool
val ends_with : suffix:string -> string -> bool
val contains_from : string -> int -> char -> bool
val rcontains_from : string -> int -> char -> bool
val contains : string -> char -> bool
val sub : string -> int -> int -> string
val map : ( char -> char ) -> string -> string
val mapi : ( int -> char -> char ) -> string -> string
val fold_left : ( 'a -> char -> 'a ) -> 'a -> string -> 'a
val fold_right : ( char -> 'a -> 'a ) -> string -> 'a -> 'a
val trim : string -> string
val escaped : string -> string
val uppercase_ascii : string -> string
val lowercase_ascii : string -> string
val capitalize_ascii : string -> string
val uncapitalize_ascii : string -> string
val iteri : ( int -> char -> unit ) -> string -> unit
val index_from : string -> int -> char -> int
val index_from_opt : string -> int -> char -> int option
val rindex_from : string -> int -> char -> int
val rindex_from_opt : string -> int -> char -> int option
val index : string -> char -> int
val index_opt : string -> char -> int option
val rindex : string -> char -> int
val rindex_opt : string -> char -> int option
val to_seqi : t -> (int * char) Stdlib.Seq.t
val get_utf_8_uchar : t -> int -> Stdlib.Uchar.utf_decode
val is_valid_utf_8 : t -> bool
val get_utf_16be_uchar : t -> int -> Stdlib.Uchar.utf_decode
val is_valid_utf_16be : t -> bool
val get_utf_16le_uchar : t -> int -> Stdlib.Uchar.utf_decode
val is_valid_utf_16le : t -> bool
val create : int -> bytes
val copy : string -> string
val fill : bytes -> int -> int -> char -> unit
val uppercase : string -> string
val lowercase : string -> string
val capitalize : string -> string
val uncapitalize : string -> string
val get_uint8 : string -> int -> int
val get_int8 : string -> int -> int
val get_uint16_ne : string -> int -> int
val get_uint16_be : string -> int -> int
val get_uint16_le : string -> int -> int
val get_int16_ne : string -> int -> int
val get_int16_be : string -> int -> int
val get_int16_le : string -> int -> int
val get_int32_ne : string -> int -> int32
val get_int32_be : string -> int -> int32
val get_int32_le : string -> int -> int32
val get_int64_ne : string -> int -> int64
val get_int64_be : string -> int -> int64
val get_int64_le : string -> int -> int64
val unsafe_get : string -> int -> char
val unsafe_set : bytes -> int -> char -> unit
val unsafe_blit : string -> int -> bytes -> int -> int -> unit
val unsafe_fill : bytes -> int -> int -> char -> unit
val length : t -> int

length s returns the length (number of characters) of the given string s.

val blit : t -> int -> Stdlib.Bytes.t -> int -> int -> unit

blit src src_pos dst dst_pos len copies len characters from string src starting at character indice src_pos, to the Bytes sequence dst starting at character indice dst_pos. Like String.blit. Compatible with the -safe-string option.

  • raises Invalid_argument

    if indices are not valid.

val fold : ( 'a -> char -> 'a ) -> 'a -> t -> 'a

fold f init s folds on chars by increasing index. Computes f(… (f (f init s.[0]) s.[1]) …) s.[n-1].

  • since 0.7
val foldi : ( 'a -> int -> char -> 'a ) -> 'a -> t -> 'a

foldi f init s is just like fold, but it also passes in the index of each chars as second argument to the folded function f.

  • since 3.3

Conversions

val to_gen : t -> char gen

to_gen s returns the gen of characters contained in the string s.

val to_iter : t -> char iter

to_iter s returns the iter of characters contained in the string s.

  • since 2.8
val to_seq : t -> char Stdlib.Seq.t

to_seq s returns the Seq.t of characters contained in the string s. Renamed from to std_seq since 3.0.

  • since 3.0
val to_list : t -> char list

to_list s returns the list of characters contained in the string s.

val pp_buf : Stdlib.Buffer.t -> t -> unit

pp_buf buf s prints s to the buffer buf. Renamed from pp since 2.0.

val pp : Stdlib.Format.formatter -> t -> unit

pp f s prints the string s within quotes to the formatter f. Renamed from print since 2.0.

val compare : string -> string -> int

compare s1 s2 compares the strings s1 and s2 and returns an integer that indicates their relative position in the sort order.

val is_empty : string -> bool

is_empty s returns true iff s is empty (i.e. its length is 0).

  • since 1.5
val hash : string -> int

hash s returns the hash value of s.

val rev : string -> string

rev s returns the reverse of s.

  • since 0.17
val pad : ?side:[ `Left | `Right ] -> ?c:char -> int -> string -> string

pad ~side ~c n s ensures that the string s is at least n bytes long, and pads it on the side with c if it's not the case.

  • parameter side

    determines where padding occurs (default: `Left).

  • parameter c

    the char used to pad (default: ' ').

  • since 0.17
val of_char : char -> string

of_char 'a' is "a".

  • since 0.19
val of_gen : char gen -> string

of_gen gen converts a gen of characters to a string.

val of_iter : char iter -> string

of_iter iter converts an iter of characters to a string.

  • since 2.8
val of_seq : char Stdlib.Seq.t -> string

of_seq seq converts a seq of characters to a string. Renamed from of_std_seq since 3.0.

  • since 3.0
val of_list : char list -> string

of_list lc converts a list of characters lc to a string.

val of_array : char array -> string

of_array ac converts an array of characters ac to a string.

val to_array : string -> char array

to_array s returns the array of characters contained in the string s.

val find : ?start:int -> sub:string -> string -> int

find ~start ~sub s returns the starting index of the first occurrence of sub within s or -1.

  • parameter start

    starting position in s.

val find_all : ?start:int -> sub:string -> string -> int gen

find_all ~start ~sub s finds all occurrences of sub in s, even overlapping instances and returns them in a generator gen.

  • parameter start

    starting position in s.

  • since 0.17
val find_all_l : ?start:int -> sub:string -> string -> int list

find_all_l ~sub s finds all occurrences of sub in s and returns them in a list.

  • parameter start

    starting position in s.

  • since 0.17
val mem : ?start:int -> sub:string -> string -> bool

mem ~start ~sub s is true iff sub is a substring of s.

  • since 0.12
val rfind : sub:string -> string -> int

rfind ~sub s finds sub in string s from the right, returns its first index or -1. Should only be used with very small sub.

  • since 0.12
val replace : + ?which:[ `Left | `Right | `All ] -> + sub:string -> + by:string -> + string -> + string

replace ~which ~sub ~by s replaces some occurrences of sub by by in s.

  • parameter which

    decides whether the occurrences to replace are:

    • `Left first occurrence from the left (beginning).
    • `Right first occurrence from the right (end).
    • `All all occurrences (default).
  • raises Invalid_argument

    if sub = "".

  • since 0.14
val is_sub : sub:string -> int -> string -> int -> sub_len:int -> bool

is_sub ~sub ~sub_pos s ~pos ~sub_len returns true iff the substring of sub starting at position sub_pos and of length sub_len is a substring of s starting at position pos.

val repeat : string -> int -> string

repeat s n creates a string by repeating the string s n times.

val prefix : pre:string -> string -> bool

prefix ~pre s returns true iff pre is a prefix of s.

val suffix : suf:string -> string -> bool

suffix ~suf s returns true iff suf is a suffix of s.

  • since 0.7
val chop_prefix : pre:string -> string -> string option

chop_prefix ~pre s removes pre from s if pre really is a prefix of s, returns None otherwise.

  • since 0.17
val chop_suffix : suf:string -> string -> string option

chop_suffix ~suf s removes suf from s if suf really is a suffix of s, returns None otherwise.

  • since 0.17
val take : int -> string -> string

take n s keeps only the n first chars of s.

  • since 0.17
val drop : int -> string -> string

drop n s removes the n first chars of s.

  • since 0.17
val take_drop : int -> string -> string * string

take_drop n s is take n s, drop n s.

  • since 0.17
val lines : string -> string list

lines s returns a list of the lines of s (splits along '\n').

  • since 0.10
val lines_gen : string -> string gen

lines_gen s returns the gen of the lines of s (splits along '\n').

  • since 0.10
val lines_iter : string -> string iter

lines_iter s returns the iter of the lines of s (splits along '\n').

  • since 3.2
val lines_seq : string -> string Stdlib.Seq.t

lines_seq s returns the Seq.t of the lines of s (splits along '\n').

  • since 3.2
val concat_gen : sep:string -> string gen -> string

concat_gen ~sep gen concatenates all strings of gen, separated with sep.

  • since 0.10
val concat_seq : sep:string -> string Stdlib.Seq.t -> string

concat_seq ~sep seq concatenates all strings of seq, separated with sep.

  • since 3.2
val concat_iter : sep:string -> string iter -> string

concat_iter ~sep iter concatenates all strings of iter, separated with sep.

  • since 3.2
val unlines : string list -> string

unlines ls concatenates all strings of ls, separated with '\n'.

  • since 0.10
val unlines_gen : string gen -> string

unlines_gen gen concatenates all strings of gen, separated with '\n'.

  • since 0.10
val unlines_iter : string iter -> string

unlines_iter iter concatenates all strings of iter, separated with '\n'.

  • since 3.2
val unlines_seq : string Stdlib.Seq.t -> string

unlines_seq seq concatenates all strings of seq, separated with '\n'.

  • since 3.2
val set : string -> int -> char -> string

set s i c creates a new string which is a copy of s, except for index i, which becomes c.

  • raises Invalid_argument

    if i is an invalid index.

  • since 0.12
val iter : ( char -> unit ) -> string -> unit

iter f s applies function f on each character of s. Alias to String.iter.

  • since 0.12
val filter_map : ( char -> char option ) -> string -> string

filter_map f s calls (f a0) (f a1) … (f an) where a0 … an are the characters of s. It returns the string of characters ci such as f ai = Some ci (when f returns None, the corresponding element of s is discarded).

  • since 0.17
val filter : ( char -> bool ) -> string -> string

filter f s discards characters of s not satisfying f.

  • since 0.17
val uniq : ( char -> char -> bool ) -> string -> string

uniq eq s remove consecutive duplicate characters in s.

  • since 3.4
val flat_map : ?sep:string -> ( char -> string ) -> string -> string

flat_map ~sep f s maps each chars of s to a string, then concatenates them all.

  • parameter sep

    optional separator between each generated string.

  • since 0.12
val for_all : ( char -> bool ) -> string -> bool

for_all f s is true iff all characters of s satisfy the predicate f.

  • since 0.12
val exists : ( char -> bool ) -> string -> bool

exists f s is true iff some character of s satisfy the predicate f.

  • since 0.12
val drop_while : ( char -> bool ) -> t -> t

drop_while f s discards any characters of s starting from the left, up to the first character c not satisfying f c.

  • since 2.2
val rdrop_while : ( char -> bool ) -> t -> t

rdrop_while f s discards any characters of s starting from the right, up to the first character c not satisfying f c.

  • since 2.2
val ltrim : t -> t

ltrim s trims space on the left (see String.trim for more details).

  • since 1.2
val rtrim : t -> t

rtrim s trims space on the right (see String.trim for more details).

  • since 1.2

Operations on 2 strings

val map2 : ( char -> char -> char ) -> string -> string -> string

map2 f s1 s2 maps pairs of chars.

  • raises Invalid_argument

    if the strings have not the same length.

  • since 0.12
val iter2 : ( char -> char -> unit ) -> string -> string -> unit

iter2 f s1 s2 iterates on pairs of chars.

  • raises Invalid_argument

    if the strings have not the same length.

  • since 0.12
val iteri2 : ( int -> char -> char -> unit ) -> string -> string -> unit

iteri2 f s1 s2 iterates on pairs of chars with their index.

  • raises Invalid_argument

    if the strings have not the same length.

  • since 0.12
val fold2 : ( 'a -> char -> char -> 'a ) -> 'a -> string -> string -> 'a

fold2 f init s1 s2 folds on pairs of chars.

  • raises Invalid_argument

    if the strings have not the same length.

  • since 0.12
val for_all2 : ( char -> char -> bool ) -> string -> string -> bool

for_all2 f s1 s2 returns true iff all pairs of chars satisfy the predicate f.

  • raises Invalid_argument

    if the strings have not the same length.

  • since 0.12
val exists2 : ( char -> char -> bool ) -> string -> string -> bool

exists2 f s1 s2 returns true iff a pair of chars satisfy the predicate f.

  • raises Invalid_argument

    if the strings have not the same length.

  • since 0.12

Ascii functions

Those functions are deprecated in String since 4.03, so we provide a stable alias for them even in older versions.

val equal_caseless : string -> string -> bool

equal_caseless s1 s2 compares s1 and s2 without respect to ascii lowercase.

  • since 1.2
val to_hex : string -> string

Convert a string with arbitrary content into a hexadecimal string.

  • since 3.8
val of_hex : string -> string option

Convert a string in hex into a string with arbitrary content.

  • since 3.8
val of_hex_exn : string -> string

Same as of_hex but fails harder.

  • raises Invalid_argument

    if the input is not valid hex.

  • since 3.8

Finding

A relatively efficient algorithm for finding sub-strings.

module Find : sig ... end

Splitting

module Split : sig ... end
val split_on_char : char -> string -> string list

split_on_char by s splits the string s along the given char by.

  • since 1.2
val split : by:string -> string -> string list

split ~by s splits the string s along the given string by. Alias to Split.list_cpy.

  • since 1.2

Utils

val compare_versions : string -> string -> int

compare_versions s1 s2 compares version strings s1 and s2, considering that numbers are above text.

  • since 0.13
val compare_natural : string -> string -> int

compare_natural s1 s2 is the Natural Sort Order, comparing chunks of digits as natural numbers. https://en.wikipedia.org/wiki/Natural_sort_order

  • since 1.3
val edit_distance : ?cutoff:int -> string -> string -> int

edit_distance ~cutoff s1 s2 is the edition distance between the two strings s1 and s2. This satisfies the classical distance axioms: it is always positive, symmetric, and satisfies the formula distance s1 s2 + distance s2 s3 >= distance s1 s3.

  • parameter cutoff

    if provided, it's a cap on the number of iterations. (since 3.0). This is useful if you just want to check whether the edit distance is less or equal than 2 without (use edit_distance s1 s2 ~cutoff:3 <= 2). note that contrary to what was previously documented here, the result can still be higher than cutoff if it's reached in <cutoff iterations. However if the result is < cutoff then it is accurate.

Infix operators

module Infix : sig ... end
include module type of Infix
val (=) : t -> t -> bool
  • since 3.0
val (<>) : t -> t -> bool
  • since 3.0
val (<) : t -> t -> bool
  • since 3.0
val (<=) : t -> t -> bool
  • since 3.0
val (>=) : t -> t -> bool
  • since 3.0
val (>) : t -> t -> bool
  • since 3.0
\ No newline at end of file diff --git a/3.10/containers/CCStringLabels/.dummy b/3.10/containers/CCStringLabels/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCStringLabels/Find/index.html b/3.10/containers/CCStringLabels/Find/index.html new file mode 100644 index 00000000..c5bf6ae2 --- /dev/null +++ b/3.10/containers/CCStringLabels/Find/index.html @@ -0,0 +1,2 @@ + +Find (containers.CCStringLabels.Find)

Module CCStringLabels.Find

type _ pattern
val compile : string -> [ `Direct ] pattern
val rcompile : string -> [ `Reverse ] pattern
val find : ?start:int -> pattern:[ `Direct ] pattern -> string -> int

find ?start ~pattern s searches for pattern in the string s, left-to-right.

  • returns

    the offset of the first match, -1 otherwise.

  • parameter start

    offset in string at which we start.

val rfind : ?start:int -> pattern:[ `Reverse ] pattern -> string -> int

rfind ?start ~pattern s searches for pattern in the string s, right-to-left.

  • returns

    the offset of the start of the first match from the right, -1 otherwise.

  • parameter start

    right-offset in string at which we start.

\ No newline at end of file diff --git a/3.10/containers/CCStringLabels/Infix/index.html b/3.10/containers/CCStringLabels/Infix/index.html new file mode 100644 index 00000000..d474ce4b --- /dev/null +++ b/3.10/containers/CCStringLabels/Infix/index.html @@ -0,0 +1,2 @@ + +Infix (containers.CCStringLabels.Infix)

Module CCStringLabels.Infix

val (=) : t -> t -> bool
  • since 3.0
val (<>) : t -> t -> bool
  • since 3.0
val (<) : t -> t -> bool
  • since 3.0
val (<=) : t -> t -> bool
  • since 3.0
val (>=) : t -> t -> bool
  • since 3.0
val (>) : t -> t -> bool
  • since 3.0
\ No newline at end of file diff --git a/3.10/containers/CCStringLabels/Split/index.html b/3.10/containers/CCStringLabels/Split/index.html new file mode 100644 index 00000000..485ea04c --- /dev/null +++ b/3.10/containers/CCStringLabels/Split/index.html @@ -0,0 +1,18 @@ + +Split (containers.CCStringLabels.Split)

Module CCStringLabels.Split

type drop_if_empty = {
first : bool;
last : bool;
}

Specification of what to do with empty blocks, as in split ~by:"-" "-a-b-".

  • {first=false; last=false} will return ""; "a"; "b"; ""
  • {first=true; last=false} will return "a"; "b" ""
  • {first=false; last=true} will return ""; "a"; "b"
  • {first=true; last=true} will return "a"; "b"

The default value of all remaining functions is Drop_none.

  • since 1.5
val no_drop : drop_if_empty

no_drop does not drop any group, even empty and on borders.

  • since 1.5
val list_ : + ?drop:drop_if_empty -> + by:string -> + string -> + (string * int * int) list

list_ ?drop ~by s splits the given string s along the given separator by. Should only be used with very small separators, otherwise use Containers_string.KMP.

  • returns

    a list of slices (s,index,length) that are separated by by. String.sub can then be used to actually extract a string from the slice.

  • raises Failure

    if by = "".

val gen : + ?drop:drop_if_empty -> + by:string -> + string -> + (string * int * int) gen

gen ?drop ~by s splits the given string s along the given separator by. Returns a gen of slices.

val iter : + ?drop:drop_if_empty -> + by:string -> + string -> + (string * int * int) iter

iter ?drop ~by s splits the given string s along the given separator by. Returns an iter of slices.

  • since 2.8
val seq : + ?drop:drop_if_empty -> + by:string -> + string -> + (string * int * int) Stdlib.Seq.t

seq ?drop ~by s splits the given string s along the given separator by. Returns a Seq.t of slices. Renamed from std_seq since 3.0.

  • since 3.0
Copying functions

Those split functions actually copy the substrings, which can be more convenient but less efficient in general.

val list_cpy : ?drop:drop_if_empty -> by:string -> string -> string list

list_cpy ?drop ~by s splits the given string s along the given separator by. Returns a list of strings.

val gen_cpy : ?drop:drop_if_empty -> by:string -> string -> string gen

gen_cpy ?drop ~by s splits the given string s along the given separator by. Returns a gen of strings.

val iter_cpy : ?drop:drop_if_empty -> by:string -> string -> string iter

iter_cpy ?drop ~by s splits the given string s along the given separator by. Returns an iter of strings.

  • since 2.8
val seq_cpy : ?drop:drop_if_empty -> by:string -> string -> string Stdlib.Seq.t

seq_cpy ?drop ~by s splits the given string s along the given separator by. Returns a Seq.t of strings. Renamed from std_seq_cpy since 3.0.

  • since 3.0
val left : by:string -> string -> (string * string) option

left ~by s splits on the first occurrence of by from the leftmost part of the string s.

  • since 0.12
val left_exn : by:string -> string -> string * string

left_exn ~by s splits on the first occurrence of by from the leftmost part of the string s.

  • raises Not_found

    if by is not part of the string s.

  • since 0.16
val right : by:string -> string -> (string * string) option

right ~by s splits on the first occurrence of by from the rightmost part of the string s.

  • since 0.12
val right_exn : by:string -> string -> string * string

right_exn ~by s splits on the first occurrence of by from the rightmost part of the string s.

  • raises Not_found

    if by is not part of the string s.

  • since 0.16
\ No newline at end of file diff --git a/3.10/containers/CCStringLabels/index.html b/3.10/containers/CCStringLabels/index.html new file mode 100644 index 00000000..2c1938d8 --- /dev/null +++ b/3.10/containers/CCStringLabels/index.html @@ -0,0 +1,25 @@ + +CCStringLabels (containers.CCStringLabels)

Module CCStringLabels

Basic String Utils (Labeled version of CCString)

type 'a iter = ( 'a -> unit ) -> unit

Fast internal iterator.

  • since 2.8
type 'a gen = unit -> 'a option
include module type of struct include Stdlib.StringLabels end
type t = string
val make : int -> char -> string
val init : int -> f:( int -> char ) -> string
val empty : string
val of_bytes : bytes -> string
val to_bytes : string -> bytes
val get : string -> int -> char
val concat : sep:string -> string list -> string
val cat : string -> string -> string
val starts_with : prefix:string -> string -> bool
val ends_with : suffix:string -> string -> bool
val contains_from : string -> int -> char -> bool
val rcontains_from : string -> int -> char -> bool
val contains : string -> char -> bool
val sub : string -> pos:int -> len:int -> string
val map : f:( char -> char ) -> string -> string
val mapi : f:( int -> char -> char ) -> string -> string
val fold_left : f:( 'a -> char -> 'a ) -> init:'a -> string -> 'a
val fold_right : f:( char -> 'a -> 'a ) -> string -> init:'a -> 'a
val trim : string -> string
val escaped : string -> string
val iteri : f:( int -> char -> unit ) -> string -> unit
val index_from : string -> int -> char -> int
val index_from_opt : string -> int -> char -> int option
val rindex_from : string -> int -> char -> int
val rindex_from_opt : string -> int -> char -> int option
val index : string -> char -> int
val index_opt : string -> char -> int option
val rindex : string -> char -> int
val rindex_opt : string -> char -> int option
val to_seqi : t -> (int * char) Stdlib.Seq.t
val get_utf_8_uchar : t -> int -> Stdlib.Uchar.utf_decode
val is_valid_utf_8 : t -> bool
val get_utf_16be_uchar : t -> int -> Stdlib.Uchar.utf_decode
val is_valid_utf_16be : t -> bool
val get_utf_16le_uchar : t -> int -> Stdlib.Uchar.utf_decode
val is_valid_utf_16le : t -> bool
val create : int -> bytes
val copy : string -> string
val fill : bytes -> pos:int -> len:int -> char -> unit
val uppercase : string -> string
val lowercase : string -> string
val capitalize : string -> string
val uncapitalize : string -> string
val get_uint8 : string -> int -> int
val get_int8 : string -> int -> int
val get_uint16_ne : string -> int -> int
val get_uint16_be : string -> int -> int
val get_uint16_le : string -> int -> int
val get_int16_ne : string -> int -> int
val get_int16_be : string -> int -> int
val get_int16_le : string -> int -> int
val get_int32_ne : string -> int -> int32
val get_int32_be : string -> int -> int32
val get_int32_le : string -> int -> int32
val get_int64_ne : string -> int -> int64
val get_int64_be : string -> int -> int64
val get_int64_le : string -> int -> int64
val unsafe_get : string -> int -> char
val unsafe_set : bytes -> int -> char -> unit
val unsafe_blit : + src:string -> + src_pos:int -> + dst:bytes -> + dst_pos:int -> + len:int -> + unit
val unsafe_fill : bytes -> pos:int -> len:int -> char -> unit
val length : t -> int

length s returns the length (number of characters) of the given string s.

val blit : + src:t -> + src_pos:int -> + dst:Stdlib.Bytes.t -> + dst_pos:int -> + len:int -> + unit

blit ~src ~src_pos ~dst ~dst_pos ~len copies len characters from string src starting at character indice src_pos, to the Bytes sequence dst starting at character indice dst_pos. Like String.blit. Compatible with the -safe-string option.

  • raises Invalid_argument

    if indices are not valid.

val fold : f:( 'a -> char -> 'a ) -> init:'a -> t -> 'a

fold ~f ~init s folds on chars by increasing index. Computes f(… (f (f init s.[0]) s.[1]) …) s.[n-1].

  • since 0.7
val foldi : f:( 'a -> int -> char -> 'a ) -> 'a -> t -> 'a

foldi ~f init s is just like fold, but it also passes in the index of each chars as second argument to the folded function f.

  • since 3.3

Conversions

val to_gen : t -> char gen

to_gen s returns the gen of characters contained in the string s.

val to_iter : t -> char iter

to_iter s returns the iter of characters contained in the string s.

  • since 2.8
val to_seq : t -> char Stdlib.Seq.t

to_seq s returns the Seq.t of characters contained in the string s. Renamed from to std_seq since 3.0.

  • since 3.0
val to_list : t -> char list

to_list s returns the list of characters contained in the string s.

val pp_buf : Stdlib.Buffer.t -> t -> unit

pp_buf buf s prints s to the buffer buf. Renamed from pp since 2.0.

val pp : Stdlib.Format.formatter -> t -> unit

pp f s prints the string s within quotes to the formatter f. Renamed from print since 2.0.

Strings

val equal : string -> string -> bool

equal s1 s2 returns true iff the strings s1 and s2 are equal.

val compare : string -> string -> int

compare s1 s2 compares the strings s1 and s2 and returns an integer that indicates their relative position in the sort order.

val is_empty : string -> bool

is_empty s returns true iff s is empty (i.e. its length is 0).

  • since 1.5
val hash : string -> int

hash s returns the hash value of s.

val rev : string -> string

rev s returns the reverse of s.

  • since 0.17
val pad : ?side:[ `Left | `Right ] -> ?c:char -> int -> string -> string

pad ?side ?c n s ensures that the string s is at least n bytes long, and pads it on the side with c if it's not the case.

  • parameter side

    determines where padding occurs (default: `Left).

  • parameter c

    the char used to pad (default: ' ').

  • since 0.17
val of_char : char -> string

of_char 'a' is "a".

  • since 0.19
val of_gen : char gen -> string

of_gen gen converts a gen of characters to a string.

val of_iter : char iter -> string

of_iter iter converts an iter of characters to a string.

  • since 2.8
val of_seq : char Stdlib.Seq.t -> string

of_seq seq converts a seq of characters to a string. Renamed from of_std_seq since 3.0.

  • since 3.0
val of_list : char list -> string

of_list lc converts a list of characters lc to a string.

val of_array : char array -> string

of_array ac converts an array of characters ac to a string.

val to_array : string -> char array

to_array s returns the array of characters contained in the string s.

val find : ?start:int -> sub:string -> string -> int

find ?start ~sub s returns the starting index of the first occurrence of sub within s or -1.

  • parameter start

    starting position in s.

val find_all : ?start:int -> sub:string -> string -> int gen

find_all ?start ~sub s finds all occurrences of sub in s, even overlapping instances and returns them in a generator gen.

  • parameter start

    starting position in s.

  • since 0.17
val find_all_l : ?start:int -> sub:string -> string -> int list

find_all_l ?start ~sub s finds all occurrences of sub in s and returns them in a list.

  • parameter start

    starting position in s.

  • since 0.17
val mem : ?start:int -> sub:string -> string -> bool

mem ?start ~sub s is true iff sub is a substring of s.

  • since 0.12
val rfind : sub:string -> string -> int

rfind ~sub s finds sub in string s from the right, returns its first index or -1. Should only be used with very small sub.

  • since 0.12
val replace : + ?which:[ `Left | `Right | `All ] -> + sub:string -> + by:string -> + string -> + string

replace ?which ~sub ~by s replaces some occurrences of sub by by in s.

  • parameter which

    decides whether the occurrences to replace are:

    • `Left first occurrence from the left (beginning).
    • `Right first occurrence from the right (end).
    • `All all occurrences (default).
  • raises Invalid_argument

    if sub = "".

  • since 0.14
val is_sub : + sub:string -> + sub_pos:int -> + string -> + pos:int -> + sub_len:int -> + bool

is_sub ~sub ~sub_pos s ~pos ~sub_len returns true iff the substring of sub starting at position sub_pos and of length sub_len is a substring of s starting at position pos.

val repeat : string -> int -> string

repeat s n creates a string by repeating the string s n times.

val prefix : pre:string -> string -> bool

prefix ~pre s returns true iff pre is a prefix of s.

val suffix : suf:string -> string -> bool

suffix ~suf s returns true iff suf is a suffix of s.

  • since 0.7
val chop_prefix : pre:string -> string -> string option

chop_prefix ~pre s removes pre from s if pre really is a prefix of s, returns None otherwise.

  • since 0.17
val chop_suffix : suf:string -> string -> string option

chop_suffix ~suf s removes suf from s if suf really is a suffix of s, returns None otherwise.

  • since 0.17
val take : int -> string -> string

take n s keeps only the n first chars of s.

  • since 0.17
val drop : int -> string -> string

drop n s removes the n first chars of s.

  • since 0.17
val take_drop : int -> string -> string * string

take_drop n s is take n s, drop n s.

  • since 0.17
val lines : string -> string list

lines s returns a list of the lines of s (splits along '\n').

  • since 0.10
val lines_gen : string -> string gen

lines_gen s returns a generator gen of the lines of s (splits along '\n').

  • since 0.10
val lines_iter : string -> string iter

lines_iter s returns the iter of the lines of s (splits along '\n').

  • since 3.2
val lines_seq : string -> string Stdlib.Seq.t

lines_seq s returns the Seq.t of the lines of s (splits along '\n').

  • since 3.2
val concat_iter : sep:string -> string iter -> string

concat_iter ~sep iter concatenates all strings of iter, separated with sep.

  • since 3.2
val concat_gen : sep:string -> string gen -> string

concat_gen ~sep gen concatenates all strings of gen, separated with sep.

  • since 0.10
val concat_seq : sep:string -> string Stdlib.Seq.t -> string

concat_seq ~sep seq concatenates all strings of seq, separated with sep.

  • since 3.2
val unlines : string list -> string

unlines ls concatenates all strings of ls, separated with '\n'.

  • since 0.10
val unlines_gen : string gen -> string

unlines_gen gen concatenates all strings of gen, separated with '\n'.

  • since 0.10
val unlines_iter : string iter -> string

unlines_iter iter concatenates all strings of iter, separated with '\n'.

  • since 3.2
val unlines_seq : string Stdlib.Seq.t -> string

unlines_seq seq concatenates all strings of seq, separated with '\n'.

  • since 3.2
val set : string -> int -> char -> string

set s i c creates a new string which is a copy of s, except for index i, which becomes c.

  • raises Invalid_argument

    if i is an invalid index.

  • since 0.12
val iter : f:( char -> unit ) -> string -> unit

iter ~f s applies function f on each character of s. Alias to String.iter.

  • since 0.12
val filter_map : f:( char -> char option ) -> string -> string

filter_map ~f s calls (f a0) (f a1) … (f an) where a0 … an are the characters of s. It returns the string of characters ci such as f ai = Some ci (when f returns None, the corresponding element of s is discarded).

  • since 0.17
val filter : f:( char -> bool ) -> string -> string

filter ~f s discards characters of s not satisfying f.

  • since 0.17
val uniq : eq:( char -> char -> bool ) -> string -> string

uniq ~eq s remove consecutive duplicate characters in s.

  • since 3.4
val flat_map : ?sep:string -> f:( char -> string ) -> string -> string

flat_map ?sep ~f s maps each chars of s to a string, then concatenates them all.

  • parameter sep

    optional separator between each generated string.

  • since 0.12
val for_all : f:( char -> bool ) -> string -> bool

for_all ~f s is true iff all characters of s satisfy the predicate f.

  • since 0.12
val exists : f:( char -> bool ) -> string -> bool

exists ~f s is true iff some character of s satisfy the predicate f.

  • since 0.12
val drop_while : f:( char -> bool ) -> t -> t

drop_while ~f s discards any characters of s starting from the left, up to the first character c not satisfying f c.

  • since 2.2
val rdrop_while : f:( char -> bool ) -> t -> t

rdrop_while ~f s discards any characters of s starting from the right, up to the first character c not satisfying f c.

  • since 2.2
val ltrim : t -> t

ltrim s trims space on the left (see String.trim for more details).

  • since 1.2
val rtrim : t -> t

rtrim s trims space on the right (see String.trim for more details).

  • since 1.2

Operations on 2 strings

val map2 : f:( char -> char -> char ) -> string -> string -> string

map2 ~f s1 s2 maps pairs of chars.

  • raises Invalid_argument

    if the strings have not the same length.

  • since 0.12
val iter2 : f:( char -> char -> unit ) -> string -> string -> unit

iter2 ~f s1 s2 iterates on pairs of chars.

  • raises Invalid_argument

    if the strings have not the same length.

  • since 0.12
val iteri2 : f:( int -> char -> char -> unit ) -> string -> string -> unit

iteri2 ~f s1 s2 iterates on pairs of chars with their index.

  • raises Invalid_argument

    if the strings have not the same length.

  • since 0.12
val fold2 : f:( 'a -> char -> char -> 'a ) -> init:'a -> string -> string -> 'a

fold2 ~f ~init s1 s2 folds on pairs of chars.

  • raises Invalid_argument

    if the strings have not the same length.

  • since 0.12
val for_all2 : f:( char -> char -> bool ) -> string -> string -> bool

for_all2 ~f s1 s2 returns true iff all pairs of chars satisfy the predicate f.

  • raises Invalid_argument

    if the strings have not the same length.

  • since 0.12
val exists2 : f:( char -> char -> bool ) -> string -> string -> bool

exists2 ~f s1 s2 returns true iff a pair of chars satisfy the predicate f.

  • raises Invalid_argument

    if the strings have not the same length.

  • since 0.12

Ascii functions

Those functions are deprecated in String since 4.03, so we provide a stable alias for them even in older versions.

val capitalize_ascii : string -> string

capitalize_ascii s returns a copy of s with the first character set to uppercase using the US-ASCII character set. See String.

  • since 0.18
val uncapitalize_ascii : string -> string

uncapitalize_ascii s returns a copy of s with the first character set to lowercase using the US-ASCII character set. See String.

  • since 0.18
val uppercase_ascii : string -> string

uppercase_ascii s returns a copy of s with all lowercase letters translated to uppercase using the US-ASCII character set. See String.

  • since 0.18
val lowercase_ascii : string -> string

lowercase_ascii s returns a copy of s with all uppercase letters translated to lowercase using the US-ASCII character set. See String.

  • since 0.18
val equal_caseless : string -> string -> bool

equal_caseless s1 s2 compares s1 and s2 without respect to ascii lowercase.

  • since 1.2
val to_hex : string -> string

Convert a string with arbitrary content into a hexadecimal string.

  • since 3.8
val of_hex : string -> string option

Convert a string in hex into a string with arbitrary content.

  • since 3.8
val of_hex_exn : string -> string

Same as of_hex but fails harder.

  • raises Invalid_argument

    if the input is not valid hex.

  • since 3.8

Finding

A relatively efficient algorithm for finding sub-strings.

module Find : sig ... end

Splitting

module Split : sig ... end
val split_on_char : by:char -> string -> string list

split_on_char ~by s splits the string s along the given char by.

  • since 1.2
val split : by:string -> string -> string list

split ~by s splits the string s along the given string by. Alias to Split.list_cpy.

  • since 1.2

Utils

val compare_versions : string -> string -> int

compare_versions s1 s2 compares version strings s1 and s2, considering that numbers are above text.

  • since 0.13
val compare_natural : string -> string -> int

compare_natural s1 s2 is the Natural Sort Order, comparing chunks of digits as natural numbers. https://en.wikipedia.org/wiki/Natural_sort_order

  • since 1.3
val edit_distance : ?cutoff:int -> string -> string -> int

edit_distance ?cutoff s1 s2 is the edition distance between the two strings s1 and s2. This satisfies the classical distance axioms: it is always positive, symmetric, and satisfies the formula distance s1 s2 + distance s2 s3 >= distance s1 s3.

  • parameter cutoff

    if provided, it's a cap on both the number of iterations, and on the result. (since 3.0). This is useful if you just want to check whether the edit distance is less or equal than 2 (use cutoff of 3).

Infix operators

module Infix : sig ... end
include module type of Infix
val (=) : t -> t -> bool
  • since 3.0
val (<>) : t -> t -> bool
  • since 3.0
val (<) : t -> t -> bool
  • since 3.0
val (<=) : t -> t -> bool
  • since 3.0
val (>=) : t -> t -> bool
  • since 3.0
val (>) : t -> t -> bool
  • since 3.0
\ No newline at end of file diff --git a/3.10/containers/CCUnit/.dummy b/3.10/containers/CCUnit/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCUnit/index.html b/3.10/containers/CCUnit/index.html new file mode 100644 index 00000000..06d5aab8 --- /dev/null +++ b/3.10/containers/CCUnit/index.html @@ -0,0 +1,2 @@ + +CCUnit (containers.CCUnit)

Module CCUnit

include module type of struct include Stdlib.Unit end
type t = unit =
| ()
val equal : t -> t -> bool
val compare : t -> t -> int
val to_string : t -> string
\ No newline at end of file diff --git a/3.10/containers/CCUnix/.dummy b/3.10/containers/CCUnix/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCUnix/Infix/index.html b/3.10/containers/CCUnix/Infix/index.html new file mode 100644 index 00000000..a0ad456c --- /dev/null +++ b/3.10/containers/CCUnix/Infix/index.html @@ -0,0 +1,4 @@ + +Infix (containers.CCUnix.Infix)

Module CCUnix.Infix

val (?|) : ( 'a, Stdlib.Buffer.t, unit, call_result ) Stdlib.format4 -> 'a

Infix version of call.

  • since 0.11
val (?|&) : + ( 'a, Stdlib.Buffer.t, unit, async_call_result ) Stdlib.format4 -> + 'a

Infix version of async_call.

  • since 0.11
\ No newline at end of file diff --git a/3.10/containers/CCUnix/index.html b/3.10/containers/CCUnix/index.html new file mode 100644 index 00000000..33207e04 --- /dev/null +++ b/3.10/containers/CCUnix/index.html @@ -0,0 +1,64 @@ + +CCUnix (containers.CCUnix)

Module CCUnix

High-level Functions on top of Unix

Some useful functions built on top of Unix.

status: unstable

type 'a or_error = ( 'a, string ) Stdlib.result
type 'a gen = unit -> 'a option

Calling Commands

val escape_str : string -> string

Escape a string so it can be a shell argument.

type call_result = + < stdout : string + ; stderr : string + ; status : Unix.process_status + ; errcode : int >
val call_full : + ?bufsize:int -> + ?stdin:[ `Gen of string gen | `Str of string ] -> + ?env:string array -> + ( 'a, Stdlib.Buffer.t, unit, call_result ) Stdlib.format4 -> + 'a

call_full cmd wraps the result of Unix.open_process_full cmd into an object. It reads the full stdout and stderr of the subprocess before returning. cmd can be a format string as in Printf.

  • parameter stdin

    if provided, the generator or string is consumed and fed to the subprocess input channel, which is then closed.

  • parameter bufsize

    buffer size used to read stdout and stderr.

  • parameter env

    environment to run the command in.

    Example:

    # CCUnix.call_full "ls %s" (CCUnix.escape_str "/");;
val call : + ?bufsize:int -> + ?stdin:[ `Gen of string gen | `Str of string ] -> + ?env:string array -> + ( 'a, Stdlib.Buffer.t, unit, string * string * int ) Stdlib.format4 -> + 'a

call cmd is similar to call_full but returns a tuple stdout, stderr, errcode instead of an object.

val call_stdout : + ?bufsize:int -> + ?stdin:[ `Gen of string gen | `Str of string ] -> + ?env:string array -> + ( 'a, Stdlib.Buffer.t, unit, string ) Stdlib.format4 -> + 'a
type line = string
type async_call_result = + < stdout : line gen + ; stderr : line gen + ; stdin : line -> unit + ; close_in : unit + ; close_err : unit + ; close_out : unit + ; close_all : unit + ; wait : Unix.process_status + ; wait_errcode : int >

A subprocess for interactive usage (read/write channels line by line)

  • since 0.11
val async_call : + ?env:string array -> + ( 'a, Stdlib.Buffer.t, unit, async_call_result ) Stdlib.format4 -> + 'a

Spawns a subprocess, like call, but the subprocess's channels are line generators and line sinks (for stdin). If p is async_call "cmd", then p#wait waits for the subprocess to die. Channels can be closed independently.

  • since 0.11

Accessors

val stdout : < stdout : 'a.. > -> 'a
val stderr : < stderr : 'a.. > -> 'a
val status : < status : 'a.. > -> 'a
val errcode : < errcode : 'a.. > -> 'a

Simple IO

val with_in : + ?mode:int -> + ?flags:Unix.open_flag list -> + string -> + f:( Stdlib.in_channel -> 'a ) -> + 'a

Open an input file with the given optional flag list, calls the function on the input channel. When the function raises or returns, the channel is closed.

  • parameter flags

    opening flags. Unix.O_RDONLY is used in any cases.

  • since 0.16
val with_out : + ?mode:int -> + ?flags:Unix.open_flag list -> + string -> + f:( Stdlib.out_channel -> 'a ) -> + 'a

Same as with_in but for an output channel.

  • parameter flags

    opening flags (default [Unix.O_CREAT; Unix.O_TRUNC]) Unix.O_WRONLY is used in any cases.

  • since 0.16

Subprocesses

val with_process_in : string -> f:( Stdlib.in_channel -> 'a ) -> 'a

Open a shell command in a subprocess and obtain a handle to its stdout.

CCUnix.with_process_in "ls /tmp" ~f:CCIO.read_lines_l;;
  • since 0.16
val with_process_out : string -> f:( Stdlib.out_channel -> 'a ) -> 'a

Open a shell command in a subprocess and obtain a handle to its stdin.

  • since 0.16
type process_full = + < stdin : Stdlib.out_channel + ; stdout : Stdlib.in_channel + ; stderr : Stdlib.in_channel + ; close : Unix.process_status >

Handle to a subprocess.

  • since 0.16
val with_process_full : + ?env:string array -> + string -> + f:( process_full -> 'a ) -> + 'a

Open a subprocess and obtain a handle to its channels.

  • parameter env

    environment to pass to the subprocess.

  • since 0.16
val ensure_session_leader : unit -> unit

On unix, call Unix.setsid() to make sure subprocesses die at the same time as the current process. Does nothing on windows. Idempotent: it can be called several times but will only have effects, if any, the first time.

  • since 2.8

Networking

val with_connection : + Unix.sockaddr -> + f:( Stdlib.in_channel -> Stdlib.out_channel -> 'a ) -> + 'a

Wrap Unix.open_connection with a handler.

  • since 0.16
exception ExitServer
val establish_server : + Unix.sockaddr -> + f:( Stdlib.in_channel -> Stdlib.out_channel -> _ ) -> + unit

Listen on the address and calls the handler in a blocking fashion. Using Thread is recommended if handlers might take time. The callback should raise ExitServer to stop the loop.

  • since 0.16

File lock

val with_file_lock : kind:[ `Read | `Write ] -> string -> ( unit -> 'a ) -> 'a

with_file_lock ~kind filename f puts a lock on the offset 0 of the file named filename, calls f and returns its result after the file is unlocked. If f () raises an exception the exception is re-raised after the file is unlocked.

  • parameter kind

    specifies whether the lock is read-only or read-write.

  • since 1.2

Infix Functions

module Infix : sig ... end
include module type of Infix
val (?|) : ( 'a, Stdlib.Buffer.t, unit, call_result ) Stdlib.format4 -> 'a

Infix version of call.

  • since 0.11
val (?|&) : + ( 'a, Stdlib.Buffer.t, unit, async_call_result ) Stdlib.format4 -> + 'a

Infix version of async_call.

  • since 0.11

Temporary directory

val with_temp_dir : + ?mode:int -> + ?dir:string -> + string -> + ( string -> 'a ) -> + 'a

Create a temporary directory, call the function, and then destroy the directory afterwards. Usage with_temp_dir pattern f.

  • parameter pattern

    the naming pattern for the temporary directory. Helps avoiding collisions.

  • parameter mode

    mode for the directory

  • parameter dir

    the directory under which to make a temporary directory (default /tmp)

    Note that this is implemented following the discussion at: https://discuss.ocaml.org/t/how-to-create-a-temporary-directory-in-ocaml/1815/

  • since 2.8
\ No newline at end of file diff --git a/3.10/containers/CCUtf8_string/.dummy b/3.10/containers/CCUtf8_string/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCUtf8_string/index.html b/3.10/containers/CCUtf8_string/index.html new file mode 100644 index 00000000..b596a760 --- /dev/null +++ b/3.10/containers/CCUtf8_string/index.html @@ -0,0 +1,2 @@ + +CCUtf8_string (containers.CCUtf8_string)

Module CCUtf8_string

Unicode String, in UTF8

A unicode string represented by a utf8 bytestring. This representation is convenient for manipulating normal OCaml strings that are encoded in UTF8.

We perform only basic decoding and encoding between codepoints and bytestrings. For more elaborate operations, please use the excellent Uutf.

status: experimental

type uchar = Stdlib.Uchar.t
type 'a gen = unit -> 'a option
type 'a iter = ( 'a -> unit ) -> unit

Fast internal iterator.

  • since 2.8
type t = private string

A UTF8 string

val equal : t -> t -> bool
val hash : t -> int
val compare : t -> t -> int
val pp : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string

Identity.

exception Malformed of string * int

Malformed string at given offset

val to_gen : ?idx:int -> t -> uchar gen

Generator of unicode codepoints.

  • parameter idx

    offset where to start the decoding.

val to_iter : ?idx:int -> t -> uchar iter

Iterator of unicode codepoints.

  • parameter idx

    offset where to start the decoding.

  • since 2.8
val to_seq : ?idx:int -> t -> uchar Stdlib.Seq.t

Iter of unicode codepoints. Renamed from to_std_seq since 3.0.

  • parameter idx

    offset where to start the decoding.

  • since 3.0
val to_list : ?idx:int -> t -> uchar list

List of unicode codepoints.

  • parameter idx

    offset where to start the decoding.

val fold : ?idx:int -> ( 'a -> uchar -> 'a ) -> 'a -> t -> 'a
val iter : ?idx:int -> ( uchar -> unit ) -> t -> unit
val n_chars : t -> int

Number of characters.

val n_bytes : t -> int

Number of bytes.

val map : ( uchar -> uchar ) -> t -> t
val filter_map : ( uchar -> uchar option ) -> t -> t
val flat_map : ( uchar -> t ) -> t -> t
val empty : t

Empty string.

  • since 3.5
val append : t -> t -> t

Append two string together.

val concat : t -> t list -> t

concat sep l concatenates each string in l, inserting sep in between each string. Similar to String.concat.

val of_uchar : uchar -> t

of_char c is a string with only one unicode char in it.

  • since 3.5
val make : int -> uchar -> t

make n c makes a new string with n copies of c in it.

  • since 3.5
val of_seq : uchar Stdlib.Seq.t -> t

Build a string from unicode codepoints Renamed from of_std_seq since 3.0.

  • since 3.0
val of_iter : uchar iter -> t

Build a string from unicode codepoints

  • since 2.8
val uchar_to_bytes : uchar -> char iter

Translate the unicode codepoint to a list of utf-8 bytes. This can be used, for example, in combination with Buffer.add_char on a pre-allocated buffer to add the bytes one by one (despite its name, Buffer.add_char takes individual bytes, not unicode codepoints).

  • since 3.2
val of_gen : uchar gen -> t
val of_list : uchar list -> t
val of_string_exn : string -> t

Validate string by checking it is valid UTF8.

  • raises Invalid_argument

    if the string is not valid UTF8.

val of_string : string -> t option

Safe version of of_string_exn.

val is_valid : string -> bool

Valid UTF8?

val unsafe_of_string : string -> t

Conversion from a string without validating. CAUTION this is unsafe and can break all the other functions in this module. Use only if you're sure the string is valid UTF8. Upon iteration, if an invalid substring is met, Malformed will be raised.

\ No newline at end of file diff --git a/3.10/containers/CCVector/.dummy b/3.10/containers/CCVector/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/CCVector/index.html b/3.10/containers/CCVector/index.html new file mode 100644 index 00000000..37dee65f --- /dev/null +++ b/3.10/containers/CCVector/index.html @@ -0,0 +1,17 @@ + +CCVector (containers.CCVector)

Module CCVector

Growable, mutable vector

type ro = [
| `RO
]
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 a mutability flat 'mut.

type 'a vector = ( 'a, rw ) t

Type synonym: a 'a vector is mutable.

type 'a ro_vector = ( 'a, ro ) t

Alias for immutable vectors.

  • since 0.15
type 'a iter = ( 'a -> unit ) -> unit

Fast internal iterator.

  • since 2.8
type 'a gen = unit -> 'a option
type 'a equal = 'a -> 'a -> bool
type 'a ord = 'a -> 'a -> int
type 'a printer = Stdlib.Format.formatter -> 'a -> unit
val freeze : ( 'a, _ ) t -> ( 'a, ro ) t

Make an immutable vector (no copy! Don't use the old version).

val freeze_copy : ( 'a, _ ) t -> ( 'a, ro ) t

Copy the vector into an immutable version.

val create : unit -> ( 'a, rw ) t

Create a new, empty vector.

val create_with : ?capacity:int -> 'a -> ( 'a, rw ) t

Create a new vector, the value is used to enforce the type the new vector.

  • parameter capacity

    the size of the underlying array.

val return : 'a -> ( 'a, 'mut ) t

Singleton vector.

  • since 0.14
val make : int -> 'a -> ( 'a, 'mut ) t

make n x makes a vector of size n, filled with x.

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. This ensures that length v = 0 but the underlying array is kept, and possibly references to former elements, which are therefore not garbage collectible.

val clear_and_reset : ( 'a, rw ) t -> unit

Clear the content of the vector, and deallocate the underlying array, removing references to all the elements. The elements can be collected.

  • since 2.8
val ensure_with : init:'a -> ( 'a, rw ) t -> int -> unit

Hint to the vector that it should have at least the given capacity. This does not affect length v.

  • parameter init

    if capacity v = 0, used to enforce the type of the vector (see create_with).

  • raises Invalid_arg

    if the size is not suitable (negative, or too big for OCaml arrays)

  • since 0.14
val ensure : ( 'a, rw ) t -> int -> unit

Hint to the vector that it should have at least the given capacity. Just a hint, will not be enforced if the vector is empty and init is not provided.

  • raises Invalid_arg

    if the size is not suitable (negative, or too big for OCaml arrays)

val is_empty : ( 'a, _ ) t -> bool

Is the vector empty?

val push : ( 'a, rw ) t -> 'a -> unit

Add an element at the end of the vector.

val resize_with : ( 'a, rw ) t -> ( int -> 'a ) -> int -> unit

resize_with vec f size resizes vector vec up to size, fills vector with calls to f on indexes [vec.size-1.. size - 1]. The contents and size of vec are untouched if size is inferior or equal to length vec.

  • raises Invalid_argument

    if the size is too big

  • since 3.7
val resize_with_init : ( 'a, rw ) t -> init:'a -> int -> unit

resize_with_init vec init size resizes vector vec up to size, fills vector with calls to init on indexes [length vec -1.. size - 1]. The contents and size of vec are untouched if size is inferior or equal to length vec.

  • raises Invalid_argument

    if the size is too big

  • since 3.7
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

Like append, with an array.

val append_iter : ( 'a, rw ) t -> 'a iter -> unit

Append content of iterator.

  • since 2.8
val append_seq : ( 'a, rw ) t -> 'a Stdlib.Seq.t -> unit

Append content of iterator. Renamed from append_std_seq since 3.0.

  • since 3.0
val append_list : ( 'a, rw ) t -> 'a list -> unit

Append content of list.

  • since 0.14
val append_gen : ( 'a, rw ) t -> 'a gen -> unit

Append content of generator.

  • since 0.20
val equal : 'a equal -> ( 'a, _ ) t equal
val compare : 'a ord -> ( 'a, _ ) t ord

Total ordering on vectors. Lexicographic comparison.

exception Empty

Raised on empty stack.

val pop : ( 'a, rw ) t -> 'a option

Remove last element, or None.

val pop_exn : ( 'a, rw ) t -> 'a

Remove last element, or raise an exception if empty.

  • raises Empty

    on an empty vector.

val top : ( 'a, _ ) t -> 'a option

Top element, if present.

  • since 0.6
val top_exn : ( 'a, _ ) t -> 'a

Top element, if present.

  • raises Empty

    on an empty vector.

  • since 0.6
val copy : ( 'a, _ ) t -> ( 'a, 'mut ) t

Shallow copy (may give an immutable or mutable vector).

val truncate : ( 'a, rw ) t -> int -> unit

Truncate to the given size (remove elements above this size). Does nothing if the parameter is bigger than the current size. truncate was called shrink.

  • since 3.0
val shrink_to_fit : ( 'a, _ ) t -> unit

Shrink internal array to fit the size of the vector

  • since 2.8
val member : eq:( 'a -> 'a -> bool ) -> 'a -> ( 'a, _ ) t -> bool

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 w.r.t the given ordering. The vector itself is unchanged. The underlying array of the new vector can be smaller than the original one.

val sort' : ( 'a -> 'a -> int ) -> ( 'a, rw ) t -> unit

Sort the vector in place (modifying it). This function change the size of the underlying array.

val uniq_sort : ( 'a -> 'a -> int ) -> ( 'a, rw ) t -> unit

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.

val iteri : ( int -> 'a -> unit ) -> ( 'a, _ ) t -> unit

Iterate on the vector, with indexes.

val map : ( 'a -> 'b ) -> ( 'a, _ ) t -> ( 'b, 'mut ) t

Map elements of the vector, yielding a new vector.

val mapi : ( int -> 'a -> 'b ) -> ( 'a, _ ) t -> ( 'b, 'mut ) t

map f v is just like map, but it also passes in the index of each element as the first argument to the function f.

  • since 2.8
val map_in_place : ( 'a -> 'a ) -> ( 'a, _ ) t -> unit

Map elements of the vector in place

  • since 2.3
val filter : ( 'a -> bool ) -> ( 'a, _ ) t -> ( 'a, 'mut ) t

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_in_place : ( 'a -> bool ) -> ( 'a, rw ) t -> unit

Filter elements from the vector in place.

  • since 3.0
val fold : ( 'b -> 'a -> 'b ) -> 'b -> ( 'a, _ ) t -> 'b

Fold on elements of the vector

val exists : ( 'a -> bool ) -> ( 'a, _ ) t -> bool

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?).

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

  • raises Not_found

    if no element does.

val find_map : ( 'a -> 'b option ) -> ( 'a, _ ) t -> 'b option

find_map f v returns the first Some y = f x for x in v, or None if f x = None for each x in v.

  • since 0.14
val filter_map : ( 'a -> 'b option ) -> ( 'a, _ ) t -> ( 'b, 'mut ) t

Map elements with a function, possibly filtering some of them out.

val filter_map_in_place : ( 'a -> 'a option ) -> ( 'a, _ ) t -> unit

Filter-map elements of the vector in place

  • since 2.3
val flat_map : ( 'a -> ( 'b, _ ) t ) -> ( 'a, _ ) t -> ( 'b, 'mut ) t

Map each element to a sub-vector.

val flat_map_seq : ( 'a -> 'b Stdlib.Seq.t ) -> ( 'a, _ ) t -> ( 'b, 'mut ) t

Like flat_map, but using Seq for intermediate collections. Renamed from flat_map_std_seq since 3.0.

  • since 3.0
val flat_map_list : ( 'a -> 'b list ) -> ( 'a, _ ) t -> ( 'b, 'mut ) t

Like flat_map, but using list for intermediate collections.

  • since 0.14
val monoid_product : + ( 'a -> 'b -> 'c ) -> + ( 'a, _ ) t -> + ( 'b, _ ) t -> + ( 'c, _ ) t

All combinaisons of tuples from the two vectors are passed to the function.

  • since 2.8
val (>>=) : ( 'a, _ ) t -> ( 'a -> ( 'b, _ ) t ) -> ( 'b, 'mut ) t

Infix version of flat_map.

val (>|=) : ( 'a, _ ) t -> ( 'a -> 'b ) -> ( 'b, 'mut ) t

Infix version of map.

val get : ( 'a, _ ) t -> int -> 'a

Access element by its index, or

  • raises Invalid_argument

    if bad index.

val set : ( 'a, rw ) t -> int -> 'a -> unit

Modify element at given index, or

  • raises Invalid_argument

    if the index is invalid (i.e. not in [0.. length v-1]).

val remove_and_shift : ( 'a, rw ) t -> int -> unit

remove_and_shift v i remove the i-th element from v. Move elements that are after the i-th in v, in linear time. Preserve the order of the elements in v. See remove_unordered for constant time removal function that doesn't preserve the order of elements.

  • since 3.0
val remove_unordered : ( 'a, rw ) t -> int -> unit

remove_unordered v i remove the i-th element from v. Does NOT preserve the order of the elements in v (might swap with the last element). See remove_and_shift if you want to keep the ordering.

val insert : ( 'a, rw ) t -> int -> 'a -> unit

insert v i x insert the given element at index i. Elements at location i and later are first shifted over in linear time before inserting x. Preserve the order of elements in v.

  • since 3.7
val rev : ( 'a, _ ) t -> ( 'a, 'mut ) t

Reverse the vector.

val rev_in_place : ( 'a, rw ) t -> unit

Reverse the vector in place.

  • since 0.14
val rev_iter : ( 'a -> unit ) -> ( 'a, _ ) t -> unit

rev_iter f a is the same as iter f (rev a), only more efficient.

  • since 0.14
val size : ( 'a, _ ) t -> int

Number of elements in the vector.

val length : ( _, _ ) t -> int

Synonym for size.

val capacity : ( _, _ ) t -> int

Number of elements the vector can contain without being resized.

val unsafe_get_array : ( 'a, rw ) t -> 'a array

Access the underlying shared array (do not modify!). unsafe_get_array v is longer than size v, but elements at higher index than size v are undefined (do not access!).

val (--) : int -> int -> ( int, 'mut ) t

Range of integers, either ascending or descending (both included, therefore the result is never empty). Example: 1 -- 10 returns the vector [1;2;3;4;5;6;7;8;9;10].

val (--^) : int -> int -> ( int, 'mut ) t

Range of integers, either ascending or descending, but excluding right. Example: 1 --^ 10 returns the vector [1;2;3;4;5;6;7;8;9].

  • since 0.17
val of_array : 'a array -> ( 'a, 'mut ) t

of_array a returns a vector corresponding to the array a. Operates in O(n) time.

val of_list : 'a list -> ( 'a, 'mut ) t
val to_array : ( 'a, _ ) t -> 'a array

to_array v returns an array corresponding to the vector v.

val to_list : ( 'a, _ ) t -> 'a list

Return a list with the elements contained in the vector.

val of_iter : ?init:( 'a, rw ) t -> 'a iter -> ( 'a, rw ) t

Convert an Iterator to a vector.

  • since 2.8.1
val of_seq : ?init:( 'a, rw ) t -> 'a Stdlib.Seq.t -> ( 'a, rw ) t

Convert an Iterator to a vector. Renamed from of_std_seq since 3.0.

  • since 3.0
val to_iter : ( 'a, _ ) t -> 'a iter

Return a iter with the elements contained in the vector.

  • since 2.8
val to_iter_rev : ( 'a, _ ) t -> 'a iter

to_iter_rev v returns the sequence of elements of v in reverse order, that is, the last elements of v are iterated on first.

  • since 2.8
val to_seq : ( 'a, _ ) t -> 'a Stdlib.Seq.t

Return an iterator with the elements contained in the vector. Renamed from to_std_seq since 3.0.

  • since 3.0
val to_seq_rev : ( 'a, _ ) t -> 'a Stdlib.Seq.t

to_seq v returns the sequence of elements of v in reverse order, that is, the last elements of v are iterated on first. Renamed from to_std_seq since 3.0.

  • since 3.0
val slice : ( 'a, rw ) t -> 'a array * int * int

Vector as an array slice. By doing it we expose the internal array, so be careful!.

val slice_iter : ( 'a, _ ) t -> int -> int -> 'a iter

slice_iter v start len is the sequence of elements from v.(start) to v.(start+len-1).

  • since 3.0
val of_gen : ?init:( 'a, rw ) t -> 'a gen -> ( 'a, rw ) t
val to_gen : ( 'a, _ ) t -> 'a gen
val to_string : + ?start:string -> + ?stop:string -> + ?sep:string -> + ( 'a -> string ) -> + ( 'a, _ ) t -> + string

Print the vector in a string

  • since 2.7
val pp : + ?pp_start:unit printer -> + ?pp_stop:unit printer -> + ?pp_sep:unit printer -> + 'a printer -> + ( 'a, _ ) t printer

pp ~pp_start ~pp_stop ~pp_sep pp_item ppf v formats the vector v on ppf. Each element is formatted with pp_item, pp_start is called at the beginning, pp_stop is called at the end, pp_sep is called between each elements. By defaults pp_start and pp_stop does nothing and pp_sep defaults to (fun out -> Format.fprintf out ",@ ").

val let+ : ( 'a, 'e ) t -> ( 'a -> 'b ) -> ( 'b, 'e ) t
  • since 2.8
val and+ : ( 'a, 'e ) t -> ( 'b, 'e ) t -> ( 'a * 'b, 'e ) t
  • since 2.8
val let* : ( 'a, 'e ) t -> ( 'a -> ( 'b, 'e ) t ) -> ( 'b, 'e ) t
  • since 2.8
val and* : ( 'a, 'e ) t -> ( 'b, 'e ) t -> ( 'a * 'b, 'e ) t
  • since 2.8
\ No newline at end of file diff --git a/3.10/containers/Containers/.dummy b/3.10/containers/Containers/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/Containers/Hashtbl/Make/index.html b/3.10/containers/Containers/Hashtbl/Make/index.html new file mode 100644 index 00000000..6a72bb6e --- /dev/null +++ b/3.10/containers/Containers/Hashtbl/Make/index.html @@ -0,0 +1,2 @@ + +Make (containers.Containers.Hashtbl.Make)

Module Hashtbl.Make

Parameters

module H : Stdlib__Hashtbl.HashedType

Signature

type key = H.t
type !'a t = 'a Stdlib__Hashtbl.Make(H).t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : ( key -> 'a -> unit ) -> 'a t -> unit
val filter_map_inplace : ( key -> 'a -> 'a option ) -> 'a t -> unit
val fold : ( key -> 'a -> 'b -> 'b ) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> Stdlib__Hashtbl.statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
\ No newline at end of file diff --git a/3.10/containers/Containers/Hashtbl/MakeSeeded/index.html b/3.10/containers/Containers/Hashtbl/MakeSeeded/index.html new file mode 100644 index 00000000..5e876b66 --- /dev/null +++ b/3.10/containers/Containers/Hashtbl/MakeSeeded/index.html @@ -0,0 +1,2 @@ + +MakeSeeded (containers.Containers.Hashtbl.MakeSeeded)

Module Hashtbl.MakeSeeded

Parameters

module H : SeededHashedType

Signature

type key = H.t
type !'a t = 'a Stdlib__Hashtbl.MakeSeeded(H).t
val create : ?random:bool -> int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : ( key -> 'a -> unit ) -> 'a t -> unit
val filter_map_inplace : ( key -> 'a -> 'a option ) -> 'a t -> unit
val fold : ( key -> 'a -> 'b -> 'b ) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
\ No newline at end of file diff --git a/3.10/containers/Containers/Hashtbl/index.html b/3.10/containers/Containers/Hashtbl/index.html new file mode 100644 index 00000000..0af7e648 --- /dev/null +++ b/3.10/containers/Containers/Hashtbl/index.html @@ -0,0 +1,33 @@ + +Hashtbl (containers.Containers.Hashtbl)

Module Containers.Hashtbl

include module type of Stdlib.Hashtbl + with type statistics = Stdlib.Hashtbl.statistics + and module Make = Stdlib.Hashtbl.Make + and type ('a, 'b) t = ( 'a, 'b ) Stdlib.Hashtbl.t
type (!'a0, !'b0) t = ( 'a, 'b ) Stdlib.Hashtbl.t
val create : ?random:bool -> int -> ( 'a, 'b ) t
val clear : ( 'a, 'b ) t -> unit
val reset : ( 'a, 'b ) t -> unit
val copy : ( 'a, 'b ) t -> ( 'a, 'b ) t
val add : ( 'a, 'b ) t -> 'a -> 'b -> unit
val find : ( 'a, 'b ) t -> 'a -> 'b
val find_opt : ( 'a, 'b ) t -> 'a -> 'b option
val find_all : ( 'a, 'b ) t -> 'a -> 'b list
val mem : ( 'a, 'b ) t -> 'a -> bool
val remove : ( 'a, 'b ) t -> 'a -> unit
val replace : ( 'a, 'b ) t -> 'a -> 'b -> unit
val iter : ( 'a -> 'b -> unit ) -> ( 'a, 'b ) t -> unit
val filter_map_inplace : ( 'a -> 'b -> 'b option ) -> ( 'a, 'b ) t -> unit
val fold : ( 'a -> 'b -> 'c -> 'c ) -> ( 'a, 'b ) t -> 'c -> 'c
val length : ( 'a, 'b ) t -> int
val randomize : unit -> unit
val is_randomized : unit -> bool
val rebuild : ?random:bool -> ( 'a, 'b ) t -> ( 'a, 'b ) t
type statistics = Stdlib.Hashtbl.statistics = {
num_bindings : int;
num_buckets : int;
max_bucket_length : int;
bucket_histogram : int array;
}
val stats : ( 'a, 'b ) t -> statistics
val to_seq : ( 'a, 'b ) t -> ('a * 'b) Stdlib.Seq.t
val to_seq_keys : ( 'a, 'b ) t -> 'a Stdlib.Seq.t
val to_seq_values : ( 'a, 'b ) t -> 'b Stdlib.Seq.t
val replace_seq : ( 'a, 'b ) t -> ('a * 'b) Stdlib.Seq.t -> unit
module type HashedType = sig ... end
module type S = sig ... end
module Make (H : Stdlib__Hashtbl.HashedType) : sig ... end
module type SeededHashedType = sig ... end
module type SeededS = sig ... end
module MakeSeeded (H : SeededHashedType) : sig ... end
val hash : 'a -> int
val seeded_hash : int -> 'a -> int
val hash_param : int -> int -> 'a -> int
val seeded_hash_param : int -> int -> int -> 'a -> int
include module type of struct include CCHashtbl.Poly end
val get : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'a -> 'b option

get tbl k finds a binding for the key k if present, or returns None if no value is found. Safe version of Hashtbl.find.

val get_or : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'a -> default:'b -> 'b

get_or tbl k ~default returns the value associated to k if present, and returns default otherwise (if k doesn't belong in tbl).

  • since 0.16
val keys : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'a CCHashtbl.iter

keys tbl f iterates on keys (similar order as Hashtbl.iter).

val values : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'b CCHashtbl.iter

values tbl f iterates on values in the table tbl.

val keys_list : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'a list

keys_list tbl is the list of keys in tbl. If the key is in the Hashtable multiple times, all occurrences will be returned.

  • since 0.8
val values_list : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'b list

values_list tbl is the list of values in tbl.

  • since 0.8
val map_list : ( 'a -> 'b -> 'c ) -> ( 'a, 'b ) Stdlib.Hashtbl.t -> 'c list

map_list f tbl maps on a tbl's items. Collect into a list.

val incr : ?by:int -> ( 'a, int ) Stdlib.Hashtbl.t -> 'a -> unit

incr ?by tbl x increments or initializes the counter associated with x. If get tbl x = None, then after update, get tbl x = Some 1; otherwise, if get tbl x = Some n, now get tbl x = Some (n+1).

  • parameter by

    if specified, the int value is incremented by by rather than 1.

  • since 0.16
val decr : ?by:int -> ( 'a, int ) Stdlib.Hashtbl.t -> 'a -> unit

decr ?by tbl x is like incr but subtract 1 (or the value of by). If the value reaches 0, the key is removed from the table. This does nothing if the key is not already present in the table.

  • since 0.16
val to_iter : ( 'a, 'b ) Stdlib.Hashtbl.t -> ('a * 'b) CCHashtbl.iter

Iterate on bindings in the table.

  • since 2.8
val add_list : ( 'a, 'b list ) Stdlib.Hashtbl.t -> 'a -> 'b -> unit

add_list tbl x y adds y to the list x is bound to. If x is not bound, it becomes bound to y.

  • since 0.16
val add_iter : ( 'a, 'b ) Stdlib.Hashtbl.t -> ('a * 'b) CCHashtbl.iter -> unit

Add the corresponding pairs to the table, using Hashtbl.add.

  • since 2.8
val add_iter_with : + f:( 'a -> 'b -> 'b -> 'b ) -> + ( 'a, 'b ) Stdlib.Hashtbl.t -> + ('a * 'b) CCHashtbl.iter -> + unit

Add the corresponding pairs to the table, using Hashtbl.add. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val add_seq : ( 'a, 'b ) Stdlib.Hashtbl.t -> ('a * 'b) Stdlib.Seq.t -> unit

Add the corresponding pairs to the table, using Hashtbl.add. Renamed from add_std_seq since 3.0.

  • since 3.0
val add_seq_with : + f:( 'a -> 'b -> 'b -> 'b ) -> + ( 'a, 'b ) Stdlib.Hashtbl.t -> + ('a * 'b) Stdlib.Seq.t -> + unit

Add the corresponding pairs to the table. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val of_iter : ('a * 'b) CCHashtbl.iter -> ( 'a, 'b ) Stdlib.Hashtbl.t

From the given bindings, added in order.

  • since 2.8
val of_iter_with : + f:( 'a -> 'b -> 'b -> 'b ) -> + ('a * 'b) CCHashtbl.iter -> + ( 'a, 'b ) Stdlib.Hashtbl.t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val of_seq : ('a * 'b) Stdlib.Seq.t -> ( 'a, 'b ) Stdlib.Hashtbl.t

From the given bindings, added in order. Renamed from of_std_seq since 3.0.

  • since 3.0
val of_seq_with : + f:( 'a -> 'b -> 'b -> 'b ) -> + ('a * 'b) Stdlib.Seq.t -> + ( 'a, 'b ) Stdlib.Hashtbl.t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val add_iter_count : ( 'a, int ) Stdlib.Hashtbl.t -> 'a CCHashtbl.iter -> unit

add_iter_count tbl i increments the count of each element of i by calling incr. This is useful for counting how many times each element of i occurs.

  • since 2.8
val add_seq_count : ( 'a, int ) Stdlib.Hashtbl.t -> 'a Stdlib.Seq.t -> unit

add_seq_count tbl seq increments the count of each element of seq by calling incr. This is useful for counting how many times each element of seq occurs. Renamed from add_std_seq_count since 3.0.

  • since 3.0
val of_iter_count : 'a CCHashtbl.iter -> ( 'a, int ) Stdlib.Hashtbl.t

Like add_seq_count, but allocates a new table and returns it.

  • since 2.8
val of_seq_count : 'a Stdlib.Seq.t -> ( 'a, int ) Stdlib.Hashtbl.t

Like add_seq_count, but allocates a new table and returns it. Renamed from of_std_seq_count since 3.0.

  • since 3.0
val to_list : ( 'a, 'b ) Stdlib.Hashtbl.t -> ('a * 'b) list

to_list tbl returns the list of (key,value) bindings (order unspecified).

val of_list : ('a * 'b) list -> ( 'a, 'b ) Stdlib.Hashtbl.t

of_list l builds a table from the given list l of bindings k_i -> v_i, added in order using add. If a key occurs several times, it will be added several times, and the visible binding will be the last one.

val of_list_with : + f:( 'a -> 'b -> 'b -> 'b ) -> + ('a * 'b) list -> + ( 'a, 'b ) Stdlib.Hashtbl.t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val update : + ( 'a, 'b ) Stdlib.Hashtbl.t -> + f:( 'a -> 'b option -> 'b option ) -> + k:'a -> + unit

update tbl ~f ~k updates key k by calling f k (Some v) if k was mapped to v, or f k None otherwise; if the call returns None then k is removed/stays removed, if the call returns Some v' then the binding k -> v' is inserted using Hashtbl.replace.

  • since 0.14
val get_or_add : ( 'a, 'b ) Stdlib.Hashtbl.t -> f:( 'a -> 'b ) -> k:'a -> 'b

get_or_add tbl ~k ~f finds and returns the binding of k in tbl, if it exists. If it does not exist, then f k is called to obtain a new binding v; k -> v is added to tbl and v is returned.

  • since 1.0
val pp : + ?pp_start:unit CCHashtbl.printer -> + ?pp_stop:unit CCHashtbl.printer -> + ?pp_sep:unit CCHashtbl.printer -> + ?pp_arrow:unit CCHashtbl.printer -> + 'a CCHashtbl.printer -> + 'b CCHashtbl.printer -> + ( 'a, 'b ) Stdlib.Hashtbl.t CCHashtbl.printer

pp ~pp_start ~pp_stop ~pp_sep ~pp arrow pp_k pp_v returns a table printer given a pp_k printer for individual key and a pp_v printer for individual value. pp_start and pp_stop control the opening and closing delimiters, by default print nothing. pp_sep control the separator between binding. pp_arrow control the arrow between the key and value. Renamed from print since 2.0.

  • since 0.13
module type S' = CCHashtbl.S
module Make' = CCHashtbl.Make
\ No newline at end of file diff --git a/3.10/containers/Containers/Hashtbl/module-type-HashedType/index.html b/3.10/containers/Containers/Hashtbl/module-type-HashedType/index.html new file mode 100644 index 00000000..8ee352a2 --- /dev/null +++ b/3.10/containers/Containers/Hashtbl/module-type-HashedType/index.html @@ -0,0 +1,2 @@ + +HashedType (containers.Containers.Hashtbl.HashedType)

Module type Hashtbl.HashedType

type t
val equal : t -> t -> bool
val hash : t -> int
\ No newline at end of file diff --git a/3.10/containers/Containers/Hashtbl/module-type-S/index.html b/3.10/containers/Containers/Hashtbl/module-type-S/index.html new file mode 100644 index 00000000..d16c48f8 --- /dev/null +++ b/3.10/containers/Containers/Hashtbl/module-type-S/index.html @@ -0,0 +1,2 @@ + +S (containers.Containers.Hashtbl.S)

Module type Hashtbl.S

type key
type !'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : ( key -> 'a -> unit ) -> 'a t -> unit
val filter_map_inplace : ( key -> 'a -> 'a option ) -> 'a t -> unit
val fold : ( key -> 'a -> 'b -> 'b ) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
\ No newline at end of file diff --git a/3.10/containers/Containers/Hashtbl/module-type-SeededHashedType/index.html b/3.10/containers/Containers/Hashtbl/module-type-SeededHashedType/index.html new file mode 100644 index 00000000..c4c27571 --- /dev/null +++ b/3.10/containers/Containers/Hashtbl/module-type-SeededHashedType/index.html @@ -0,0 +1,2 @@ + +SeededHashedType (containers.Containers.Hashtbl.SeededHashedType)

Module type Hashtbl.SeededHashedType

type t
val equal : t -> t -> bool
val hash : int -> t -> int
\ No newline at end of file diff --git a/3.10/containers/Containers/Hashtbl/module-type-SeededS/index.html b/3.10/containers/Containers/Hashtbl/module-type-SeededS/index.html new file mode 100644 index 00000000..81b78828 --- /dev/null +++ b/3.10/containers/Containers/Hashtbl/module-type-SeededS/index.html @@ -0,0 +1,2 @@ + +SeededS (containers.Containers.Hashtbl.SeededS)

Module type Hashtbl.SeededS

type key
type !'a t
val create : ?random:bool -> int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : ( key -> 'a -> unit ) -> 'a t -> unit
val filter_map_inplace : ( key -> 'a -> 'a option ) -> 'a t -> unit
val fold : ( key -> 'a -> 'b -> 'b ) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
\ No newline at end of file diff --git a/3.10/containers/Containers/index.html b/3.10/containers/Containers/index.html new file mode 100644 index 00000000..1042fe88 --- /dev/null +++ b/3.10/containers/Containers/index.html @@ -0,0 +1,2 @@ + +Containers (containers.Containers)

Module Containers

Drop-In replacement to Stdlib

module Array = CCArray
module Bool = CCBool
module Byte_buffer = CCByte_buffer
module Char = CCChar
module Equal = CCEqual
module Either = CCEither
module Float = CCFloat
module Format = CCFormat
module Fun = CCFun
module Hash = CCHash
module Hashtbl : sig ... end
module Heap = CCHeap
module Int = CCInt
module Int32 = CCInt32
module Int64 = CCInt64
module IO = CCIO
module List = CCList
module Map = CCMap
module Nativeint = CCNativeint
module Option = CCOption
module Ord = CCOrd
module Pair = CCPair
module Parse = CCParse
module Random = CCRandom
module Ref = CCRef
module Result = CCResult
module Seq = CCSeq
module Set = CCSet
module String = CCString
module Vector = CCVector
module Monomorphic = CCMonomorphic
module Utf8_string = CCUtf8_string
module Unit = CCUnit
module Atomic = CCAtomic
module Sexp = CCSexp
module Sexp_intf = CCSexp_intf
module Canonical_sexp = CCCanonical_sexp
module Stdlib = CCShims_.Stdlib
include module type of struct include Monomorphic end

Shadow unsafe functions and operators from Stdlib

  • since 2.0
val (=) : int -> int -> bool
val (<>) : int -> int -> bool
val (<) : int -> int -> bool
val (>) : int -> int -> bool
val (<=) : int -> int -> bool
val (>=) : int -> int -> bool
val compare : int -> int -> int
val min : int -> int -> int
val max : int -> int -> int

Infix operators for Floats

val (=.) : float -> float -> bool
  • since 2.1
val (<>.) : float -> float -> bool
  • since 2.1
val (<.) : float -> float -> bool
  • since 2.1
val (>.) : float -> float -> bool
  • since 2.1
val (<=.) : float -> float -> bool
  • since 2.1
val (>=.) : float -> float -> bool
  • since 2.1

Shadow Dangerous Operators

val (==) : [ `Consider_using_CCEqual_physical ]
val (!=) : [ `Consider_using_CCEqual_physical ]
  • since 2.1
\ No newline at end of file diff --git a/3.10/containers/ContainersLabels/.dummy b/3.10/containers/ContainersLabels/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/ContainersLabels/Hashtbl/Make/index.html b/3.10/containers/ContainersLabels/Hashtbl/Make/index.html new file mode 100644 index 00000000..a22fe799 --- /dev/null +++ b/3.10/containers/ContainersLabels/Hashtbl/Make/index.html @@ -0,0 +1,2 @@ + +Make (containers.ContainersLabels.Hashtbl.Make)

Module Hashtbl.Make

Parameters

module H : Stdlib__Hashtbl.HashedType

Signature

type key = H.t
type !'a t = 'a Stdlib__Hashtbl.Make(H).t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : ( key -> 'a -> unit ) -> 'a t -> unit
val filter_map_inplace : ( key -> 'a -> 'a option ) -> 'a t -> unit
val fold : ( key -> 'a -> 'b -> 'b ) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> Stdlib__Hashtbl.statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
\ No newline at end of file diff --git a/3.10/containers/ContainersLabels/Hashtbl/MakeSeeded/index.html b/3.10/containers/ContainersLabels/Hashtbl/MakeSeeded/index.html new file mode 100644 index 00000000..fd11212b --- /dev/null +++ b/3.10/containers/ContainersLabels/Hashtbl/MakeSeeded/index.html @@ -0,0 +1,2 @@ + +MakeSeeded (containers.ContainersLabels.Hashtbl.MakeSeeded)

Module Hashtbl.MakeSeeded

Parameters

module H : SeededHashedType

Signature

type key = H.t
type !'a t = 'a Stdlib__Hashtbl.MakeSeeded(H).t
val create : ?random:bool -> int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : ( key -> 'a -> unit ) -> 'a t -> unit
val filter_map_inplace : ( key -> 'a -> 'a option ) -> 'a t -> unit
val fold : ( key -> 'a -> 'b -> 'b ) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
\ No newline at end of file diff --git a/3.10/containers/ContainersLabels/Hashtbl/index.html b/3.10/containers/ContainersLabels/Hashtbl/index.html new file mode 100644 index 00000000..64e44387 --- /dev/null +++ b/3.10/containers/ContainersLabels/Hashtbl/index.html @@ -0,0 +1,33 @@ + +Hashtbl (containers.ContainersLabels.Hashtbl)

Module ContainersLabels.Hashtbl

include module type of Stdlib.Hashtbl + with type statistics = Stdlib.Hashtbl.statistics + and module Make = Stdlib.Hashtbl.Make + and type ('a, 'b) t = ( 'a, 'b ) Stdlib.Hashtbl.t
type (!'a0, !'b0) t = ( 'a, 'b ) Stdlib.Hashtbl.t
val create : ?random:bool -> int -> ( 'a, 'b ) t
val clear : ( 'a, 'b ) t -> unit
val reset : ( 'a, 'b ) t -> unit
val copy : ( 'a, 'b ) t -> ( 'a, 'b ) t
val add : ( 'a, 'b ) t -> 'a -> 'b -> unit
val find : ( 'a, 'b ) t -> 'a -> 'b
val find_opt : ( 'a, 'b ) t -> 'a -> 'b option
val find_all : ( 'a, 'b ) t -> 'a -> 'b list
val mem : ( 'a, 'b ) t -> 'a -> bool
val remove : ( 'a, 'b ) t -> 'a -> unit
val replace : ( 'a, 'b ) t -> 'a -> 'b -> unit
val iter : ( 'a -> 'b -> unit ) -> ( 'a, 'b ) t -> unit
val filter_map_inplace : ( 'a -> 'b -> 'b option ) -> ( 'a, 'b ) t -> unit
val fold : ( 'a -> 'b -> 'c -> 'c ) -> ( 'a, 'b ) t -> 'c -> 'c
val length : ( 'a, 'b ) t -> int
val randomize : unit -> unit
val is_randomized : unit -> bool
val rebuild : ?random:bool -> ( 'a, 'b ) t -> ( 'a, 'b ) t
type statistics = Stdlib.Hashtbl.statistics = {
num_bindings : int;
num_buckets : int;
max_bucket_length : int;
bucket_histogram : int array;
}
val stats : ( 'a, 'b ) t -> statistics
val to_seq : ( 'a, 'b ) t -> ('a * 'b) Stdlib.Seq.t
val to_seq_keys : ( 'a, 'b ) t -> 'a Stdlib.Seq.t
val to_seq_values : ( 'a, 'b ) t -> 'b Stdlib.Seq.t
val replace_seq : ( 'a, 'b ) t -> ('a * 'b) Stdlib.Seq.t -> unit
module type HashedType = sig ... end
module type S = sig ... end
module Make (H : Stdlib__Hashtbl.HashedType) : sig ... end
module type SeededHashedType = sig ... end
module type SeededS = sig ... end
module MakeSeeded (H : SeededHashedType) : sig ... end
val hash : 'a -> int
val seeded_hash : int -> 'a -> int
val hash_param : int -> int -> 'a -> int
val seeded_hash_param : int -> int -> int -> 'a -> int
include module type of struct include CCHashtbl.Poly end
val get : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'a -> 'b option

get tbl k finds a binding for the key k if present, or returns None if no value is found. Safe version of Hashtbl.find.

val get_or : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'a -> default:'b -> 'b

get_or tbl k ~default returns the value associated to k if present, and returns default otherwise (if k doesn't belong in tbl).

  • since 0.16
val keys : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'a CCHashtbl.iter

keys tbl f iterates on keys (similar order as Hashtbl.iter).

val values : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'b CCHashtbl.iter

values tbl f iterates on values in the table tbl.

val keys_list : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'a list

keys_list tbl is the list of keys in tbl. If the key is in the Hashtable multiple times, all occurrences will be returned.

  • since 0.8
val values_list : ( 'a, 'b ) Stdlib.Hashtbl.t -> 'b list

values_list tbl is the list of values in tbl.

  • since 0.8
val map_list : ( 'a -> 'b -> 'c ) -> ( 'a, 'b ) Stdlib.Hashtbl.t -> 'c list

map_list f tbl maps on a tbl's items. Collect into a list.

val incr : ?by:int -> ( 'a, int ) Stdlib.Hashtbl.t -> 'a -> unit

incr ?by tbl x increments or initializes the counter associated with x. If get tbl x = None, then after update, get tbl x = Some 1; otherwise, if get tbl x = Some n, now get tbl x = Some (n+1).

  • parameter by

    if specified, the int value is incremented by by rather than 1.

  • since 0.16
val decr : ?by:int -> ( 'a, int ) Stdlib.Hashtbl.t -> 'a -> unit

decr ?by tbl x is like incr but subtract 1 (or the value of by). If the value reaches 0, the key is removed from the table. This does nothing if the key is not already present in the table.

  • since 0.16
val to_iter : ( 'a, 'b ) Stdlib.Hashtbl.t -> ('a * 'b) CCHashtbl.iter

Iterate on bindings in the table.

  • since 2.8
val add_list : ( 'a, 'b list ) Stdlib.Hashtbl.t -> 'a -> 'b -> unit

add_list tbl x y adds y to the list x is bound to. If x is not bound, it becomes bound to y.

  • since 0.16
val add_iter : ( 'a, 'b ) Stdlib.Hashtbl.t -> ('a * 'b) CCHashtbl.iter -> unit

Add the corresponding pairs to the table, using Hashtbl.add.

  • since 2.8
val add_iter_with : + f:( 'a -> 'b -> 'b -> 'b ) -> + ( 'a, 'b ) Stdlib.Hashtbl.t -> + ('a * 'b) CCHashtbl.iter -> + unit

Add the corresponding pairs to the table, using Hashtbl.add. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val add_seq : ( 'a, 'b ) Stdlib.Hashtbl.t -> ('a * 'b) Stdlib.Seq.t -> unit

Add the corresponding pairs to the table, using Hashtbl.add. Renamed from add_std_seq since 3.0.

  • since 3.0
val add_seq_with : + f:( 'a -> 'b -> 'b -> 'b ) -> + ( 'a, 'b ) Stdlib.Hashtbl.t -> + ('a * 'b) Stdlib.Seq.t -> + unit

Add the corresponding pairs to the table. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val of_iter : ('a * 'b) CCHashtbl.iter -> ( 'a, 'b ) Stdlib.Hashtbl.t

From the given bindings, added in order.

  • since 2.8
val of_iter_with : + f:( 'a -> 'b -> 'b -> 'b ) -> + ('a * 'b) CCHashtbl.iter -> + ( 'a, 'b ) Stdlib.Hashtbl.t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val of_seq : ('a * 'b) Stdlib.Seq.t -> ( 'a, 'b ) Stdlib.Hashtbl.t

From the given bindings, added in order. Renamed from of_std_seq since 3.0.

  • since 3.0
val of_seq_with : + f:( 'a -> 'b -> 'b -> 'b ) -> + ('a * 'b) Stdlib.Seq.t -> + ( 'a, 'b ) Stdlib.Hashtbl.t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val add_iter_count : ( 'a, int ) Stdlib.Hashtbl.t -> 'a CCHashtbl.iter -> unit

add_iter_count tbl i increments the count of each element of i by calling incr. This is useful for counting how many times each element of i occurs.

  • since 2.8
val add_seq_count : ( 'a, int ) Stdlib.Hashtbl.t -> 'a Stdlib.Seq.t -> unit

add_seq_count tbl seq increments the count of each element of seq by calling incr. This is useful for counting how many times each element of seq occurs. Renamed from add_std_seq_count since 3.0.

  • since 3.0
val of_iter_count : 'a CCHashtbl.iter -> ( 'a, int ) Stdlib.Hashtbl.t

Like add_seq_count, but allocates a new table and returns it.

  • since 2.8
val of_seq_count : 'a Stdlib.Seq.t -> ( 'a, int ) Stdlib.Hashtbl.t

Like add_seq_count, but allocates a new table and returns it. Renamed from of_std_seq_count since 3.0.

  • since 3.0
val to_list : ( 'a, 'b ) Stdlib.Hashtbl.t -> ('a * 'b) list

to_list tbl returns the list of (key,value) bindings (order unspecified).

val of_list : ('a * 'b) list -> ( 'a, 'b ) Stdlib.Hashtbl.t

of_list l builds a table from the given list l of bindings k_i -> v_i, added in order using add. If a key occurs several times, it will be added several times, and the visible binding will be the last one.

val of_list_with : + f:( 'a -> 'b -> 'b -> 'b ) -> + ('a * 'b) list -> + ( 'a, 'b ) Stdlib.Hashtbl.t

From the given bindings, added in order. If a key occurs multiple times in the input, the values are combined using f in an unspecified order.

  • since 3.3
val update : + ( 'a, 'b ) Stdlib.Hashtbl.t -> + f:( 'a -> 'b option -> 'b option ) -> + k:'a -> + unit

update tbl ~f ~k updates key k by calling f k (Some v) if k was mapped to v, or f k None otherwise; if the call returns None then k is removed/stays removed, if the call returns Some v' then the binding k -> v' is inserted using Hashtbl.replace.

  • since 0.14
val get_or_add : ( 'a, 'b ) Stdlib.Hashtbl.t -> f:( 'a -> 'b ) -> k:'a -> 'b

get_or_add tbl ~k ~f finds and returns the binding of k in tbl, if it exists. If it does not exist, then f k is called to obtain a new binding v; k -> v is added to tbl and v is returned.

  • since 1.0
val pp : + ?pp_start:unit CCHashtbl.printer -> + ?pp_stop:unit CCHashtbl.printer -> + ?pp_sep:unit CCHashtbl.printer -> + ?pp_arrow:unit CCHashtbl.printer -> + 'a CCHashtbl.printer -> + 'b CCHashtbl.printer -> + ( 'a, 'b ) Stdlib.Hashtbl.t CCHashtbl.printer

pp ~pp_start ~pp_stop ~pp_sep ~pp arrow pp_k pp_v returns a table printer given a pp_k printer for individual key and a pp_v printer for individual value. pp_start and pp_stop control the opening and closing delimiters, by default print nothing. pp_sep control the separator between binding. pp_arrow control the arrow between the key and value. Renamed from print since 2.0.

  • since 0.13
module type S' = CCHashtbl.S
module Make' = CCHashtbl.Make
\ No newline at end of file diff --git a/3.10/containers/ContainersLabels/Hashtbl/module-type-HashedType/index.html b/3.10/containers/ContainersLabels/Hashtbl/module-type-HashedType/index.html new file mode 100644 index 00000000..e423bf8f --- /dev/null +++ b/3.10/containers/ContainersLabels/Hashtbl/module-type-HashedType/index.html @@ -0,0 +1,2 @@ + +HashedType (containers.ContainersLabels.Hashtbl.HashedType)

Module type Hashtbl.HashedType

type t
val equal : t -> t -> bool
val hash : t -> int
\ No newline at end of file diff --git a/3.10/containers/ContainersLabels/Hashtbl/module-type-S/index.html b/3.10/containers/ContainersLabels/Hashtbl/module-type-S/index.html new file mode 100644 index 00000000..6f4a58a4 --- /dev/null +++ b/3.10/containers/ContainersLabels/Hashtbl/module-type-S/index.html @@ -0,0 +1,2 @@ + +S (containers.ContainersLabels.Hashtbl.S)

Module type Hashtbl.S

type key
type !'a t
val create : int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : ( key -> 'a -> unit ) -> 'a t -> unit
val filter_map_inplace : ( key -> 'a -> 'a option ) -> 'a t -> unit
val fold : ( key -> 'a -> 'b -> 'b ) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
\ No newline at end of file diff --git a/3.10/containers/ContainersLabels/Hashtbl/module-type-SeededHashedType/index.html b/3.10/containers/ContainersLabels/Hashtbl/module-type-SeededHashedType/index.html new file mode 100644 index 00000000..a388385b --- /dev/null +++ b/3.10/containers/ContainersLabels/Hashtbl/module-type-SeededHashedType/index.html @@ -0,0 +1,2 @@ + +SeededHashedType (containers.ContainersLabels.Hashtbl.SeededHashedType)

Module type Hashtbl.SeededHashedType

type t
val equal : t -> t -> bool
val hash : int -> t -> int
\ No newline at end of file diff --git a/3.10/containers/ContainersLabels/Hashtbl/module-type-SeededS/index.html b/3.10/containers/ContainersLabels/Hashtbl/module-type-SeededS/index.html new file mode 100644 index 00000000..aefb9056 --- /dev/null +++ b/3.10/containers/ContainersLabels/Hashtbl/module-type-SeededS/index.html @@ -0,0 +1,2 @@ + +SeededS (containers.ContainersLabels.Hashtbl.SeededS)

Module type Hashtbl.SeededS

type key
type !'a t
val create : ?random:bool -> int -> 'a t
val clear : 'a t -> unit
val reset : 'a t -> unit
val copy : 'a t -> 'a t
val add : 'a t -> key -> 'a -> unit
val remove : 'a t -> key -> unit
val find : 'a t -> key -> 'a
val find_opt : 'a t -> key -> 'a option
val find_all : 'a t -> key -> 'a list
val replace : 'a t -> key -> 'a -> unit
val mem : 'a t -> key -> bool
val iter : ( key -> 'a -> unit ) -> 'a t -> unit
val filter_map_inplace : ( key -> 'a -> 'a option ) -> 'a t -> unit
val fold : ( key -> 'a -> 'b -> 'b ) -> 'a t -> 'b -> 'b
val length : 'a t -> int
val stats : 'a t -> statistics
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_keys : 'a t -> key Stdlib.Seq.t
val to_seq_values : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val replace_seq : 'a t -> (key * 'a) Stdlib.Seq.t -> unit
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
\ No newline at end of file diff --git a/3.10/containers/ContainersLabels/index.html b/3.10/containers/ContainersLabels/index.html new file mode 100644 index 00000000..196208d4 --- /dev/null +++ b/3.10/containers/ContainersLabels/index.html @@ -0,0 +1,2 @@ + +ContainersLabels (containers.ContainersLabels)

Module ContainersLabels

Drop-In replacement to Stdlib

module Array = CCArrayLabels
module Bool = CCBool
module Byte_buffer = CCByte_buffer
module Char = CCChar
module Equal = CCEqualLabels
module Either = CCEither
module Float = CCFloat
module Format = CCFormat
module Fun = CCFun
module Hash = CCHash
module Hashtbl : sig ... end
module Heap = CCHeap
module Int = CCInt
module Int32 = CCInt32
module Int64 = CCInt64
module IO = CCIO
module List = CCListLabels
module Map = CCMap
module Nativeint = CCNativeint
module Option = CCOption
module Ord = CCOrd
module Pair = CCPair
module Parse = CCParse
module Random = CCRandom
module Ref = CCRef
module Result = CCResult
module Seq = CCSeq
module Set = CCSet
module String = CCStringLabels
module Vector = CCVector
module Monomorphic = CCMonomorphic
module Utf8_string = CCUtf8_string
module Sexp = CCSexp
module Sexp_intf = CCSexp_intf
module Stdlib = CCShims_.Stdlib
include module type of struct include Monomorphic end

Shadow unsafe functions and operators from Stdlib

  • since 2.0
val (=) : int -> int -> bool
val (<>) : int -> int -> bool
val (<) : int -> int -> bool
val (>) : int -> int -> bool
val (<=) : int -> int -> bool
val (>=) : int -> int -> bool
val compare : int -> int -> int
val min : int -> int -> int
val max : int -> int -> int

Infix operators for Floats

val (=.) : float -> float -> bool
  • since 2.1
val (<>.) : float -> float -> bool
  • since 2.1
val (<.) : float -> float -> bool
  • since 2.1
val (>.) : float -> float -> bool
  • since 2.1
val (<=.) : float -> float -> bool
  • since 2.1
val (>=.) : float -> float -> bool
  • since 2.1

Shadow Dangerous Operators

val (==) : [ `Consider_using_CCEqual_physical ]
val (!=) : [ `Consider_using_CCEqual_physical ]
  • since 2.1
\ No newline at end of file diff --git a/3.10/containers/Containers_bencode/.dummy b/3.10/containers/Containers_bencode/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/Containers_bencode/Decode/index.html b/3.10/containers/Containers_bencode/Decode/index.html new file mode 100644 index 00000000..c52ac601 --- /dev/null +++ b/3.10/containers/Containers_bencode/Decode/index.html @@ -0,0 +1,2 @@ + +Decode (containers.Containers_bencode.Decode)

Module Containers_bencode.Decode

Decoding

val of_string : string -> t option
val of_string_exn : string -> t

Parse string.

  • raises Failure

    if the string is not valid bencode.

\ No newline at end of file diff --git a/3.10/containers/Containers_bencode/Encode/index.html b/3.10/containers/Containers_bencode/Encode/index.html new file mode 100644 index 00000000..9ac79886 --- /dev/null +++ b/3.10/containers/Containers_bencode/Encode/index.html @@ -0,0 +1,2 @@ + +Encode (containers.Containers_bencode.Encode)

Module Containers_bencode.Encode

Encoding

val to_string : t -> string
val to_buffer : Stdlib.Buffer.t -> t -> unit
val to_chan : Stdlib.out_channel -> t -> unit
val to_fmt : Stdlib.Format.formatter -> t -> unit
\ No newline at end of file diff --git a/3.10/containers/Containers_bencode/Str_map/index.html b/3.10/containers/Containers_bencode/Str_map/index.html new file mode 100644 index 00000000..bd40775d --- /dev/null +++ b/3.10/containers/Containers_bencode/Str_map/index.html @@ -0,0 +1,6 @@ + +Str_map (containers.Containers_bencode.Str_map)

Module Containers_bencode.Str_map

type key = Stdlib.String.t
type !'a t = 'a Stdlib__Map.Make(Stdlib.String).t
val empty : 'a t
val is_empty : 'a t -> bool
val mem : key -> 'a t -> bool
val add : key -> 'a -> 'a t -> 'a t
val update : key -> ( 'a option -> 'a option ) -> 'a t -> 'a t
val singleton : key -> 'a -> 'a t
val remove : key -> 'a t -> 'a t
val merge : + ( key -> 'a option -> 'b option -> 'c option ) -> + 'a t -> + 'b t -> + 'c t
val union : ( key -> 'a -> 'a -> 'a option ) -> 'a t -> 'a t -> 'a t
val compare : ( 'a -> 'a -> int ) -> 'a t -> 'a t -> int
val equal : ( 'a -> 'a -> bool ) -> 'a t -> 'a t -> bool
val iter : ( key -> 'a -> unit ) -> 'a t -> unit
val fold : ( key -> 'a -> 'b -> 'b ) -> 'a t -> 'b -> 'b
val for_all : ( key -> 'a -> bool ) -> 'a t -> bool
val exists : ( key -> 'a -> bool ) -> 'a t -> bool
val filter : ( key -> 'a -> bool ) -> 'a t -> 'a t
val filter_map : ( key -> 'a -> 'b option ) -> 'a t -> 'b t
val partition : ( key -> 'a -> bool ) -> 'a t -> 'a t * 'a t
val cardinal : 'a t -> int
val bindings : 'a t -> (key * 'a) list
val min_binding : 'a t -> key * 'a
val min_binding_opt : 'a t -> (key * 'a) option
val max_binding : 'a t -> key * 'a
val max_binding_opt : 'a t -> (key * 'a) option
val choose : 'a t -> key * 'a
val choose_opt : 'a t -> (key * 'a) option
val split : key -> 'a t -> 'a t * 'a option * 'a t
val find : key -> 'a t -> 'a
val find_opt : key -> 'a t -> 'a option
val find_first : ( key -> bool ) -> 'a t -> key * 'a
val find_first_opt : ( key -> bool ) -> 'a t -> (key * 'a) option
val find_last : ( key -> bool ) -> 'a t -> key * 'a
val find_last_opt : ( key -> bool ) -> 'a t -> (key * 'a) option
val map : ( 'a -> 'b ) -> 'a t -> 'b t
val mapi : ( key -> 'a -> 'b ) -> 'a t -> 'b t
val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t
\ No newline at end of file diff --git a/3.10/containers/Containers_bencode/index.html b/3.10/containers/Containers_bencode/index.html new file mode 100644 index 00000000..24aa8bf7 --- /dev/null +++ b/3.10/containers/Containers_bencode/index.html @@ -0,0 +1,2 @@ + +Containers_bencode (containers.Containers_bencode)

Module Containers_bencode

Basic Bencode decoder/encoder.

See https://en.wikipedia.org/wiki/Bencode .

module Str_map : sig ... end
type t =
| Int of int64
| String of string
| List of t list
| Map of t Str_map.t
val equal : t -> t -> bool
val hash : t -> int
val pp_debug : Stdlib.Format.formatter -> t -> unit

Printer for diagnostic/human consumption

val to_string_debug : t -> string
val int : int -> t
val int64 : int64 -> t
val string : string -> t
val list : t list -> t
val map_of_list : (string * t) list -> t
val map : t Str_map.t -> t
module Encode : sig ... end

Encoding

module Decode : sig ... end

Decoding

\ No newline at end of file diff --git a/3.10/containers/Containers_cbor/.dummy b/3.10/containers/Containers_cbor/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/Containers_cbor/index.html b/3.10/containers/Containers_cbor/index.html new file mode 100644 index 00000000..09f6e09a --- /dev/null +++ b/3.10/containers/Containers_cbor/index.html @@ -0,0 +1,2 @@ + +Containers_cbor (containers.Containers_cbor)

Module Containers_cbor

CBOR encoder/decoder.

The type is chosen to be compatible with ocaml-cbor. See the RFC.

note this is experimental.

note this is only available on OCaml >= 4.08. Below that, the module is empty.

type t = [
| `Null
| `Undefined
| `Simple of int
| `Bool of bool
| `Int of int64
| `Float of float
| `Bytes of string
| `Text of string
| `Array of t list
| `Map of (t * t) list
| `Tag of int * t
]
val pp_diagnostic : t CCFormat.printer
val to_string_diagnostic : t -> string
val encode : ?buf:Stdlib.Buffer.t -> t -> string
val decode : string -> ( t, string ) Stdlib.result
val decode_exn : string -> t

Like decode.

  • raises Failure

    if the string isn't valid

\ No newline at end of file diff --git a/3.10/containers/Containers_codegen/.dummy b/3.10/containers/Containers_codegen/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/Containers_codegen/Bitfield/index.html b/3.10/containers/Containers_codegen/Bitfield/index.html new file mode 100644 index 00000000..cc04a271 --- /dev/null +++ b/3.10/containers/Containers_codegen/Bitfield/index.html @@ -0,0 +1,2 @@ + +Bitfield (containers.Containers_codegen.Bitfield)

Module Containers_codegen.Bitfield

Generate efficient bitfields that fit in an integer

type t
val make : ?emit_failure_if_too_wide:bool -> name:string -> unit -> t

Make a new bitfield with the given name.

  • parameter name

    the name of the generated type

  • parameter emit_failure_if_too_wide

    if true, generated code includes a runtime assertion that Sys.int_size is wide enough to support this type

val field_bit : t -> string -> unit

field_bit ty name adds a field of size 1 to the bitfield ty, with name name. The generate code will provide get/set for a boolean.

val field_int : t -> width:int -> string -> unit

field_int ty name ~width adds a field of size width to the bitfield with name name. The accessors will be for integers of width bits, and the setter might assert that the provided integer fits.

val total_width : t -> int

Total width in bits of the given bitfield.

val gen_mli : t -> code

Generate code for the type signature for the given bitfield

val gen_ml : t -> code

Generate code for the implementation for the given bitfield

\ No newline at end of file diff --git a/3.10/containers/Containers_codegen/Code/index.html b/3.10/containers/Containers_codegen/Code/index.html new file mode 100644 index 00000000..211638a0 --- /dev/null +++ b/3.10/containers/Containers_codegen/Code/index.html @@ -0,0 +1,2 @@ + +Code (containers.Containers_codegen.Code)

Module Containers_codegen.Code

Representation of OCaml code

type t = code
val pp : t Fmt.printer
val to_string : t -> string
val mk_pp : unit Fmt.printer -> t
val mk_str : string -> t
val in_struct : string -> t list -> t
val in_sig : string -> t list -> t
\ No newline at end of file diff --git a/3.10/containers/Containers_codegen/index.html b/3.10/containers/Containers_codegen/index.html new file mode 100644 index 00000000..3dfba406 --- /dev/null +++ b/3.10/containers/Containers_codegen/index.html @@ -0,0 +1,13 @@ + +Containers_codegen (containers.Containers_codegen)

Module Containers_codegen

Code generators

The code generator library is designed to be used from a build system (for example, from dune) to generate efficient code for features that are harder to provide at runtime.

The idea is that the build system should invoke some OCaml script that depends on containers.codegen; the script uses the DSL below to describe what code to generate (e.g. a description of a bitfield type) and emits a .ml file (and possibly a .mli file).

For example, the build script might contain:

module CG = Containers_codegen
+let () =
+  let module B = CG.Bitfield in
+  let b = B.make ~name:"t" () in
+  B.field_bit b "x";
+  B.field_bit b "y";
+  B.field_bit b "z";
+  B.field_int b ~width:5 "foo";
+
+  CG.emit_file "foo.mli" (B.gen_mli b);
+  CG.emit_file "foo.ml" (B.gen_ml b);
+  ()

and this will produce foo.ml and foo.mli with a bitfield containing x, y, and z.

module Fmt = CCFormat
type code
module Code : sig ... end
module Bitfield : sig ... end
val emit_file : string -> code list -> unit

emit_file file cs emits code fragments cs into the given file at path file

val emit_chan : Stdlib.out_channel -> code list -> unit
val emit_string : code list -> string
\ No newline at end of file diff --git a/3.10/containers/Containers_scc/.dummy b/3.10/containers/Containers_scc/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/Containers_scc/Make/argument-1-A/index.html b/3.10/containers/Containers_scc/Make/argument-1-A/index.html new file mode 100644 index 00000000..45b6d80a --- /dev/null +++ b/3.10/containers/Containers_scc/Make/argument-1-A/index.html @@ -0,0 +1,2 @@ + +A (containers.Containers_scc.Make.1-A)

Parameter Make.1-A

type t
type node
val children : t -> node -> node iter
module Node_tbl : Stdlib.Hashtbl.S with type key = node
\ No newline at end of file diff --git a/3.10/containers/Containers_scc/Make/index.html b/3.10/containers/Containers_scc/Make/index.html new file mode 100644 index 00000000..5ead6c32 --- /dev/null +++ b/3.10/containers/Containers_scc/Make/index.html @@ -0,0 +1,2 @@ + +Make (containers.Containers_scc.Make)

Module Containers_scc.Make

Parameters

module A : ARG

Signature

module A = A
val scc : A.t -> A.node list -> A.node list list
\ No newline at end of file diff --git a/3.10/containers/Containers_scc/index.html b/3.10/containers/Containers_scc/index.html new file mode 100644 index 00000000..54912b7c --- /dev/null +++ b/3.10/containers/Containers_scc/index.html @@ -0,0 +1,8 @@ + +Containers_scc (containers.Containers_scc)

Module Containers_scc

type 'a iter = ( 'a -> unit ) -> unit
module type ARG = sig ... end
module type S = sig ... end
module Make (A : ARG) : S with module A = A
val scc : + tbl:(module Stdlib.Hashtbl.S with type key = 'node) -> + graph:'graph -> + children:( 'graph -> 'node -> 'node iter ) -> + nodes:'node list -> + unit -> + 'node list list
\ No newline at end of file diff --git a/3.10/containers/Containers_scc/module-type-ARG/index.html b/3.10/containers/Containers_scc/module-type-ARG/index.html new file mode 100644 index 00000000..cc6a4cbc --- /dev/null +++ b/3.10/containers/Containers_scc/module-type-ARG/index.html @@ -0,0 +1,2 @@ + +ARG (containers.Containers_scc.ARG)

Module type Containers_scc.ARG

type t
type node
val children : t -> node -> node iter
module Node_tbl : Stdlib.Hashtbl.S with type key = node
\ No newline at end of file diff --git a/3.10/containers/Containers_scc/module-type-S/A/index.html b/3.10/containers/Containers_scc/module-type-S/A/index.html new file mode 100644 index 00000000..6fc79107 --- /dev/null +++ b/3.10/containers/Containers_scc/module-type-S/A/index.html @@ -0,0 +1,2 @@ + +A (containers.Containers_scc.S.A)

Module S.A

type t
type node
val children : t -> node -> node iter
module Node_tbl : Stdlib.Hashtbl.S with type key = node
\ No newline at end of file diff --git a/3.10/containers/Containers_scc/module-type-S/index.html b/3.10/containers/Containers_scc/module-type-S/index.html new file mode 100644 index 00000000..a1df41e5 --- /dev/null +++ b/3.10/containers/Containers_scc/module-type-S/index.html @@ -0,0 +1,2 @@ + +S (containers.Containers_scc.S)

Module type Containers_scc.S

module A : ARG
val scc : A.t -> A.node list -> A.node list list
\ No newline at end of file diff --git a/3.10/containers/Containers_top/.dummy b/3.10/containers/Containers_top/.dummy new file mode 100644 index 00000000..e69de29b diff --git a/3.10/containers/Containers_top/index.html b/3.10/containers/Containers_top/index.html new file mode 100644 index 00000000..aac780b7 --- /dev/null +++ b/3.10/containers/Containers_top/index.html @@ -0,0 +1,2 @@ + +Containers_top (containers.Containers_top)

Module Containers_top

type 'a printer = Stdlib.Format.formatter -> 'a -> unit
val eval_exn : string -> bool
val install_printer : string -> unit
val install_printers : string list -> unit
\ No newline at end of file diff --git a/3.10/containers/index.html b/3.10/containers/index.html new file mode 100644 index 00000000..4bf06a66 --- /dev/null +++ b/3.10/containers/index.html @@ -0,0 +1,2 @@ + +index (containers.index)

containers index

Library containers

This library exposes the following toplevel modules:

Library containers.bencode

The entry point of this library is the module: Containers_bencode.

Library containers.cbor

The entry point of this library is the module: Containers_cbor.

Library containers.codegen

The entry point of this library is the module: Containers_codegen.

Library containers.monomorphic

The entry point of this library is the module: CCMonomorphic.

Library containers.scc

The entry point of this library is the module: Containers_scc.

Library containers.top

The entry point of this library is the module: Containers_top.

Library containers.unix

The entry point of this library is the module: CCUnix.

\ No newline at end of file diff --git a/3.10/highlight.pack.js b/3.10/highlight.pack.js new file mode 100644 index 00000000..2e55d491 --- /dev/null +++ b/3.10/highlight.pack.js @@ -0,0 +1,2 @@ +/*! highlight.js v9.15.8 | BSD3 License | git.io/hljslicense */ +!function(e){var n="object"==typeof window&&window||"object"==typeof self&&self;"undefined"!=typeof exports?e(exports):n&&(n.hljs=e({}),"function"==typeof define&&define.amd&&define([],function(){return n.hljs}))}(function(a){var f=[],u=Object.keys,N={},c={},n=/^(no-?highlight|plain|text)$/i,s=/\blang(?:uage)?-([\w-]+)\b/i,t=/((^(<[^>]+>|\t|)+|(?:\n)))/gm,r={case_insensitive:"cI",lexemes:"l",contains:"c",keywords:"k",subLanguage:"sL",className:"cN",begin:"b",beginKeywords:"bK",end:"e",endsWithParent:"eW",illegal:"i",excludeBegin:"eB",excludeEnd:"eE",returnBegin:"rB",returnEnd:"rE",relevance:"r",variants:"v",IDENT_RE:"IR",UNDERSCORE_IDENT_RE:"UIR",NUMBER_RE:"NR",C_NUMBER_RE:"CNR",BINARY_NUMBER_RE:"BNR",RE_STARTERS_RE:"RSR",BACKSLASH_ESCAPE:"BE",APOS_STRING_MODE:"ASM",QUOTE_STRING_MODE:"QSM",PHRASAL_WORDS_MODE:"PWM",C_LINE_COMMENT_MODE:"CLCM",C_BLOCK_COMMENT_MODE:"CBCM",HASH_COMMENT_MODE:"HCM",NUMBER_MODE:"NM",C_NUMBER_MODE:"CNM",BINARY_NUMBER_MODE:"BNM",CSS_NUMBER_MODE:"CSSNM",REGEXP_MODE:"RM",TITLE_MODE:"TM",UNDERSCORE_TITLE_MODE:"UTM",COMMENT:"C",beginRe:"bR",endRe:"eR",illegalRe:"iR",lexemesRe:"lR",terminators:"t",terminator_end:"tE"},b="",h={classPrefix:"hljs-",tabReplace:null,useBR:!1,languages:void 0};function _(e){return e.replace(/&/g,"&").replace(//g,">")}function E(e){return e.nodeName.toLowerCase()}function v(e,n){var t=e&&e.exec(n);return t&&0===t.index}function l(e){return n.test(e)}function g(e){var n,t={},r=Array.prototype.slice.call(arguments,1);for(n in e)t[n]=e[n];return r.forEach(function(e){for(n in e)t[n]=e[n]}),t}function R(e){var a=[];return function e(n,t){for(var r=n.firstChild;r;r=r.nextSibling)3===r.nodeType?t+=r.nodeValue.length:1===r.nodeType&&(a.push({event:"start",offset:t,node:r}),t=e(r,t),E(r).match(/br|hr|img|input/)||a.push({event:"stop",offset:t,node:r}));return t}(e,0),a}function i(e){if(r&&!e.langApiRestored){for(var n in e.langApiRestored=!0,r)e[n]&&(e[r[n]]=e[n]);(e.c||[]).concat(e.v||[]).forEach(i)}}function m(o){function s(e){return e&&e.source||e}function c(e,n){return new RegExp(s(e),"m"+(o.cI?"i":"")+(n?"g":""))}!function n(t,e){if(!t.compiled){if(t.compiled=!0,t.k=t.k||t.bK,t.k){function r(t,e){o.cI&&(e=e.toLowerCase()),e.split(" ").forEach(function(e){var n=e.split("|");a[n[0]]=[t,n[1]?Number(n[1]):1]})}var a={};"string"==typeof t.k?r("keyword",t.k):u(t.k).forEach(function(e){r(e,t.k[e])}),t.k=a}t.lR=c(t.l||/\w+/,!0),e&&(t.bK&&(t.b="\\b("+t.bK.split(" ").join("|")+")\\b"),t.b||(t.b=/\B|\b/),t.bR=c(t.b),t.endSameAsBegin&&(t.e=t.b),t.e||t.eW||(t.e=/\B|\b/),t.e&&(t.eR=c(t.e)),t.tE=s(t.e)||"",t.eW&&e.tE&&(t.tE+=(t.e?"|":"")+e.tE)),t.i&&(t.iR=c(t.i)),null==t.r&&(t.r=1),t.c||(t.c=[]),t.c=Array.prototype.concat.apply([],t.c.map(function(e){return function(n){return n.v&&!n.cached_variants&&(n.cached_variants=n.v.map(function(e){return g(n,{v:null},e)})),n.cached_variants||n.eW&&[g(n)]||[n]}("self"===e?t:e)})),t.c.forEach(function(e){n(e,t)}),t.starts&&n(t.starts,e);var i=t.c.map(function(e){return e.bK?"\\.?(?:"+e.b+")\\.?":e.b}).concat([t.tE,t.i]).map(s).filter(Boolean);t.t=i.length?c(function(e,n){for(var t=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./,r=0,a="",i=0;i')+n+(t?"":b):n}function o(){E+=null!=l.sL?function(){var e="string"==typeof l.sL;if(e&&!N[l.sL])return _(g);var n=e?C(l.sL,g,!0,f[l.sL]):O(g,l.sL.length?l.sL:void 0);return 0")+'"');return g+=n,n.length||1}var s=B(e);if(!s)throw new Error('Unknown language: "'+e+'"');m(s);var a,l=t||s,f={},E="";for(a=l;a!==s;a=a.parent)a.cN&&(E=c(a.cN,"",!0)+E);var g="",R=0;try{for(var d,p,M=0;l.t.lastIndex=M,d=l.t.exec(n);)p=r(n.substring(M,d.index),d[0]),M=d.index+p;for(r(n.substr(M)),a=l;a.parent;a=a.parent)a.cN&&(E+=b);return{r:R,value:E,language:e,top:l}}catch(e){if(e.message&&-1!==e.message.indexOf("Illegal"))return{r:0,value:_(n)};throw e}}function O(t,e){e=e||h.languages||u(N);var r={r:0,value:_(t)},a=r;return e.filter(B).filter(M).forEach(function(e){var n=C(e,t,!1);n.language=e,n.r>a.r&&(a=n),n.r>r.r&&(a=r,r=n)}),a.language&&(r.second_best=a),r}function d(e){return h.tabReplace||h.useBR?e.replace(t,function(e,n){return h.useBR&&"\n"===e?"
":h.tabReplace?n.replace(/\t/g,h.tabReplace):""}):e}function o(e){var n,t,r,a,i,o=function(e){var n,t,r,a,i=e.className+" ";if(i+=e.parentNode?e.parentNode.className:"",t=s.exec(i))return B(t[1])?t[1]:"no-highlight";for(n=0,r=(i=i.split(/\s+/)).length;n/g,"\n"):n=e,i=n.textContent,r=o?C(o,i,!0):O(i),(t=R(n)).length&&((a=document.createElementNS("http://www.w3.org/1999/xhtml","div")).innerHTML=r.value,r.value=function(e,n,t){var r=0,a="",i=[];function o(){return e.length&&n.length?e[0].offset!==n[0].offset?e[0].offset"}function u(e){a+=""}function s(e){("start"===e.event?c:u)(e.node)}for(;e.length||n.length;){var l=o();if(a+=_(t.substring(r,l[0].offset)),r=l[0].offset,l===e){for(i.reverse().forEach(u);s(l.splice(0,1)[0]),(l=o())===e&&l.length&&l[0].offset===r;);i.reverse().forEach(c)}else"start"===l[0].event?i.push(l[0].node):i.pop(),s(l.splice(0,1)[0])}return a+_(t.substr(r))}(t,R(a),i)),r.value=d(r.value),e.innerHTML=r.value,e.className=function(e,n,t){var r=n?c[n]:t,a=[e.trim()];return e.match(/\bhljs\b/)||a.push("hljs"),-1===e.indexOf(r)&&a.push(r),a.join(" ").trim()}(e.className,o,r.language),e.result={language:r.language,re:r.r},r.second_best&&(e.second_best={language:r.second_best.language,re:r.second_best.r}))}function p(){if(!p.called){p.called=!0;var e=document.querySelectorAll("pre code");f.forEach.call(e,o)}}function B(e){return e=(e||"").toLowerCase(),N[e]||N[c[e]]}function M(e){var n=B(e);return n&&!n.disableAutodetect}return a.highlight=C,a.highlightAuto=O,a.fixMarkup=d,a.highlightBlock=o,a.configure=function(e){h=g(h,e)},a.initHighlighting=p,a.initHighlightingOnLoad=function(){addEventListener("DOMContentLoaded",p,!1),addEventListener("load",p,!1)},a.registerLanguage=function(n,e){var t=N[n]=e(a);i(t),t.aliases&&t.aliases.forEach(function(e){c[e]=n})},a.listLanguages=function(){return u(N)},a.getLanguage=B,a.autoDetection=M,a.inherit=g,a.IR=a.IDENT_RE="[a-zA-Z]\\w*",a.UIR=a.UNDERSCORE_IDENT_RE="[a-zA-Z_]\\w*",a.NR=a.NUMBER_RE="\\b\\d+(\\.\\d+)?",a.CNR=a.C_NUMBER_RE="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",a.BNR=a.BINARY_NUMBER_RE="\\b(0b[01]+)",a.RSR=a.RE_STARTERS_RE="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",a.BE=a.BACKSLASH_ESCAPE={b:"\\\\[\\s\\S]",r:0},a.ASM=a.APOS_STRING_MODE={cN:"string",b:"'",e:"'",i:"\\n",c:[a.BE]},a.QSM=a.QUOTE_STRING_MODE={cN:"string",b:'"',e:'"',i:"\\n",c:[a.BE]},a.PWM=a.PHRASAL_WORDS_MODE={b:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},a.C=a.COMMENT=function(e,n,t){var r=a.inherit({cN:"comment",b:e,e:n,c:[]},t||{});return r.c.push(a.PWM),r.c.push({cN:"doctag",b:"(?:TODO|FIXME|NOTE|BUG|XXX):",r:0}),r},a.CLCM=a.C_LINE_COMMENT_MODE=a.C("//","$"),a.CBCM=a.C_BLOCK_COMMENT_MODE=a.C("/\\*","\\*/"),a.HCM=a.HASH_COMMENT_MODE=a.C("#","$"),a.NM=a.NUMBER_MODE={cN:"number",b:a.NR,r:0},a.CNM=a.C_NUMBER_MODE={cN:"number",b:a.CNR,r:0},a.BNM=a.BINARY_NUMBER_MODE={cN:"number",b:a.BNR,r:0},a.CSSNM=a.CSS_NUMBER_MODE={cN:"number",b:a.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0},a.RM=a.REGEXP_MODE={cN:"regexp",b:/\//,e:/\/[gimuy]*/,i:/\n/,c:[a.BE,{b:/\[/,e:/\]/,r:0,c:[a.BE]}]},a.TM=a.TITLE_MODE={cN:"title",b:a.IR,r:0},a.UTM=a.UNDERSCORE_TITLE_MODE={cN:"title",b:a.UIR,r:0},a.METHOD_GUARD={b:"\\.\\s*"+a.UIR,r:0},a});hljs.registerLanguage("ocaml",function(e){return{aliases:["ml"],k:{keyword:"and as assert asr begin class constraint do done downto else end exception external for fun function functor if in include inherit! inherit initializer land lazy let lor lsl lsr lxor match method!|10 method mod module mutable new object of open! open or private rec sig struct then to try type val! val virtual when while with parser value",built_in:"array bool bytes char exn|5 float int int32 int64 list lazy_t|5 nativeint|5 string unit in_channel out_channel ref",literal:"true false"},i:/\/\/|>>/,l:"[a-z_]\\w*!?",c:[{cN:"literal",b:"\\[(\\|\\|)?\\]|\\(\\)",r:0},e.C("\\(\\*","\\*\\)",{c:["self"]}),{cN:"symbol",b:"'[A-Za-z_](?!')[\\w']*"},{cN:"type",b:"`[A-Z][\\w']*"},{cN:"type",b:"\\b[A-Z][\\w']*",r:0},{b:"[a-z_]\\w*'[\\w']*",r:0},e.inherit(e.ASM,{cN:"string",r:0}),e.inherit(e.QSM,{i:null}),{cN:"number",b:"\\b(0[xX][a-fA-F0-9_]+[Lln]?|0[oO][0-7_]+[Lln]?|0[bB][01_]+[Lln]?|[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)",r:0},{b:/[-=]>/}]}});hljs.registerLanguage("reasonml",function(r){var e="~?[a-z$_][0-9a-zA-Z$_]*",a="`?[A-Z$_][0-9a-zA-Z$_]*",c="("+["||","&&","++","**","+.","*","/","*.","/.","...","|>"].map(function(r){return r.split("").map(function(r){return"\\"+r}).join("")}).join("|")+"|==|===)",n="\\s+"+c+"\\s+",t={keyword:"and as asr assert begin class constraint do done downto else end exception externalfor fun function functor if in include inherit initializerland lazy let lor lsl lsr lxor match method mod module mutable new nonrecobject of open or private rec sig struct then to try type val virtual when while with",built_in:"array bool bytes char exn|5 float int int32 int64 list lazy_t|5 nativeint|5 ref string unit ",literal:"true false"},i="\\b(0[xX][a-fA-F0-9_]+[Lln]?|0[oO][0-7_]+[Lln]?|0[bB][01_]+[Lln]?|[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)",s={cN:"number",r:0,v:[{b:i},{b:"\\(\\-"+i+"\\)"}]},b={cN:"operator",r:0,b:c},o=[{cN:"identifier",r:0,b:e},b,s],l=[r.QSM,b,{cN:"module",b:"\\b"+a,rB:!0,e:".",c:[{cN:"identifier",b:a,r:0}]}],u=[{cN:"module",b:"\\b"+a,rB:!0,e:".",r:0,c:[{cN:"identifier",b:a,r:0}]}],_={cN:"function",r:0,k:t,v:[{b:"\\s(\\(\\.?.*?\\)|"+e+")\\s*=>",e:"\\s*=>",rB:!0,r:0,c:[{cN:"params",v:[{b:e},{b:"~?[a-z$_][0-9a-zA-Z$_]*(s*:s*[a-z$_][0-9a-z$_]*((s*('?[a-z$_][0-9a-z$_]*s*(,'?[a-z$_][0-9a-z$_]*)*)?s*))?)?(s*:s*[a-z$_][0-9a-z$_]*((s*('?[a-z$_][0-9a-z$_]*s*(,'?[a-z$_][0-9a-z$_]*)*)?s*))?)?"},{b:/\(\s*\)/}]}]},{b:"\\s\\(\\.?[^;\\|]*\\)\\s*=>",e:"\\s=>",rB:!0,r:0,c:[{cN:"params",r:0,v:[{b:e,e:"(,|\\n|\\))",r:0,c:[b,{cN:"typing",b:":",e:"(,|\\n)",rB:!0,r:0,c:u}]}]}]},{b:"\\(\\.\\s"+e+"\\)\\s*=>"}]};l.push(_);var N={cN:"constructor",b:a+"\\(",e:"\\)",i:"\\n",k:t,c:[r.QSM,b,{cN:"params",b:"\\b"+e}]},d={cN:"pattern-match",b:"\\|",rB:!0,k:t,e:"=>",r:0,c:[N,b,{r:0,cN:"constructor",b:a}]},z={cN:"module-access",k:t,rB:!0,v:[{b:"\\b("+a+"\\.)+"+e},{b:"\\b("+a+"\\.)+\\(",e:"\\)",rB:!0,c:[_,{b:"\\(",e:"\\)",skip:!0}].concat(l)},{b:"\\b("+a+"\\.)+{",e:"}"}],c:l};return u.push(z),{aliases:["re"],k:t,i:"(:\\-|:=|\\${|\\+=)",c:[r.C("/\\*","\\*/",{i:"^(\\#,\\/\\/)"}),{cN:"character",b:"'(\\\\[^']+|[^'])'",i:"\\n",r:0},r.QSM,{cN:"literal",b:"\\(\\)",r:0},{cN:"literal",b:"\\[\\|",e:"\\|\\]",r:0,c:o},{cN:"literal",b:"\\[",e:"\\]",r:0,c:o},N,{cN:"operator",b:n,i:"\\-\\->",r:0},s,r.CLCM,d,_,{cN:"module-def",b:"\\bmodule\\s+"+e+"\\s+"+a+"\\s+=\\s+{",e:"}",rB:!0,k:t,r:0,c:[{cN:"module",r:0,b:a},{b:"{",e:"}",skip:!0}].concat(l)},z]}}); \ No newline at end of file diff --git a/3.10/index.html b/3.10/index.html new file mode 100644 index 00000000..65d73eff --- /dev/null +++ b/3.10/index.html @@ -0,0 +1,21 @@ + + + + index + + + + + +
+
+

OCaml package documentation

+
    +
  1. containers 3.9
  2. +
  3. containers-data 3.9
  4. +
  5. containers-thread 3.9
  6. +
+
+
+ + \ No newline at end of file diff --git a/3.10/odoc.css b/3.10/odoc.css new file mode 100644 index 00000000..5362774e --- /dev/null +++ b/3.10/odoc.css @@ -0,0 +1,783 @@ +@charset "UTF-8"; +/* Copyright (c) 2016 The odoc contributors. All rights reserved. + Distributed under the ISC license, see terms at the end of the file. + odoc 2.1.0 */ + +/* Fonts */ +@import url('https://fonts.googleapis.com/css?family=Fira+Mono:400,500'); +@import url('https://fonts.googleapis.com/css?family=Noticia+Text:400,400i,700'); +@import url('https://fonts.googleapis.com/css?family=Fira+Sans:400,400i,500,500i,600,600i,700,700i'); + +:root, +.light:root { + --main-background: #FFFFFF; + + --color: #333333; + --link-color: #2C94BD; + --anchor-hover: #555; + --anchor-color: #d5d5d5; + --xref-shadow: #cc6666; + --header-shadow: #ddd; + --by-name-version-color: #aaa; + --by-name-nav-link-color: #222; + --target-background: rgba(187, 239, 253, 0.3); + --target-shadow: rgba(187, 239, 253, 0.8); + --pre-border-color: #eee; + --code-background: #f6f8fa; + + --li-code-background: #f6f8fa; + --li-code-color: #0d2b3e; + --toc-color: #1F2D3D; + --toc-before-color: #777; + --toc-background: #f6f8fa; + --toc-list-border: #ccc; + + --spec-summary-border-color: #5c9cf5; + --spec-summary-background: var(--code-background); + --spec-summary-hover-background: #ebeff2; + --spec-details-after-background: rgba(0, 4, 15, 0.05); + --spec-details-after-shadow: rgba(204, 204, 204, 0.53); +} + +.dark:root { + --main-background: #202020; + --code-background: #222; + --line-numbers-background: rgba(0, 0, 0, 0.125); + --navbar-background: #202020; + + --color: #bebebe; + --dirname-color: #666; + --underline-color: #444; + --visited-color: #002800; + --visited-number-color: #252; + --unvisited-color: #380000; + --unvisited-number-color: #622; + --somevisited-color: #303000; + --highlight-color: #303e3f; + --line-number-color: rgba(230, 230, 230, 0.3); + --unvisited-margin-color: #622; + --border: #333; + --navbar-border: #333; + --code-color: #ccc; + + --li-code-background: #373737; + --li-code-color: #999; + --toc-color: #777; + --toc-background: #252525; + + --hljs-link: #999; + --hljs-keyword: #cda869; + --hljs-regexp: #f9ee98; + --hljs-title: #dcdcaa; + --hljs-type: #ac885b; + --hljs-meta: #82aaff; + --hljs-variable: #cf6a4c; +} + +@media (prefers-color-scheme: dark) { + :root { + --main-background: #202020; + --code-background: #333; + --line-numbers-background: rgba(0, 0, 0, 0.125); + --navbar-background: #202020; + + --meter-unvisited-color: #622; + --meter-visited-color: #252; + --meter-separator-color: black; + + --color: #bebebe; + --dirname-color: #666; + --underline-color: #444; + --visited-color: #002800; + --visited-number-color: #252; + --unvisited-color: #380000; + --unvisited-number-color: #622; + --somevisited-color: #303000; + --highlight-color: #303e3f; + --line-number-color: rgba(230, 230, 230, 0.3); + --unvisited-margin-color: #622; + --border: #333; + --navbar-border: #333; + --code-color: #ccc; + --by-name-nav-link-color: var(--color); + + --li-code-background: #373737; + --li-code-color: #999; + --toc-color: #777; + --toc-before-color: #777; + --toc-background: #252525; + --toc-list-border: #ccc; + --spec-summary-hover-background: #ebeff2; + --spec-details-after-background: rgba(0, 4, 15, 0.05); + --spec-details-after-shadow: rgba(204, 204, 204, 0.53); + + --hljs-link: #999; + --hljs-keyword: #cda869; + --hljs-regexp: #f9ee98; + --hljs-title: #dcdcaa; + --hljs-type: #ac885b; + --hljs-meta: #82aaff; + --hljs-variable: #cf6a4c; + } +} + +/* Reset a few things. */ + +html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { + padding: 0; + border: 0; + font: inherit; + vertical-align: baseline; + +} + +table { + border-collapse: collapse; + border-spacing: 0; +} + +*, *:before, *:after { + box-sizing: border-box; +} + +html { + font-size: 15px; +} + +body { + text-align: left; + background: #FFFFFF; + color: var(--color); + background-color: var(--main-background); +} + +body { + max-width: 100ex; + margin-left: calc(10vw + 20ex); + margin-right: 4ex; + margin-top: 20px; + margin-bottom: 50px; + font-family: "Noticia Text", Georgia, serif; + line-height: 1.5; +} + +header { + margin-bottom: 30px; +} + +nav { + font-family: "Fira Sans", Helvetica, Arial, sans-serif; +} + +/* Basic markup elements */ + +b, strong { + font-weight: bold; +} + +i { + font-style: italic; +} + +em, i em.odd{ + font-style: italic; +} + +em.odd, i em { + font-style: normal; +} + +sup { + vertical-align: super; +} + +sub { + vertical-align: sub; +} + +sup, sub { + font-size: 12px; + line-height: 0; + margin-left: 0.2ex; +} + +ul, ol { + list-style-position: outside +} + +ul>li { + margin-left: 22px; +} + +ol>li { + margin-left: 27.2px; +} + +li>*:first-child { + margin-top: 0 +} + +/* Text alignements, this should be forbidden. */ + +.left { + text-align: left; +} + +.right { + text-align: right; +} + +.center { + text-align: center; +} + +/* Links and anchors */ + +a { + text-decoration: none; + color: var(--link-color); +} + +a:hover { + box-shadow: 0 1px 0 0 var(--link-color); +} + +/* Linked highlight */ +*:target { + background-color: var(--target-background) !important; + box-shadow: 0 0px 0 1px var(--target-shadow) !important; + border-radius: 1px; +} + +*:hover > a.anchor { + visibility: visible; +} + +a.anchor:before { + content: "#"; +} + +a.anchor:hover { + box-shadow: none; + text-decoration: none; + color: var(--anchor-hover); +} + +a.anchor { + visibility: hidden; + position: absolute; + /* top: 0px; */ + /* margin-left: -3ex; */ + margin-left: -1.3em; + font-weight: normal; + font-style: normal; + padding-right: 0.4em; + padding-left: 0.4em; + /* To remain selectable */ + color: var(--anchor-color); +} + +.spec > a.anchor { + margin-left: -2.3em; + padding-right: 0.9em; +} + +.xref-unresolved { + color: #2C94BD; +} +.xref-unresolved:hover { + box-shadow: 0 1px 0 0 var(--xref-shadow); +} + +/* Section and document divisions. + Until at least 4.03 many of the modules of the stdlib start at .h7, + we restart the sequence there like h2 */ + +h1, h2, h3, h4, h5, h6, .h7, .h8, .h9, .h10 { + font-family: "Fira Sans", Helvetica, Arial, sans-serif; + font-weight: 400; + padding-top: 0.1em; + line-height: 1.2; + overflow-wrap: break-word; +} + +h1 { + font-weight: 500; + font-size: 2.441em; +} + +h1 { + font-weight: 500; + font-size: 1.953em; + box-shadow: 0 1px 0 0 var(--header-shadow); +} + +h2 { + font-size: 1.563em; +} + +h3 { + font-size: 1.25em; +} + +small, .font_small { + font-size: 0.8em; +} + +h1 code, h1 tt { + font-size: inherit; + font-weight: inherit; +} + +h2 code, h2 tt { + font-size: inherit; + font-weight: inherit; +} + +h3 code, h3 tt { + font-size: inherit; + font-weight: inherit; +} + +h3 code, h3 tt { + font-size: inherit; + font-weight: inherit; +} + +h4 { + font-size: 1.12em; +} + +/* Comment delimiters, hidden but accessible to screen readers and + selected for copy/pasting */ + +/* Taken from bootstrap */ +/* See also https://stackoverflow.com/a/27769435/4220738 */ +.comment-delim { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border: 0; +} + +/* Preformatted and code */ + +tt, code, pre { + font-family: "Fira Mono", courier; + font-weight: 400; +} + +pre { + padding: 0.1em; + border: 1px solid var(--pre-border-color); + border-radius: 5px; + overflow-x: auto; +} + +p code, +li code { + background-color: var(--li-code-background); + color: var(--li-code-color); + border-radius: 3px; + padding: 0 0.3ex; +} + +p a > code { + color: var(--link-color); +} + +code { + white-space: pre-wrap; +} + +/* Code blocks (e.g. Examples) */ + +pre code { + font-size: 0.893rem; +} + +/* Code lexemes */ + +.keyword { + font-weight: 500; +} + +.arrow { white-space: nowrap } + +/* Module member specification */ + +.spec { + background-color: var(--spec-summary-background); + border-radius: 3px; + border-left: 4px solid var(--spec-summary-border-color); + border-right: 5px solid transparent; + padding: 0.35em 0.5em; +} + +.def-doc { + margin-bottom: 10px; +} + +/* Spacing between items */ +div.odoc-spec,.odoc-include { + margin-bottom: 2em; +} + +.spec.type .variant { + margin-left: 2ch; +} +.spec.type .variant p { + margin: 0; + font-style: italic; +} +.spec.type .record { + margin-left: 2ch; +} +.spec.type .record p { + margin: 0; + font-style: italic; +} + +div.def { + margin-top: 0; + text-indent: -2ex; + padding-left: 2ex; +} + +div.def+div.def-doc { + margin-left: 1ex; + margin-top: 2.5px +} + +div.def-doc>*:first-child { + margin-top: 0; +} + +/* Collapsible inlined include and module */ + +.odoc-include details { + position: relative; +} + +.odoc-include.shadowed-include { + display: none; +} + +.odoc-include details:after { + z-index: -100; + display: block; + content: " "; + position: absolute; + border-radius: 0 1ex 1ex 0; + right: -20px; + top: 1px; + bottom: 1px; + width: 15px; + background: var(--spec-details-after-background, rgba(0, 4, 15, 0.05)); + box-shadow: 0 0px 0 1px var(--spec-details-after-shadow, rgba(204, 204, 204, 0.53)); +} + +.odoc-include summary { + position: relative; + margin-bottom: 1em; + cursor: pointer; + outline: none; +} + +.odoc-include summary:hover { + background-color: var(--spec-summary-hover-background); +} + +/* FIXME: Does not work in Firefox. */ +.odoc-include summary::-webkit-details-marker { + color: #888; + transform: scaleX(-1); + position: absolute; + top: calc(50% - 5px); + height: 11px; + right: -29px; +} + +/* Records and variants FIXME */ + +div.def table { + text-indent: 0em; + padding: 0; + margin-left: -2ex; +} + +td.def { + padding-left: 2ex; +} + +td.def-doc *:first-child { + margin-top: 0em; +} + +/* Lists of @tags */ + +.at-tags { list-style-type: none; margin-left: -3ex; } +.at-tags li { padding-left: 3ex; text-indent: -3ex; } +.at-tags .at-tag { text-transform: capitalize } + +/* Lists of modules */ + +.modules { list-style-type: none; margin-left: -3ex; } +.modules li { padding-left: 3ex; text-indent: -3ex; margin-top: 5px } +.modules .synopsis { padding-left: 1ch; } + +/* Odig package index */ + +.packages { list-style-type: none; margin-left: -3ex; } +.packages li { padding-left: 3ex; text-indent: -3ex } +.packages li a.anchor { padding-right: 0.5ch; padding-left: 3ch; } +.packages .version { font-size: 10px; color: var(--by-name-version-color); } +.packages .synopsis { padding-left: 1ch } + +.by-name nav a { + text-transform: uppercase; + font-size: 18px; + margin-right: 1ex; + color: var(--by-name-nav-link-color,); + display: inline-block; +} + +.by-tag nav a { + margin-right: 1ex; + color: var(--by-name-nav-link-color); + display: inline-block; +} + +.by-tag ol { list-style-type: none; } +.by-tag ol.tags li { margin-left: 1ch; display: inline-block } +.by-tag td:first-child { text-transform: uppercase; } + +/* Odig package page */ + +.package nav { + display: inline; + font-size: 14px; + font-weight: normal; +} + +.package .version { + font-size: 14px; +} + +.package.info { + margin: 0; +} + +.package.info td:first-child { + font-style: italic; + padding-right: 2ex; +} + +.package.info ul { + list-style-type: none; + display: inline; + margin: 0; +} + +.package.info li { + display: inline-block; + margin: 0; + margin-right: 1ex; +} + +#info-authors li, #info-maintainers li { + display: block; +} + +/* Sidebar and TOC */ + +.odoc-toc:before { + display: block; + content: "Contents"; + text-transform: uppercase; + font-size: 1em; + margin: 1.414em 0 0.5em; + font-weight: 500; + color: var(--toc-before-color); + line-height: 1.2; +} + +.odoc-toc { + position: fixed; + top: 0px; + bottom: 0px; + left: 0px; + max-width: 30ex; + min-width: 26ex; + width: 20%; + background: var(--toc-background); + overflow: auto; + color: var(--toc-color); + padding-left: 2ex; + padding-right: 2ex; +} + +.odoc-toc ul li a { + font-family: "Fira Sans", sans-serif; + font-size: 0.95em; + color: var(--color); + font-weight: 400; + line-height: 1.6em; + display: block; +} + +.odoc-toc ul li a:hover { + box-shadow: none; + text-decoration: underline; +} + +/* First level titles */ + +.odoc-toc>ul>li>a { + font-weight: 500; +} + +.odoc-toc li ul { + margin: 0px; +} + +.odoc-toc ul { + list-style-type: none; +} + +.odoc-toc ul li { + margin: 0; +} +.odoc-toc>ul>li { + margin-bottom: 0.3em; +} + +.odoc-toc ul li li { + border-left: 1px solid var(--toc-list-border); + margin-left: 5px; + padding-left: 12px; +} + +/* Mobile adjustements. */ + +@media only screen and (max-width: 95ex) { + .odoc-content { + margin: auto; + padding: 2em; + } + .odoc-toc { + position: static; + width: auto; + min-width: unset; + max-width: unset; + border: none; + padding: 0.2em 1em; + border-radius: 5px; + } +} + +/* Print adjustements. */ + +@media print { + body { + color: black; + background: white; + } + body nav:first-child { + visibility: hidden; + } +} + +/* Syntax highlighting (based on github-gist) */ + +.hljs { + display: block; + background: var(--code-background); + padding: 0.5em; + color: var(--color); + overflow-x: auto; +} + +.hljs-comment, +.hljs-meta { + color: #969896; +} + +.hljs-string, +.hljs-variable, +.hljs-template-variable, +.hljs-strong, +.hljs-emphasis, +.hljs-quote { + color: #df5000; +} + +.hljs-keyword, +.hljs-selector-tag { + color: #a71d5d; +} + +.hljs-type, +.hljs-class .hljs-title { + color: #458; + font-weight: 500; +} + +.hljs-literal, +.hljs-symbol, +.hljs-bullet, +.hljs-attribute { + color: #0086b3; +} + +.hljs-section, +.hljs-name { + color: #63a35c; +} + +.hljs-tag { + color: #333333; +} + +.hljs-attr, +.hljs-selector-id, +.hljs-selector-class, +.hljs-selector-attr, +.hljs-selector-pseudo { + color: #795da3; +} + +.hljs-addition { + color: #55a532; + background-color: #eaffea; +} + +.hljs-deletion { + color: #bd2c00; + background-color: #ffecec; +} + +.hljs-link { + text-decoration: underline; +} + +/*--------------------------------------------------------------------------- + Copyright (c) 2016 The odoc contributors + + Permission to use, copy, modify, and/or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + ---------------------------------------------------------------------------*/ diff --git a/index.md b/index.md index 2741051d..6b11a80a 100644 --- a/index.md +++ b/index.md @@ -19,6 +19,7 @@ contains a tutorial and more explanations about what Containers is about. - [last](last) +- [3.10](3.10) - [3.9](3.9) - [3.8](3.8) - [3.7](3.7) diff --git a/last b/last index a02597f4..7c7a975f 120000 --- a/last +++ b/last @@ -1 +1 @@ -3.9 \ No newline at end of file +3.10 \ No newline at end of file