package containers

  1. Overview
  2. Docs
On This Page
  1. Imperative deque
Legend:
Library
Module
Module type
Parameter
Class
Class type

Imperative deque

type 'a t

Contains 'a elements, queue in both ways

exception Empty
val create : unit -> 'a t

New deque

val is_empty : 'a t -> bool

Is the deque empty?

val length : 'a t -> int

Number of elements (linear)

val push_front : 'a t -> 'a -> unit

Push value at the front

val push_back : 'a t -> 'a -> unit

Push value at the back

val peek_front : 'a t -> 'a

First value, or Empty

val peek_back : 'a t -> 'a

Last value, or Empty

val take_back : 'a t -> 'a

Take last value, or raise Empty

val take_front : 'a t -> 'a

Take first value, or raise Empty

val iter : ('a -> unit) -> 'a t -> unit

Iterate on elements

type 'a sequence = ('a -> unit) -> unit
val of_seq : ?deque:'a t -> 'a sequence -> 'a t
val to_seq : 'a t -> 'a sequence
val copy : 'a t -> 'a t

Fresh copy

OCaml

Innovation. Community. Security.