Bwd.BwdLabelsThis module is similar to ListLabels but for backward lists.
Notes on the discrepancies with ListLabels:
New:
Changed:
cons was replaced by snoc.append was replaced by a new version that performs the "textual order yoga".nth, nth_opt, init, iteri, mapi, and filteri.iter, map, fold_left, fold_right, exists, mem, find, filter, and other similar functions.Forbidden:
rev, rev_append, rev_map, and rev_map2 will never be included.Missing but may be added in the future:
tl (as hd for lists), hd (as tl for lists), concat, flatten, concat_map.Please open a GitHub issue if you want a function to be included. We want to make this library useful to you, too!
val length : 'a bwd -> intval compare_length_with : 'a bwd -> len:int -> intval is_empty : 'a bwd -> boolval nth : 'a bwd -> int -> 'aval nth_opt : 'a bwd -> int -> 'a optionval init : len:int -> f:(int -> 'a) -> 'a bwdval prepend : 'a bwd -> 'a list -> 'a listNote that the iteration direction is from the right to the left, in the opposite direction of the corresponding functions in ListLabels.
val iter : f:('a -> unit) -> 'a bwd -> unitval iteri : f:(int -> 'a -> unit) -> 'a bwd -> unitval fold_left : f:('a -> 'b -> 'a) -> init:'a -> 'b bwd -> 'aNot tail-recursive.
val fold_right : f:('a -> 'b -> 'b) -> 'a bwd -> init:'b -> 'bNote that the iteration direction is from the right to the left, in the opposite direction of the corresponding functions in ListLabels.
Note that the iteration direction is from the right to the left, in the opposite direction of the corresponding functions in ListLabels.
val for_all : f:('a -> bool) -> 'a bwd -> boolval exists : f:('a -> bool) -> 'a bwd -> boolval mem : 'a -> set:'a bwd -> boolval memq : 'a -> set:'a bwd -> boolNote that the iteration direction is from the right to the left, in the opposite direction of the corresponding functions in ListLabels.
val find : f:('a -> bool) -> 'a bwd -> 'aval find_opt : f:('a -> bool) -> 'a bwd -> 'a optionval find_index : f:('a -> bool) -> 'a bwd -> int optionval find_map : f:('a -> 'b option) -> 'a bwd -> 'b optionval find_mapi : f:(int -> 'a -> 'b option) -> 'a bwd -> 'b optionval to_list : 'a bwd -> 'a listval of_list : 'a list -> 'a bwdmodule Infix : sig ... end