module A: Direction_T
Operations on the left end of a deque.
val push : 'a -> 'a Cf_deque.t -> 'a Cf_deque.t
push x d
adds the element x
to the end of the deque d
. The
average cost is constant. Worst-case running time is O(log N), which
happens once in every N operations. Not tail-recursive.
val pop : 'a Cf_deque.t -> ('a * 'a Cf_deque.t) option
pop d
returns None
if d
is the empty deque, otherwise it returns
Some (x, d')
where x
is the element on the end of the deque, and
d'
is the remainder of d
with the element x
removed. The average
cost is constant. Worst-case running time is O(log N), which happens
once in every N operations. Not tail-recursive.
val head : 'a Cf_deque.t -> 'a
head d
returns the element at the end of the deque d
. Raises
Not_found
if the deque is empty. Not tail-recursive.
val tail : 'a Cf_deque.t -> 'a Cf_deque.t
tail d
is discards the element at the end of the deque d
. Raises
Not_found
if the deque is empty. Not tail-recursive.
val to_seq : 'a Cf_deque.t -> 'a Cf_seq.t
to_seq d
returns a lazily evaluated sequence of the elements in the
deque in the order they would appear by successive calls of pop d
.
val to_seq2 : 'a Cf_deque.t -> ('a * 'a Cf_deque.t) Cf_seq.t
to_seq2 d
returns a lazily evaluated sequence of the pairs (hd, tl)
obtained by successively calling of pop d
.