mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 03:05:28 -05:00
Implement CCImmutArray.sub, but creates a copy
This commit is contained in:
parent
3b50617744
commit
c49458d923
2 changed files with 7 additions and 0 deletions
|
|
@ -27,6 +27,8 @@ let set a n x =
|
|||
a'.(n) <- x;
|
||||
a'
|
||||
|
||||
let sub = Array.sub (* Would this not be better implemented with CCArray_slice *)
|
||||
|
||||
let map = Array.map
|
||||
|
||||
let mapi = Array.mapi
|
||||
|
|
|
|||
|
|
@ -36,6 +36,11 @@ val get : 'a t -> int -> 'a
|
|||
val set : 'a t -> int -> 'a -> 'a t
|
||||
(** Copy the array and modify its copy *)
|
||||
|
||||
val sub : 'a t -> int -> int -> 'a t
|
||||
(** [sub a start len] returns a fresh array of length len, containing the elements number start to start + len - 1 of array a.
|
||||
Raises [Invalid_argument "Array.sub"] if start and len do not designate a valid subarray of a; that is, if start < 0, or len < 0, or start + len > Array.length a. *)
|
||||
|
||||
|
||||
val map : ('a -> 'b) -> 'a t -> 'b t
|
||||
|
||||
val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue