Module Bwd.BwdLabelsSource
This module is similar to ListLabels but for backward lists.
Notes on the discrepancies with ListLabels:
- Functions
rev, rev_append, rev_map, and rev_map2 will never be included. - A new function
prepend was added as the forward version of append. - A new module
Notation was added for the infix notation. - Functions for association lists are currently missing, but might be added later.
- Functions
init, tl (as hd for lists), hd (as tl for lists), merge, to_seq, and of_seq are also missing, but might be added in the future.
Please open a GitHub issue if you want a function to be included. We want to make this library useful to you, too!
Sourceval compare_length_with : 'a bwd -> len:int -> int Sourceval nth_opt : 'a bwd -> int -> 'a option Sourceval prepend : 'a bwd -> 'a list -> 'a list Comparison
Sourceval equal : eq:('a -> 'a -> bool) -> 'a bwd -> 'a bwd -> bool Sourceval compare : cmp:('a -> 'a -> int) -> 'a bwd -> 'a bwd -> int Iterators
Note that the iteration direction is from the right to the left, in the opposite direction of the corresponding functions in ListLabels.
Sourceval iter : f:('a -> unit) -> 'a bwd -> unit Sourceval iteri : f:(int -> 'a -> unit) -> 'a bwd -> unit Sourceval filter_map : f:('a -> 'b option) -> 'a bwd -> 'b bwd Sourceval fold_left : f:('a -> 'b -> 'a) -> init:'a -> 'b bwd -> 'a Sourceval fold_right_map :
f:('a -> 'b -> 'b * 'c) ->
'a bwd ->
init:'b ->
'b * 'c bwd Sourceval fold_right : f:('a -> 'b -> 'b) -> 'a bwd -> init:'b -> 'b Iterators on two lists
Note that the iteration direction is from the right to the left, in the opposite direction of the corresponding functions in ListLabels.
Sourceval iter2 : f:('a -> 'b -> unit) -> 'a bwd -> 'b bwd -> unit Sourceval fold_left2 : f:('a -> 'b -> 'c -> 'a) -> init:'a -> 'b bwd -> 'c bwd -> 'a Sourceval fold_right2 : f:('a -> 'b -> 'c -> 'c) -> 'a bwd -> 'b bwd -> init:'c -> 'c List scanning
Note that the iteration direction is from the right to the left, in the opposite direction of the corresponding functions in ListLabels.
Sourceval for_all : f:('a -> bool) -> 'a bwd -> bool Sourceval exists : f:('a -> bool) -> 'a bwd -> bool Sourceval for_all2 : f:('a -> 'b -> bool) -> 'a bwd -> 'b bwd -> bool Sourceval exists2 : f:('a -> 'b -> bool) -> 'a bwd -> 'b bwd -> bool List searching
Note that the iteration direction is from the right to the left, in the opposite direction of the corresponding functions in ListLabels.
Sourceval find : f:('a -> bool) -> 'a bwd -> 'a Sourceval find_opt : f:('a -> bool) -> 'a bwd -> 'a option Sourceval find_map : f:('a -> 'b option) -> 'a bwd -> 'b option Sourceval filteri : f:(int -> 'a -> bool) -> 'a bwd -> 'a bwd Lists of pairs
Backward and forward lists
Infix notation
Notation inspired by Conor McBride.