Module Lazy_list

Lazy lists.

type 'a t
include Core.Monad.S with type 'a t := 'a t
val return : 'a 'i 'p 'q. 'a -> 'a t

Convert a value to a t.

val bind : 'a 'b 'i 'j 'k 'p 'q. 'a t -> f:('a -> 'b t) -> 'b t

Sequences computations. bind t ~f computes f v for value(s) v in t. Well-behaved monads satisfy these "laws" (where ( >>= ) is the infix bind operator):

  • map t ~f is equivalent to bind t ~f:(fun x -> return (f x))
  • return x >>= f is equivalent to f x
  • t >>= return is equivalent to t
  • (t >>= f) >>= g is equivalent to t >>= fun x -> f x >>= g
val join : 'a 'i 'j 'k 'p 'q. 'a t t -> 'a t

Combines nested t into just one layer. Equivalent to bind t ~f:Fn.id.

val ignore_m : 'a 'i 'j 'p 'q. 'a t -> unit t

Ignores contained values of t. Equivalent to map t ~f:ignore.

val all : 'a 'i 'p 'q. 'a t list -> 'a list t

Combines a list of t.

val all_unit : 'i 'p 'q. unit t list -> unit t

Combines a list of t whose contents are unimportant.

val (>>=) : 'a 'b 'i 'j 'k 'p 'q. 'a t -> ('a -> 'b t) -> 'b t

Infix bind.

val (>>|) : 'a 'b 'i 'j 'p 'q. 'a t -> ('a -> 'b) -> 'b t

Infix map.

module Monad_infix : sig ... end
module Let_syntax : sig ... end
val empty : unit -> 'a t
val is_empty : 'a t -> bool
val length : 'a t -> int
val decons : 'a t -> ('a * 'a t) option
val cons : 'a -> 'a t -> 'a t
val snoc : 'a t -> 'a -> 'a t
val append : 'a t -> 'a t -> 'a t
val map : 'a t -> f:('a -> 'b) -> 'b t
val concat : 'a t t -> 'a t
val nth : 'a t -> int -> 'a option
val concat_list : 'a list t -> 'a t
val find : f:('a -> bool) -> 'a t -> 'a option
val filter : f:('a -> bool) -> 'a t -> 'a t
val filter_opt : 'a option t -> 'a t
val filter_map : f:('a -> 'b option) -> 'a t -> 'b t
val fold_left : f:('a -> 'b -> 'a) -> init:'a -> 'b t -> 'a
val fold_right : f:('a -> 'b -> 'b) -> 'a t -> init:'b -> 'b
val foldr : 'a t -> f:('a -> 'b Core.Lazy.t -> 'b) -> init:'b -> 'b Core.Lazy.t
val iter : 'a t -> f:('a -> unit) -> unit
val of_iterator : curr:('a -> 'b option) -> next:('a -> 'a) -> init:'a -> 'b t
val build : f:('s -> ('a * 's) option) -> seed:'s -> 'a t
val unfold : f:('a -> 'a option) -> init:'a -> 'a t
val uniter : f:(unit -> 'a option) -> 'a t
val of_list : 'a list -> 'a t
val to_rev_list : 'a t -> 'a list
val to_list : 'a t -> 'a list
val of_array : 'a array -> 'a t
val to_array : 'a t -> 'a array
val cartesian_product : 'a t t -> 'a t t
val merge : cmp:('a -> 'a -> int) -> 'a t -> 'a t -> 'a t
val unify : cmp:('a -> 'b -> int) -> 'a t -> 'b t -> [ `Left of 'a | `Right of 'b | `Both of 'a * 'b ] t
val sort : cmp:('a -> 'a -> int) -> 'a t -> 'a t
val lazy_sort : cmp:('a -> 'a -> int) -> 'a t -> 'a t
module Of_container : sig ... end
module Iterator : sig ... end