Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
Ranger - An interval slice for any data structures
val create :
?start:int ->
stop:[ `Inclusive of int | `Exclusive of int ] ->
(int -> 'a) ->
'a t
val repeat : times:int -> 'a -> 'a t
repeat ~times:3 1
|> to_list is equivalent to 1;1;1
val get : 'a t -> int -> 'a
get t i
gets the ith element of the range (0 being the first element in the range)
val of_array :
?start:int ->
?stop:[ `Inclusive of int | `Exclusive of int ] ->
'a array ->
'a t
Create a range out of an array
val of_string :
?start:int ->
?stop:[ `Inclusive of int | `Exclusive of int ] ->
string ->
char t
Create a range out of a string
val of_list :
?start:int ->
?stop:[ `Inclusive of int | `Exclusive of int ] ->
'a list ->
'a t
Create a range out of a list
val to_list : 'a t -> 'a list
val to_string : char t -> string
val iter : 'a t -> f:('a -> unit) -> unit
val iteri : 'a t -> f:(int -> 'a -> unit) -> unit
val bounds : 'a t -> int * int
bounds t
returns the first and last index in the range corresponding to the value the range was created from
val for_all : 'a t -> f:('a -> bool) -> bool
for_all t ~f
returns true if f
returns true for every element spanned by t. false otherwise
val length : 'a t -> int
val is_empty : 'a t -> bool
val fold_left : 'a t -> init:'b -> f:('b -> 'a -> 'b) -> 'b
val fold_right : 'a t -> f:('a -> 'b -> 'b) -> init:'b -> 'b
val reduce : 'a t -> f:('a -> 'a -> 'a) -> 'a option
val hd : 'a t -> 'a option
val hd_exn : 'a t -> 'a
val mid : 'a t -> [ `One of 'a | `Two of 'a * 'a ] option