package containers-data

  1. Overview
  2. Docs
A set of advanced datatypes for containers

Install

Dune Dependency

Authors

Maintainers

Sources

v3.9.tar.gz
md5=c54431781906065ead3a089883f94726
sha512=8c954cb5ff01dc73a4e04ce2ef8fb5ad5162f16b2e4b2463501dd60c428d388c03c5b641c62b5876cd0d5ac5dc244d6a44d4d92a18525a03bdbf9cca82321272

doc/containers-data/CCLazy_list/index.html

Module CCLazy_listSource

Lazy List

  • since 0.17
Sourcetype +'a t = 'a node lazy_t
Sourceand +'a node =
  1. | Nil
  2. | Cons of 'a * 'a t
Sourceval empty : 'a t

Empty list.

Sourceval return : 'a -> 'a t

Return a computed value.

Sourceval is_empty : _ t -> bool

Evaluate the head.

Sourceval length : _ t -> int

length l returns the number of elements in l, eagerly (linear time). Caution, will not terminate if l is infinite.

Sourceval cons : 'a -> 'a t -> 'a t
Sourceval head : 'a t -> ('a * 'a t) option

Evaluate head, return it, or None if the list is empty.

Sourceval map : f:('a -> 'b) -> 'a t -> 'b t

Lazy map.

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

Filter values.

  • since 0.18
Sourceval take : int -> 'a t -> 'a t

Take at most n values.

  • since 0.18
Sourceval append : 'a t -> 'a t -> 'a t

Lazy concatenation.

Sourceval flat_map : f:('a -> 'b t) -> 'a t -> 'b t

Monadic flatten + map.

Sourceval default : default:'a t -> 'a t -> 'a t

Choice operator.

  • since 2.1
Sourcemodule Infix : sig ... end
include module type of Infix
Sourceval (>|=) : 'a t -> ('a -> 'b) -> 'b t
Sourceval (>>=) : 'a t -> ('a -> 'b t) -> 'b t
Sourceval (<|>) : 'a t -> 'a t -> 'a t

Alias to default.

  • since 2.1
Sourcetype 'a gen = unit -> 'a option
Sourceval of_gen : 'a gen -> 'a t
Sourceval of_list : 'a list -> 'a t
Sourceval to_list : 'a t -> 'a list
Sourceval to_list_rev : 'a t -> 'a list
Sourceval to_gen : 'a t -> 'a gen
OCaml

Innovation. Community. Security.