package baby

  1. Overview
  2. Docs
Fast sets based on balanced binary search trees

Install

dune-project
 Dependency

Authors

Maintainers

Sources

20241204.tar.gz
md5=2f74310d5ed0396592c92982a9181f17
sha512=927eab8e31f05427b54732b80fe81431606a720979dbc6a67ed1bf42e3581a6d76580440bee0835fac8342e8b1407f685ee5ca6d1f78b5e0e576344525f4e525

doc/baby/Baby/W/Set/Make/argument-1-E/index.html

Parameter Make.E

type t

The type of the set elements.

val compare : t -> t -> int

The function compare decides a relation \leq over elements of type t.

The relation \leq must be a total preorder: that is,

  1. for all elements x, y, it must be the case that x \leq y or y \leq x holds.
  2. for all elements x, y, z, it must be the case that x \leq y and y \leq z imply x \leq z;

Let us write x \equiv y when x \leq y and y \leq x hold. In that case, we say that x and y are equivalent.

Let us write x < y when x \leq y and \neg (y \leq x) hold.

compare must behave as follows:

  1. if x \equiv y holds then compare x y must be zero;
  2. if x < y holds then compare x y must be negative;
  3. if y < x holds then compare x y must be positive.

If equivalence implies equality (that is, if for all elements x, y, x \equiv y implies x = y) then we say that the relation \leq is a total order.

OCaml

Innovation. Community. Security.