package grenier

  1. Overview
  2. Docs
A collection of various algorithms in OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

grenier-v0.8.tbz
sha256=622a34f91f2787096f15786901b8d8cff528cada805b018fdbd522c00c6f13e8
sha512=e687e7c9e7b61d876c70570a9b6e4f3a497c8deb334e28532d8c2f9a2a06bff1330431b64ec3e8c4bcfcf2cc9495723339196608c6c4ac5a0699020d0af93e26

doc/grenier.orderme/Order_list/index.html

Module Order_list

Basic ordering operations

type t

An element of an ordering.

val root : unit -> t

Create a new ordering with a single element. O(1)

val after : t -> t

after t inserts a new element to the ordering, greater than t but less than all existing elements greater than t.

O(1) amortized.

val before : t -> t

before t inserts a new element to the ordering, less than t but greater than all existing elements less than t.

O(1) amortized.

val same_order : t -> t -> bool

Check if two elements belong to the same order. O(1)

val compare : t -> t -> int

Compare two elements. O(1)

val cardinal : t -> int

How many elements are ordered. O(1)

Memory management

val forget : t -> unit

Memory of every element is retained. When you know you are not going to use an element any longer, forget it to release memory. O(1).

val is_valid : t -> bool

After calling forget, an element should not be used. You can check if it is the case with is_valid.

val unsafe_next : t -> t
val unsafe_prev : t -> t
val unsafe_check : t -> string -> unit
OCaml

Innovation. Community. Security.