Module Prime_array
Amendment to the standard library Array structure.
val sample : (int -> 'a) -> int -> 'a arraysample f nreturns[|f 0; …; f (n - 1)|]. This callsinitwith arguments reversed.
val filter : ('a -> bool) -> 'a array -> 'a arrayfilter f xais the array containing the elements ofxaon whichfis true with order preserved.
val fmap : ('a -> 'b option) -> 'a array -> 'b arrayval filter_map : ('a -> 'b option) -> 'a array -> 'b arrayfilter_map f xais the array of the non-Noneelements ofmap f xa, preserving order.
val foldi : (int -> 'a -> 'b -> 'b) -> 'a array -> 'b -> 'bfoldi f [|x₁; …; xₙ|]isf (n - 1) xₙ ∘ ⋯ ∘ f 0 x₁.
val for_all : ('a -> bool) -> 'a array -> boolfor_all f [|x₁; …; xₙ|]is true ifff xᵢis true for alli.fis applied to the elements in order until false is returned.
val exists : ('a -> bool) -> 'a array -> boolexists f [|x₁; …; xₙ|]is true ifff xᵢis true for somei.fis applied to the elements in order until true is returned.
val count : ('a -> bool) -> 'a array -> intcount f xais the number of elementsxofxafor whichf xholds.