package fix

  1. Overview
  2. Docs

The functor Make requires an implementation of maps for the type M.key and offers a two-phase numbering facility. The function encode is backed by a map, therefore runs in logarithmic time or constant time, depending on the type of map that is used. The function decode is backed by an array of size n, therefore runs in constant time.

Parameters

module M : sig ... end

Signature

type t = M.key

The type t of values of interest.

val encode : t -> int

encode maps a value of type t to a unique integer code. If applied twice to the same value, encode returns the same code; if applied to a value that has never been encountered, it returns a fresh code.

val current : unit -> int

current() returns the next available code, which is also the number of values that have been encoded so far.

val has_been_encoded : t -> bool

has_been_encoded x determines whether the value x has been encoded already.

module Done () : sig ... end

The functor Done ends the numbering process.

OCaml

Innovation. Community. Security.