You can search for identifiers within the package.
in-package search v0.2.0
Source file vec_intf.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180open!CoremoduletypeS=sigtypeindextype'at[@@derivingcompare,equal,sexp]includeInvariant.S1withtype'at:='atvalcreate:?initial_capacity:int->unit->'at(** [init n ~f] returns a fresh vector of length [n], with element number [i]
initialized to the result of [f i]. In other words, [init n ~f] tabulates the
results of [f] applied to the integers [0] to [n-1].
Raise Invalid_argument if [n < 0].
*)valinit:int->f:(int->'a)->'at(** Raises if the index is invalid. *)valget:'at->index->'avalmaybe_get:'at->index->'aoptionvalmaybe_get_local:'at->index->'aGel.toption(** Raises if the index is invalid. *)valset:'at->index->'a->unitincludeContainer.S1withtype'at:='atincludeBlit.S1withtype'at:='at(** Finds the first 'a for which f is true **)valfind_exn:'at->f:('a->bool)->'a(** [sort] uses constant heap space.
To sort only part of the array, specify [pos] to be the index to start sorting from
and [len] indicating how many elements to sort. *)valsort:?pos:int->?len:int->'at->compare:('a->'a->int)->unitvalis_sorted:'at->compare:('a->'a->int)->boolvalnext_free_index:'at->indexvalpush_back:'at->'a->unitvalpush_back_index:'at->'a->index(** Grows the vec to the specified length if it is currently shorter. Sets all new
indices to [default]. *)valgrow_to:'at->len:int->default:'a->unit(** Equivalent to [grow_to t (index + 1) ~default]. *)valgrow_to_include:'at->index->default:'a->unit(** Grows the vec to the specified length if it is currently shorter. Sets all new
indices to [default idx]. *)valgrow_to':'at->len:int->default:(index->'a)->unit(** Equivalent to [grow_to' t (index + 1) ~default]. *)valgrow_to_include':'at->index->default:(index->'a)->unit(** Shortens the vec to the specified length if it is currently longer. Raises if [len <
0]. *)valshrink_to:'at->len:int->unit(** [remove vec i] Removes the i-th element of the vector. This is not a fast
implementation, and runs in O(N) time. (ie: it calls caml_modify under the hood)
*)valremove_exn:'at->int->unit(** Find the first element that satisfies [f]. If exists, remove the element from the
vector and return it. This is not a fast implementation, and runs in O(N) time.
*)valfind_and_remove:'at->f:('a->bool)->'aoptionvalpop_back_exn:'at->'avalpop_back_unit_exn:'at->unitvalpeek_back:'at->'aoptionvalpeek_back_exn:'at->'avalfoldi:'at->init:'accum->f:(index->'accum->'a->'accum)->'accumvalfoldi_local_accum:'at->init:'accum->f:(index->'accum->'a->'accum)->'accumvaliteri:'at->f:(index->'a->unit)->unitvalto_list:'at->'alistvalto_local_list:'at->'alistvalto_alist:'at->(index*'a)list(** The input vec is copied internally so that future modifications of it do not change
the sequence. *)valto_sequence:'at->'aSequence.t(** The input vec is shared with the sequence and modifications of it will result in
modification of the sequence. *)valto_sequence_mutable:'at->'aSequence.tvalof_list:'alist->'atvalof_array:'aarray->'atvalof_sequence:'aSequence.t->'at(** [take_while t ~f] returns a fresh vec containing the longest prefix of [t] for which
[f] is [true]. *)valtake_while:'at->f:('a->bool)->'atmoduleInplace:sig(** [sub] is like [Blit.sub], but modifies the vec in place. *)valsub:'at->pos:index->len:int->unit(** [take_while t ~f] shortens the vec in place to the longest prefix of [t] for which
[f] is [true]. *)valtake_while:'at->f:('a->bool)->unit(** Remove all elements from [t] that don't satisfy [f]. Shortens the vec in place. *)valfilter:'at->f:('a->bool)->unit(** Modifies a vec in place, applying [f] to every element of the vec. *)valmap:'at->f:('a->'a)->unit(** Same as [map], but [f] also takes the index. *)valmapi:'at->f:(index->'a->'a)->unitend(** The number of elements we can hold without growing. *)valcapacity:_t->int(** [clear t] discards all elements from [t] in O(length) time. *)valclear:_t->unit(** [clear_imm t] discards all elements from ['a t] in O(1) time if ['a] is immediate. *)valclear_imm:'at->'aType_immediacy.Always.t->unit(** [copy t] returns a copy of [t], that is, a fresh vec containing the same elements as
[t]. *)valcopy:'at->'at(** [exists t ~f] returns true if [f] evaluates true on any element, else false *)valexists:'at->f:('a->bool)->bool(** swap the values at the provided indices *)valswap:_t->index->index->unit(** [swap_to_last_and_pop t i] is equivalent to [swap t i (length t - 1); pop_back_exn t].
It raises if [i] is out of bounds. *)valswap_to_last_and_pop:'at->index->'amoduleWith_structure_details:sig(** [[%sexp_of : t]] above only prints the elements. This gives various data structure
details. *)typenonrec'at='at[@@derivingsexp_of]endvalunsafe_get:'at->index->'avalunsafe_set:'at->index->'a->unitmoduleExpert:sigvalunsafe_inner:'at->Obj.tUniform_array.tendmoduleStable:sigmoduleV1:sigtypenonrec'at='at[@@derivingbin_io,compare,sexp]endendendmoduletypeVec=sig(** A growable array of ['a]. Designed for efficiency and simplicity.
This interface is generated lazily: if you need a standard function we haven't
added, feel free to add or ping the authors.
By default, [Vec] operations use integers as indices. The functor [Make] can be used
to create a specialized version from any module implementing [Intable.S]. *)includeSwithtypeindex:=intmoduletypeS=S(** Generate a specialised version of [Vec] with a custom index type. *)moduleMake(M:Intable.S):Swithtypeindex:=M.tend