package octez-proto-libs
- Overview
- No Docs
You can search for identifiers within the package.
in-package search v0.2.0
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=aa2f5bc99cc4ca2217c52a1af2a2cdfd3b383208cb859ca2e79ca0903396ca1d
sha512=d68bb3eb615e3dcccc845fddfc9901c95b3c6dc8e105e39522ce97637b1308a7fa7aa1d271351d5933febd7476b2819e1694f31198f1f0919681f1f9cc97cb3a
doc/octez-proto-libs.protocol-environment/Tezos_protocol_environment/V4/Make/FallbackArray/index.html
Module Make.FallbackArraySource
This module implements arrays equipped with accessors that cannot raise exceptions. Reading out of the bounds of the arrays return a fallback value fixed at array construction time, writing out of the bounds of the arrays is ignored.
val make : int -> 'a -> 'a tmake len v builds an array a initialized len cells with v. The value v is the fallback value for a.
val fallback : 'a t -> 'afallback a returns the fallback value for a.
val length : 'a t -> intlength a returns the length of a.
val get : 'a t -> int -> 'aget a idx returns the contents of the cell of index idx in a. If idx < 0 or idx >= length a, get a idx = fallback a.
val set : 'a t -> int -> 'a -> unitset a idx value updates the cell of index idx with value. If idx < 0 or idx >= length a, a is unchanged.
val iter : ('a -> unit) -> 'a t -> unititer f a iterates f over the cells of a from the cell indexed 0 to the cell indexed length a - 1.
map f a computes a new array obtained by applying f to each cell contents of a. Notice that the fallback value of the new array is f (fallback a).
val fold : ('b -> 'a -> 'b) -> 'a t -> 'b -> 'bfold a init f traverses a from the cell indexed 0 to the cell indexed length a - 1 and transforms accu into f accu x where x is the content of the cell under focus. accu is init on the first iteration.