diff --git a/dev/containers/CCByte_buffer/index.html b/dev/containers/CCByte_buffer/index.html index e8452cac..d790ea70 100644 --- a/dev/containers/CCByte_buffer/index.html +++ b/dev/containers/CCByte_buffer/index.html @@ -1,2 +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 +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/dev/containers/CCFormat/index.html b/dev/containers/CCFormat/index.html index 64f10322..749b1ba5 100644 --- a/dev/containers/CCFormat/index.html +++ b/dev/containers/CCFormat/index.html @@ -140,7 +140,7 @@ 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.

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.

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.

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.

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.

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.

val sprintf_dyn_color : + (styling [`FG `Red] string) "red"

Available only on OCaml >= 4.08.

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.

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.

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.

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.

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.

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 *)
diff --git a/dev/containers/CCParse/index.html b/dev/containers/CCParse/index.html
index 61150c97..5f3f010b 100644
--- a/dev/containers/CCParse/index.html
+++ b/dev/containers/CCParse/index.html
@@ -24,7 +24,7 @@ let l_printed =
 
 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 NEXT_RELEASE
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 : +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 -> diff --git a/dev/containers/CCResult/index.html b/dev/containers/CCResult/index.html index 39291d81..ae291d79 100644 --- a/dev/containers/CCResult/index.html +++ b/dev/containers/CCResult/index.html @@ -6,7 +6,7 @@ '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 NEXT_RELEASE
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

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 -> diff --git a/dev/containers/CCSeq/index.html b/dev/containers/CCSeq/index.html index 462337ea..8c9d5d05 100644 --- a/dev/containers/CCSeq/index.html +++ b/dev/containers/CCSeq/index.html @@ -1,5 +1,5 @@ -CCSeq (containers.CCSeq)

Module CCSeq

Helpers for the standard Seq type

See oseq for a richer API.

  • since 3.0
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

type +'a t = unit -> 'a node
and +'a node = 'a Stdlib.Seq.node =
| Nil
| Cons of 'a * 'a t
val nil : 'a t
val empty : 'a t
val cons : 'a -> 'a t -> 'a t
val singleton : 'a -> 'a t
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 cycle : 'a t -> 'a t

Cycle through the iterator infinitely. The iterator shouldn't be empty.

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
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 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 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 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 flat_map : ( 'a -> 'b t ) -> 'a t -> 'b t
val filter_map : ( 'a -> 'b option ) -> 'a t -> 'b t
val flatten : 'a t t -> 'a t
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 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 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 zip_i : 'a t -> (int * 'a) t

zip_i seq zips the index of each element with the element itself.

  • since NEXT

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 NEXT_RELEASE

IO

val pp : +CCSeq (containers.CCSeq)

Module CCSeq

Helpers for the standard Seq type

See oseq for a richer API.

  • since 3.0
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

type +'a t = unit -> 'a node
and +'a node = 'a Stdlib.Seq.node =
| Nil
| Cons of 'a * 'a t
val nil : 'a t
val empty : 'a t
val cons : 'a -> 'a t -> 'a t
val singleton : 'a -> 'a t
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 cycle : 'a t -> 'a t

Cycle through the iterator infinitely. The iterator shouldn't be empty.

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
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 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 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 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 flat_map : ( 'a -> 'b t ) -> 'a t -> 'b t
val filter_map : ( 'a -> 'b option ) -> 'a t -> 'b t
val flatten : 'a t t -> 'a t
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 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 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 zip_i : 'a t -> (int * 'a) t

zip_i seq zips the index of each element with the element itself.

  • since NEXT

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 -> diff --git a/dev/containers/CCVector/index.html b/dev/containers/CCVector/index.html index c07476dc..37dee65f 100644 --- a/dev/containers/CCVector/index.html +++ b/dev/containers/CCVector/index.html @@ -1,5 +1,5 @@ -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 NEXT_RELEASE
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 NEXT_RELEASE
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 : +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 -> diff --git a/dev/index.html b/dev/index.html index aa9b9ed7..bbf063f8 100644 --- a/dev/index.html +++ b/dev/index.html @@ -11,9 +11,9 @@

OCaml package documentation

    -
  1. containers 3.6.1
  2. -
  3. containers-data 3.6.1
  4. -
  5. containers-thread 3.6.1
  6. +
  7. containers 3.7
  8. +
  9. containers-data 3.7
  10. +
  11. containers-thread 3.7