package batteries
Install
Dune Dependency
Authors
Maintainers
Sources
md5=ea26b5c72e6731e59d856626049cca4d
sha512=55975b62c26f6db77433a3ac31f97af609fc6789bb62ac38b267249c78fd44ff37fe81901f1cf560857b9493a6046dd37b0d1c0234c66bd59e52843aac3ce6cb
doc/batteries.unthreaded/BatRefList/index.html
Module BatRefList
Source
Reference on lists.
RefList is a extended set of functions that manipulate list references.
The type of an empty ref list
Creates a ref list from an enumeration, going from last to first
Returns an enumeration of current elements in the ref list, going from last to first
Adds an element in a sorted list, using the given comparator.
Returns the last element - O(n) or raises Empty_list
if the ref list is empty
Removes and returns the first element or raises Empty_list
if the ref list is empty
Removes and returns the n first elements or raises Empty_list
if the ref list does not contain enough elements
Returns a ref list containing the same elements but without the first one or raises Empty_list
if the ref list is empty
Functional Operations
List.fold_left f a (ref [b0; b1; ...; bn])
is f (... (f (f a b0) b1) ...) bn
.
List.fold_right f (ref [a0; a1; ...; an]) b
is f a0 (f a1 (... (f an b) ...))
. Tail-recursive.
Apply the given function to all elements of the ref list, in respect with the order of the list
Find the first element matching the specified predicate raise Not_found
if no element is found
Find the first element in the reversed ref list matching the specified predicate raise Not_found
if no element is found
Same as find but takes an exception to be raised when no element is found as additional parameter.
Return true
if an element matches the specified predicate
Return true
if all elements match the specified predicate
Apply a function to all elements and return the ref list constructed with the function returned values
transform all elements in the ref list using a function.
Apply a function to all elements and return the list constructed with the function returned values
Remove all elements that do not match the specified predicate
Remove an element from the ref list raise Not_found
if the element is not found
Remove the first element matching the specified predicate raise Not_found
if no element has been removed
Remove all elements equal to the specified element from the ref list