module Flat_tuple_array: Flat_tuple_array
module Slots: Tuple_type.Slots
module Slot: Tuple_type.Slot
type 'slots
t
The type of a flat tuple array. 'slots
will look like ('a1, ..., 'an) Slots.tn
,
and the array holds tuples of type 'a1 * ... * 'an
.
include Invariant.S1
val create : ('tuple, 'a) Slots.t ->
len:int -> 'tuple -> ('tuple, 'a) Slots.t t
create slots ~len init
creates an array of len
tuples, each initialized to
init
. create
raises if len < 0
.
val length : 'a t -> int
val get : ('b, 'v) Slots.t t -> int -> ('v, 'a) Slot.t -> 'a
get t i slot
returns tuple i
's slot
.
val unsafe_get : ('b, 'v) Slots.t t -> int -> ('v, 'a) Slot.t -> 'a
val set : ('b, 'v) Slots.t t -> int -> ('v, 'a) Slot.t -> 'a -> unit
set t i slot a
sets tuple i
's slot
to a
.
val unsafe_set : ('b, 'v) Slots.t t -> int -> ('v, 'a) Slot.t -> 'a -> unit
val get_tuple : ('tuple, 'a) Slots.t t -> int -> 'tuple
get_tuple t i
allocates an OCaml tuple isomorphic to the tuple at index i
in
t
.
val sexp_of_t : ('slots -> Sexplib.Sexp.t) -> 'slots t -> Sexplib.Sexp.t
create slots ~len init
creates an array of len
tuples, each initialized to
init
. create
raises if len < 0
.
get t i slot
returns tuple i
's slot
.
set t i slot a
sets tuple i
's slot
to a
.
get_tuple t i
allocates an OCaml tuple isomorphic to the tuple at index i
in
t
.