package containers
Install
Dune Dependency
Authors
Maintainers
Sources
md5=03b80e963186e91ddac62ef645bf7fb2
sha512=c8f434808be540c16926bf03d89f394d33fc2d092f963a7b6d412481229e0a96290f1ad7c7d522415115d35426b7aa0b3fda4b991ddc321dad279d402c9a0c0b
doc/containers.data/CCDeque/index.html
Module CCDeque
Source
Imperative deque
This structure provides fast access to its front and back elements, with O(1) operations.
Contains 'a elements, queue in both ways
equal a b
checks whether a
and b
contain the same sequence of elements.
compare a b
compares lexicographically a
and b
.
Update last value. If the deque is empty do nothing. If the function returns None
, remove last element; if it returns Some x
, replace last element with x
.
Update first value. If the deque is empty do nothing. Similar to update_back
but for the first value.
append_front ~into q
adds all elements of q
at the front of into
. O(length q)
in time.
append_back ~into q
adds all elements of q
at the back of into
. O(length q)
in time.
Conversions
Create a deque from the sequence. Optional argument deque
disappears, use add_seq_back
instead.
add_seq_front q seq
adds elements of seq
into the front of q
, in reverse order. O(n)
in time, where n
is the number of elements to add.
add_seq_back q seq
adds elements of seq
into the back of q
, in order. O(n)
in time, where n
is the number of elements to add.
List of elements, in order. Less efficient than to_rev_list
.
Keep only elements that satisfy the predicate.