package batteries

  1. Overview
  2. Docs
A community-maintained standard library extension

Install

Dune Dependency

Authors

Maintainers

Sources

v3.9.0.tar.gz
md5=ea26b5c72e6731e59d856626049cca4d
sha512=55975b62c26f6db77433a3ac31f97af609fc6789bb62ac38b267249c78fd44ff37fe81901f1cf560857b9493a6046dd37b0d1c0234c66bd59e52843aac3ce6cb

doc/batteries.unthreaded/BatLazyList/Exceptionless/index.html

Module BatLazyList.ExceptionlessSource

Exceptionless counterparts for error-raising operations

Sourceval find : ('a -> bool) -> 'a t -> 'a option

find p l returns Some x where x is the first element of l such that p x returns true or None if such element as not been found.

Sourceval rfind : ('a -> bool) -> 'a t -> 'a option

rfind p l returns Some x where x is the last element of l such that p x returns true or None if such element as not been found.

Sourceval findi : (int -> 'a -> bool) -> 'a t -> (int * 'a) option

findi p e l returns Some (i, ai) where ai and i are respectively the first element of l and its index, such that p i ai is true, or None if no such element has been found.

Sourceval rfindi : (int -> 'a -> bool) -> 'a t -> (int * 'a) option

rfindi p e l returns Some (i, ai) where ai and i are respectively the last element of l and its index, such that p i ai is true, or None if no such element has been found.

Sourceval split_at : int -> 'a t -> [ `Ok of 'a t * 'a t | `Invalid_index of int ]

Whenever n is inside of l size bounds, split_at n l returns `Ok (l1,l2), where l1 contains the first n elements of l and l2 contains the others. Otherwise, returns `Invalid_index n

Sourceval at : 'a t -> int -> [ `Ok of 'a | `Invalid_index of int ]

If n is inside the bounds of l, at l n returns `Ok x, where x is the n-th element of the list l. Otherwise, returns `Invalid_index n.

Sourceval assoc : 'a -> ('a * 'b) t -> 'b option

assoc a l returns Some b where b is the value associated with key a in the list of pairs l. That is, assoc a [ ...; (a,b); ...] = Some b if (a,b) is the leftmost binding of a in list l. Return None if there is no value associated with a in the list l.

Sourceval assq : 'a -> ('a * 'b) t -> 'b option

As assoc but with physical equality

OCaml

Innovation. Community. Security.