package containers

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

Module CCSimple_queueSource

Functional queues (fifo)

Simple implementation of functional queues

  • since 1.3
Sourcetype 'a sequence = ('a -> unit) -> unit
  • deprecated

    use 'a iter instead

Sourcetype 'a iter = ('a -> unit) -> unit

Fast internal iterator.

  • since 2.8
Sourcetype 'a printer = Format.formatter -> 'a -> unit
Sourcetype 'a klist = unit -> [ `Nil | `Cons of 'a * 'a klist ]
Sourcetype 'a gen = unit -> 'a option
Sourcetype +'a t

Queue containing elements of type 'a

Sourceval empty : 'a t
Sourceval is_empty : 'a t -> bool
Sourceval push : 'a -> 'a t -> 'a t

Push element at the end of the queue.

Sourceval snoc : 'a t -> 'a -> 'a t

Flip version of push.

Sourceval peek : 'a t -> 'a option

First element of the queue.

Sourceval peek_exn : 'a t -> 'a

Same as peek but

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

Get and remove the first element.

Sourceval pop_exn : 'a t -> 'a * 'a t

Same as pop, but fails on empty queues.

Sourceval junk : 'a t -> 'a t

Remove first element. If the queue is empty, do nothing.

Sourceval append : 'a t -> 'a t -> 'a t

Append two queues. Elements from the second one come after elements of the first one. Linear in the size of the second queue.

Sourceval map : ('a -> 'b) -> 'a t -> 'b t

Map values.

Sourceval rev : 'a t -> 'a t

Reverse the queue. Constant time.

Sourceval equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
Sourcemodule Infix : sig ... end
include module type of Infix
Sourceval (>|=) : 'a t -> ('a -> 'b) -> 'b t

Alias to map.

Sourceval (@) : 'a t -> 'a t -> 'a t

Alias to append.

Sourceval (<::) : 'a t -> 'a -> 'a t

Alias to snoc.

Sourceval length : 'a t -> int

Number of elements in the queue (linear in time).

Sourceval fold : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b
Sourceval iter : ('a -> unit) -> 'a t -> unit
Sourceval to_list : 'a t -> 'a list
Sourceval add_list : 'a t -> 'a list -> 'a t
Sourceval of_list : 'a list -> 'a t
Sourceval to_iter : 'a t -> 'a iter
Sourceval add_iter : 'a t -> 'a iter -> 'a t
Sourceval of_iter : 'a iter -> 'a t
Sourceval to_seq : 'a t -> 'a sequence
  • deprecated use to_iter
Sourceval add_seq : 'a t -> 'a sequence -> 'a t
  • deprecated use add_iter
Sourceval of_seq : 'a sequence -> 'a t
  • deprecated use of_iter
Sourceval to_std_seq : 'a t -> 'a Seq.t
Sourceval add_std_seq : 'a t -> 'a Seq.t -> 'a t
Sourceval of_std_seq : 'a Seq.t -> 'a t
Sourceval to_klist : 'a t -> 'a klist
  • deprecated use to_std_seq
Sourceval add_klist : 'a t -> 'a klist -> 'a t
  • deprecated use add_std_seq
Sourceval of_klist : 'a klist -> 'a t
  • deprecated use of_std_seq
Sourceval of_gen : 'a gen -> 'a t
Sourceval add_gen : 'a t -> 'a gen -> 'a t
Sourceval to_gen : 'a t -> 'a gen

IO

Sourceval pp : ?sep:unit printer -> 'a printer -> 'a t printer
OCaml

Innovation. Community. Security.