Module CCArray1.View

module View: sig .. end

type 'a t 
A view on an array or part of an array
val of_array : ('a, 'b, [< `R | `W > `R ]) CCArray1.array_ -> 'a t
val get : 'a t -> int -> 'a
get v i returns the i-th element of v. Caution, this is not as cheap as a regular array indexing, and it might involve recursion.
Raises Invalid_argument if index out of bounds
val length : 'a t -> int
length v is the number of elements of v
val map : f:('a -> 'b) -> 'a t -> 'b t
Map values
val map2 : f:('a -> 'b -> 'c) ->
'a t -> 'b t -> 'c t
Map values
Raises WrongDimension if lengths do not fit
val select : idx:(int, 'b, [< `R | `W > `R ]) CCArray1.array_ ->
'a t -> 'a t
select ~idx v is the view that has length length idx and such that get (select ~idx a) i = get a (get idx i)
val select_a : idx:int array -> 'a t -> 'a t
See CCArray1.View.select
val select_view : idx:int t -> 'a t -> 'a t
See CCArray1.View.select
val foldi : ('b -> int -> 'a -> 'b) -> 'b -> 'a t -> 'b
Fold on values with their index
val iteri : f:(int -> 'a -> unit) -> 'a t -> unit
iteri ~f v iterates on elements of v with their index
module type S = sig .. end
module Int: sig .. end
module Float: sig .. end
val raw : length:(('a, 'b, [< `R | `W > `R ]) CCArray1.array_ -> int) ->
get:(('a, 'b, [< `R | `W > `R ]) CCArray1.array_ -> int -> 'a) ->
('a, 'b, [< `R | `W > `R ]) CCArray1.array_ -> 'a t
val to_array : ?res:('a, 'b, [< `R | `W > `W ] as 'c) CCArray1.array_ ->
?kind:('a, 'b) Bigarray.kind ->
'a t -> ('a, 'b, 'c) CCArray1.array_
to_array v returns a fresh copy of the content of v. Exactly one of res and kind must be provided