val empty : 'a t
val is_empty : 'a t ‑> bool
val singleton : 'a ‑> 'a t
val doubleton : 'a ‑> 'a ‑> 'a t
Same as take_front, but fails on empty queues.
take_front_l n q
takes at most n
elements from the front
of q
, and returns them wrapped in a list.
Same as take_back, but fails on empty queues.
take_back_l n q
removes and returns the last n
elements of q
. The
elements are in the order of the queue, that is, the head of the returned
list is the first element to appear via take_front.
take_back_l 2 (of_list [1;2;3;4]) = of_list [1;2], [3;4]
.
val last_exn : 'a t ‑> 'a
Append two queues. Elements from the second one come after elements of the first one. Linear in the size of the second queue.
val fold : ('b ‑> 'a ‑> 'b) ‑> 'b ‑> 'a t ‑> 'b
val iter : ('a ‑> unit) ‑> 'a t ‑> unit
val of_list : 'a list ‑> 'a t
val to_list : 'a t ‑> 'a list
val (--^) : int ‑> int ‑> int t
a -- b
is the integer range from a
to b
, where b
is excluded.