package orsetto

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Binary search algorithm and data structures.

Overview

This module implements generalized binary search functions along with a functorial interface that generalizes static sets and maps implemented as vectors in multiplicative binary search order. A specialization is provided for character sets and maps implemented with strings as the vector.

Types
type 'i cmp =
  1. | Cmp of 'i -> int

A comparator function for use with the search function (see below).

type ('i, 'r) ret =
  1. | Ret of {
    1. none : unit -> 'r;
    2. some : 'i -> 'r;
    }

A return finalization configuration for use with the search function (see below).

module type Basis = sig ... end

Use module B: Basis = struct ... end to define a type t and associated functions that provide the operations on it required for binary searching in the range between two values of type t.

module Char_basis : Basis with type t = char

The distinguished basis for OCaml char values.

module Int_basis : Basis with type t = int

The distinguished basis for OCaml int values.

module Float_basis : Basis with type t = float

The distinguished basis for OCaml float values.

module type Profile = sig ... end

The signature of the module returned by the Create(B) functor.

General Interface
module Create (B : Basis) : Profile with type t := B.t

Use Create(B) to make a module that provides binary searches using the index type defined with the basis B.

module Char : Profile with type t := char

The profile of binary searches with char type index.

module Int : Profile with type t := int

The profile of binary searches with int type index.

module Float : Profile with type t := float

The profile of binary searches with float type index.

OCaml

Innovation. Community. Security.