package sek

  1. Overview
  2. Docs

The submodule Stack is a replacement for OCaml's standard Stack module, where a stack is implemented as an ephemeral sequence. Elements are pushed and popped at the front end of the sequence.

type 'a t = 'a E.t
exception Empty
val create : 'a -> 'a t

create requires a default value. The functor SupplyDefault remedies this problem.

val push : 'a -> 'a t -> unit
val pop : 'a t -> 'a
val pop_opt : 'a t -> 'a option
val top : 'a t -> 'a
val top_opt : 'a t -> 'a option
val clear : 'a t -> unit
val copy : 'a t -> 'a t
val is_empty : 'a t -> bool
val length : 'a t -> int
val iter : ('a -> unit) -> 'a t -> unit
val fold : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a
val to_seq : 'a t -> 'a Stdlib.Seq.t
val add_seq : 'a t -> 'a Stdlib.Seq.t -> unit
val of_seq : 'a -> 'a Stdlib.Seq.t -> 'a t