package kcas_data

  1. Overview
  2. Docs

Module Stack.TxSource

Transactions on stacks.

Sourceval is_empty : 'a t -> bool Kcas.Tx.t

is_empty s determines whether the stack s is empty.

Sourceval length : 'a t -> int Kcas.Tx.t

length s returns the length of the stack s.

Sourceval clear : 'a t -> unit Kcas.Tx.t

clear s removes all elements from the stack s.

Sourceval swap : 'a t -> 'a t -> unit Kcas.Tx.t

swap s1 s2 exchanges the contents of the stacks s1 and s2.

Sourceval to_seq : 'a t -> 'a Seq.t Kcas.Tx.t

to_seq s returns a domain safe sequence for iterating through the elements of the stack top to bottom.

The sequence is based on a constant time, O(1), snapshot of the stack and modifications of the stack have no effect on the sequence.

Sourceval push : 'a -> 'a t -> unit Kcas.Tx.t

push x s adds the element x to the top of the stack s.

Sourceval pop_opt : 'a t -> 'a option Kcas.Tx.t

pop_opt s removes and returns the topmost element of the stack s, or None if the stack is empty.

Sourceval top_opt : 'a t -> 'a option Kcas.Tx.t

top_opt s returns the topmost element in stack s, or None if the stack is empty.

OCaml

Innovation. Community. Security.