Linked_queue is a wrapper around OCaml's standard Queue module that follows Core idioms and adds some functions.
Differences from the standard module:
enqueue
replaces push
, add
, and takes the queue first.
dequeue
replaces pop
, take
, takes the queue first, and returns an
option rather than raising Empty
.
dequeue_exn
is available if you want to raise Empty
.
iter
takes a labeled argument.
transfer
's arguments are labeled.
dequeue t
returns None
if t
is empty, otherwise it removes and returns
the front of t
peek t
returns None
if t
is empty, otherwise it returns Some x
where
x
is the front of t
.
filter_inplace t ~f
removes all elements of t
that don't satisfy f
.
of_list list
returns a queue t
with the elements of list
in the same
order as the elements of list
(i.e. the first element of t
is the first
element of the list).