package bwd

  1. Overview
  2. Docs

This module mimics a small part of the Stdlib.ListLabels module.

type 'a t = 'a bwd =
  1. | Emp
  2. | Snoc of 'a t * 'a
val length : 'a t -> int
val snoc : 'a t -> 'a -> 'a t
val nth : 'a t -> int -> 'a
val append : 'a t -> 'a list -> 'a t
val prepend : 'a t -> 'a list -> 'a list

Comparison

val equal : eq:('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val compare : cmp:('a -> 'a -> int) -> 'a t -> 'a t -> int

Iterators

val iter : f:('a -> unit) -> 'a t -> unit
val map : f:('a -> 'b) -> 'a t -> 'b t
val mapi : f:(int -> 'a -> 'b) -> 'a t -> 'b t
val filter_map : f:('a -> 'b option) -> 'a t -> 'b t
val concat_map : f:('a -> 'b list) -> 'a t -> 'b t
  • deprecated This function is ill-designed and will be removed or changed in the next major release.
val fold_left : f:('a -> 'b -> 'a) -> init:'a -> 'b t -> 'a
val fold_right : f:('a -> 'b -> 'b) -> 'a t -> init:'b -> 'b

Iterators on two lists

val fold_right2 : f:('a -> 'b -> 'c -> 'c) -> 'a t -> 'b t -> init:'c -> 'c

List scanning

val for_all : f:('a -> bool) -> 'a t -> bool
val exists : f:('a -> bool) -> 'a t -> bool
val mem : 'a -> set:'a t -> bool

List searching

val filter : f:('a -> bool) -> 'a t -> 'a t

Backward and forward lists

val to_list : 'a t -> 'a list
val of_list : 'a list -> 'a t
OCaml

Innovation. Community. Security.