package batteries
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=1bcb27dfbd130eb057561196ef851649
sha512=2a56611b09a5f1cba6457539f8b6bc87a5f2a5454b36cdb39f6e0d6a5dac6db179aab1ba87c74dd49cc41df31a9a96feb349028ea41df7371ecb47f4d9dfafc4
doc/batteries.unthreaded/BatLazyList/Exceptionless/index.html
Module BatLazyList.Exceptionless
Exceptionless counterparts for error-raising operations
val find : ('a -> bool) -> 'a t -> 'a optionfind 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.
val rfind : ('a -> bool) -> 'a t -> 'a optionrfind 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.
val findi : (int -> 'a -> bool) -> 'a t -> (int * 'a) optionfindi 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.
val rfindi : (int -> 'a -> bool) -> 'a t -> (int * 'a) optionrfindi 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.
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
val 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.
val assoc : 'a -> ('a * 'b) t -> 'b optionassoc 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.