package batteries
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=00f34b9aed4e47f314425b2ca9ceac206f112095a17ea9a7ffa6dac8cfccc492
md5=066051f9a210277710c54ad57c3b9568
doc/batteries.unthreaded/BatList/Exceptionless/index.html
Module BatList.Exceptionless
Exceptionless counterparts for error-raising operations
find p l returns Some x where x is the first element of l such as p x returns true or None if such an element has not been found.
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.
findi p 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.
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_argument n.
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 Error (`Invalid_argument(n)).
assoc a l returns Some b where b is the value associated with key b 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.
assoc_inv b l returns Some a where a is the key associated with value b in the list of pairs l. That is, assoc b [ ...; (a,b); ...] = Some a if (a,b) is the leftmost binding of a in list l. Return None if there is no key associated with b in the list l.
As assoc but with physical equality.
find_map f xs returns Some y such that x is the first element of the list where f x returns Some y. It returns None if no such element exists.
hd l returns Some x such that x is the first element of the given list l. Returns None if list l is empty.
tl l returns Some x such that x is the given list l without its first element. Returns None if list l is empty.