add CCArray.Sub.to_list

This commit is contained in:
Simon Cruanes 2016-11-01 11:27:07 +01:00
parent 73bb61a2de
commit b7db149e27
2 changed files with 7 additions and 0 deletions

View file

@ -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 =

View file

@ -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 *)