package orsetto

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Operations on the left end of a deque.

val push : 'a -> 'a t -> 'a 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.

val pop : 'a t -> ('a * 'a t) option

pop q returns None if q is the empty deque, otherwise it returns Some (x, d') where x is the element on the end of the deque, and q' is the remainder of q 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.

val head : 'a t -> 'a

head q returns the element at the end of the deque q. Raises Not_found if the deque is empty.

val tail : 'a t -> 'a t

tail q is discards the element at the end of the deque q. Raises Not_found if the deque is empty.

val of_seq : 'a Seq.t -> 'a t

Use of_seq s to make a deque by consuming all the elements in the sequence s. The head of the deque is the first element consumed and the tail is the final element consumed.

val to_seq : 'a t -> 'a Seq.t

to_seq q returns a sequence that produces the elements of the deque in order from head to tail by making successive calls to pop q.