View on GitHub


Documenting everything about OCaml


Data Structures and Algorithms

Standard Library Data Structures

A major part of a standard library’s role is providing basic data structures and algorithms. All the standard libraries (Containers, Base, Core and Batteries) provide these.

Specialized Data Structures

  • OCamlGraph is a library for graphs and graph algorithms.
  • bimap: Bi-directional map, from key to value and value-to-key.
  • ods is an algorithm/data structure library, though it isn’t as fully-featured as the standard libraries.
  • Discrete Interval Encoding Trees: Useful for storing interval sets and testing membership efficiently.
  • Interval: An interval arithmetic library.
  • bitv: A bit-vector library.
  • psq: Functional priority search queues library.
  • bloomf: Fast Bloom filter library.

Heterogeneous Maps

  • Containers (a standard library) contains the CCHet data structure, which uses generative first-class modules on the inside to store values of different types.
  • hmap: Hmap is another variation of a heterogeneous map.
  • gmap: Allows for the creation of a heterogeneous map wrapped in a user-provided GADT. As opposed to the above solution, the full closed universe of possible types to be stored must be known by the user.