Brr.TarrayTyped arrays.
module Buffer : sig ... endArrayBuffer objects (byte buffers).
module Data_view : sig ... endDataView objects (byte-level typed data access on ArrayBuffers).
type ('a, 'b) type' = | Int8 : (int, Stdlib.Bigarray.int8_signed_elt) type'| Int16 : (int, Stdlib.Bigarray.int16_signed_elt) type'| Int32 : (int32, Stdlib.Bigarray.int32_elt) type'| Uint8 : (int, Stdlib.Bigarray.int8_unsigned_elt) type'| Uint8_clamped : (int, Stdlib.Bigarray.int8_unsigned_elt) type'| Uint16 : (int, Stdlib.Bigarray.int16_unsigned_elt) type'| Uint32 : (int32, Stdlib.Bigarray.int32_elt) type'| Float32 : (float, Stdlib.Bigarray.float32_elt) type'| Float64 : (float, Stdlib.Bigarray.float64_elt) type'The type for typed array whose elements are of type 'b and are accessed with type 'a.
val type_size_in_bytes : ('a, 'b) type' -> inttype_size_in_bytes t is the number of bytes used to store an element of type 'b.
Note. In the functions below.
length. This means that -1 denotes the last element of the buffer.start defaults to 0.stop defaults to length b.The type for ArrayBufferView objects (typed access to ArrayBuffer objects) whose elements are of type 'b and accessed with type 'a. See the type aliases.
create n t is an array of type t with n elements of type 'b initialised to their zero. See also converting.
of_buffer t ~byte_offset ~length b is an array of type t with length elements of type 'b starting at the byte offset byte_offset of b. byte_offset defaults to 0 and length so as to get to the end of the buffer.
val byte_offset : ('a, 'b) t -> intbyte_offset a is the byte index where a starts in buffer a.
val byte_length : ('a, 'b) t -> intbyte_length a is the byte length of a.
val length : ('a, 'b) t -> intlength a are the number of elements in a.
val get : ('a, 'b) t -> int -> 'aget a i is the element of a at i.
val set : ('a, 'b) t -> int -> 'a -> unitset a i v sets the element of a at i to v.
set_tarray a ~dst b sets the values of a starting at index dst with those of b which are converted to match the type of a (unclear how exactly).
val fill : ?start:int -> ?stop:int -> 'a -> ('a, 'b) t -> unitfill ~start ~stop v a sets the elements in range [start];[stop-1] to v.
val copy_within : ?start:int -> ?stop:int -> dst:int -> ('a, 'b) t -> unitcopy_within ~start ~stop ~dst a copies at at dst the elements in range [start];[stop-1].
slice ~start ~stop a is a new array holding a copy of the bytes of a in range [start;stop-1]. This is a copy, use sub to share the data.
sub ~start ~stop a is an array that spans the bytes of b in range [start;stop-1]. This is not a copy, use slice to make a copy.
val find : (int -> 'a -> bool) -> ('a, 'b) t -> 'a optionfind sat a is the first index a.i for which sat i a.[i] is true.
val find_index : (int -> 'a -> bool) -> ('a, 'b) t -> int optionfind sat a is the first index i for which sat i a.[i] is true.
val for_all : (int -> 'a -> bool) -> ('a, 'b) t -> boolfor_all sat a is true iff all elements a.[i] of b satisfy sat i a.[i].
val exists : (int -> 'a -> bool) -> ('a, 'b) t -> boolexists sat a is true iff one elements a.[i] of b satisfies sat i a.[i].
filter sat a is an array with the elements a.[i] of a for which sat i a.[i] is true.
val iter : (int -> 'a -> unit) -> ('a, 'b) t -> unititer f a calls f i a.[i] on each element of a.
map f a is a new typed array with elements of a mapped by f.
val fold_left : ('c -> 'a -> 'c) -> 'c -> ('a, 'b) t -> 'cfold_left f acc a folds f over the elements of a starting with acc.
val fold_right : ('a -> 'c -> 'c) -> ('a, 'b) t -> 'c -> 'cfold_right f acc a folds f over the elements of a starting with acc.
Use these in interfaces.
type int8 = (int, Stdlib.Bigarray.int8_signed_elt) ttype int16 = (int, Stdlib.Bigarray.int16_signed_elt) ttype int32 = (Stdlib.Int32.t, Stdlib.Bigarray.int32_elt) ttype uint8 = (int, Stdlib.Bigarray.int8_unsigned_elt) ttype uint8_clamped = (int, Stdlib.Bigarray.int8_unsigned_elt) ttype uint16 = (int, Stdlib.Bigarray.int16_unsigned_elt) ttype uint32 = (Stdlib.Int32.t, Stdlib.Bigarray.int32_elt) ttype float32 = (float, Stdlib.Bigarray.float32_elt) ttype float64 = (float, Stdlib.Bigarray.float64_elt) tof_tarray t a is an array of type t with the elements of a converted accordingly (unclear how exactly).
of_int_array t arr is an array of type t whose elements are the values of arr, values exceeding the range for the type are taken modulo the range bounds (except for Uint8_clamped).
of_int_array t arr is an array of type t whose elements are the values of arr, values exceeding the range for the type are taken modulo the range bounds (except for Uint8_clamped).
val to_jstr : uint8 -> (Jstr.t, Jv.Error.t) Stdlib.resultto_jstr a is the UTF-8 encoded data a as a string. Errors if a holds invalid UTF-8.
val of_binary_jstr : Jstr.t -> (uint8, Jv.Error.t) Stdlib.resultof_binary_jstr s is an unsigned byte array with the bytes of the binary string s. In s every byte is represented by a code unit in the range [0;255]. Errors if a code unit of s is greater than 255.
to_binary_jstr a converts a to a binary string, a string in which every byte is represented by a code unit in the range [0;255].
to_int_jstr ~sep a is a string with the elements of a printed and separated by sep (defaults to Jstr.sp).
to_hex_jstr ?sep a is a string with the bytes of a printed in lowercase hex and separated by sep (defaults to Jstr.empty).
val to_string : uint8 -> stringto_string a is an OCaml byte string from the byte array.
val type_to_bigarray_kind : ('a, 'b) type' -> ('a, 'b) Stdlib.Bigarray.kindtype_to_bigarray_kind t is t as a bigarray kind. Uint32 is mapped on Bigarray.int32.
val type_of_bigarray_kind :
('a, 'b) Stdlib.Bigarray.kind ->
('a, 'b) type' optiontype_of_bigarray_kind k is k as a type array type or None if there is no corresponding one.
val bigarray_kind : ('a, 'b) t -> ('a, 'b) Stdlib.Bigarray.kindbigarray_kind a is the bigarray kind of a.
val of_bigarray1 :
('a, 'b, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array1.t ->
('a, 'b) tof_bigarray1 b is a typed array with the data of bigarray b. The data buffer is shared.
val to_bigarray1 :
('a, 'b) t ->
('a, 'b, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array1.tto_bigarray b is a bigarray with the data of bigarray b. The data buffer is shared.
val of_bigarray :
('a, 'b, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Genarray.t ->
('a, 'b) tof_bigarray b is a typed array with the data of bigarray b. The data buffer is shared. XXX. How is the data laid out ?