diff --git a/dev/containers-data/CCBV/index.html b/dev/containers-data/CCBV/index.html index b669893c..a86dd993 100644 --- a/dev/containers-data/CCBV/index.html +++ b/dev/containers-data/CCBV/index.html @@ -1,3 +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 NEXT_RELEASE
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 NEXT_RELEASE
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 NEXT_RELEASE
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 NEXT_RELEASE
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 + 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/dev/containers/CCEqualLabels/index.html b/dev/containers/CCEqualLabels/index.html index 99245474..c0746b70 100644 --- a/dev/containers/CCEqualLabels/index.html +++ b/dev/containers/CCEqualLabels/index.html @@ -1,2 +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 NEXT_RELEASE
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 NEXT_RELEASE
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 +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/dev/containers/CCInt32/index.html b/dev/containers/CCInt32/index.html index 3585f587..d5291a11 100644 --- a/dev/containers/CCInt32/index.html +++ b/dev/containers/CCInt32/index.html @@ -1,2 +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 NEXT_RELEASE
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 +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/dev/containers/CCInt64/index.html b/dev/containers/CCInt64/index.html index 3f5acff7..a75f5248 100644 --- a/dev/containers/CCInt64/index.html +++ b/dev/containers/CCInt64/index.html @@ -1,2 +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. Like Stdlib.abs(to_intx).

val popcount : t -> int

Number of bits set to 1.

  • since NEXT_RELEASE
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 +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. Like Stdlib.abs(to_intx).

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/dev/containers/Containers_cbor/index.html b/dev/containers/Containers_cbor/index.html index 7cafc6d8..11186a86 100644 --- a/dev/containers/Containers_cbor/index.html +++ b/dev/containers/Containers_cbor/index.html @@ -1,2 +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 int
| `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 +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 int
| `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/dev/index.html b/dev/index.html index ae8783fe..65d73eff 100644 --- a/dev/index.html +++ b/dev/index.html @@ -11,9 +11,9 @@

OCaml package documentation

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