Module Bwd.BwdSource
This module is similar to List but for backward lists.
Notes on the discrepancies with List:
- 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 -> int -> int Sourceval nth_opt : 'a bwd -> int -> 'a option Sourceval prepend : 'a bwd -> 'a list -> 'a list Comparison
Sourceval equal : ('a -> 'a -> bool) -> 'a bwd -> 'a bwd -> bool Sourceval compare : ('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 List.
Sourceval iter : ('a -> unit) -> 'a bwd -> unit Sourceval iteri : (int -> 'a -> unit) -> 'a bwd -> unit Sourceval filter_map : ('a -> 'b option) -> 'a bwd -> 'b bwd Sourceval fold_left : ('a -> 'b -> 'a) -> 'a -> 'b bwd -> 'a Sourceval fold_right_map : ('a -> 'b -> 'b * 'c) -> 'a bwd -> 'b -> 'b * 'c bwd Sourceval fold_right : ('a -> 'b -> 'b) -> 'a bwd -> '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 List.
Sourceval iter2 : ('a -> 'b -> unit) -> 'a bwd -> 'b bwd -> unit Sourceval fold_left2 : ('a -> 'b -> 'c -> 'a) -> 'a -> 'b bwd -> 'c bwd -> 'a Sourceval fold_right2 : ('a -> 'b -> 'c -> 'c) -> 'a bwd -> 'b bwd -> '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 List.
Sourceval for_all : ('a -> bool) -> 'a bwd -> bool Sourceval exists : ('a -> bool) -> 'a bwd -> bool Sourceval for_all2 : ('a -> 'b -> bool) -> 'a bwd -> 'b bwd -> bool Sourceval exists2 : ('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 List.
Sourceval find : ('a -> bool) -> 'a bwd -> 'a Sourceval find_opt : ('a -> bool) -> 'a bwd -> 'a option Sourceval find_map : ('a -> 'b option) -> 'a bwd -> 'b option Lists of pairs
Backward and forward lists
Infix notation
Notation inspired by Conor McBride.