mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
add CCArray.Sub.to_list
This commit is contained in:
parent
73bb61a2de
commit
b7db149e27
2 changed files with 7 additions and 0 deletions
|
|
@ -709,6 +709,9 @@ module Sub = struct
|
|||
else _fold (f acc a.arr.(i)) (i+1) j
|
||||
in _fold acc a.i a.j
|
||||
|
||||
let to_list a =
|
||||
fold (fun l x -> x::l) [] a |> List.rev
|
||||
|
||||
let foldi f acc a = _foldi f acc a.arr a.i a.j
|
||||
|
||||
let fold_while f acc a =
|
||||
|
|
|
|||
|
|
@ -247,6 +247,10 @@ module Sub : sig
|
|||
(** Convert into a triple [(arr, i, len)] where [len] is the length of
|
||||
the subarray of [arr] starting at offset [i] *)
|
||||
|
||||
val to_list : 'a t -> 'a list
|
||||
(** Convert directly to a list
|
||||
@since NEXT_RELEASE *)
|
||||
|
||||
val full : 'a array -> 'a t
|
||||
(** Slice that covers the full array *)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue