package bimap

  1. Overview
  2. Docs
An OCaml library implementing bi-directional maps and multi-maps

Install

Dune Dependency

Authors

Maintainers

Sources

20201231.tar.gz
md5=f6d279ec651aefd03ece86f4d0a7ed27
sha512=bf21e5bfbc26bba3835ac65eaa5fb261359aba030d2d7c50794b9e0f87a491b04999dd0053a9ffb3e9a551eabfb212dc7cde4384fb27b553c5044296806c0f3f

Description

Bi-directional maps permit clients to not only obtain a value provided a key, but to obtain a key provided a value

Published: 01 Jan 2021

README

README

Bimaps allow clients to find not just a value given a key, but to find a
key given a value. Inspired by com.google.guava.bimap. Implemented
here using functors and two maps in two ways: as a class and as a module.
Also supports multi-bi-map, in which a key is mapped to multiple values
as in a multi-map and the inverse view is supported as well under which
any one of the values will provide the key.

Each method ensures us that both maps are updated properly, alleviating
the user or client code from performing the correct operations on both
maps when interacting with either one of them.

See the unit test under src/test for examples of usage.

                            Single values Map     v   Multi-map 
Implemented as a module | Bimap_single_module.ml  | Bimap_multi_module.ml
 Implemented as a class | Bimap_single_class.ml   | Bimap_multi_class.ml

Dependencies (3)

  1. dune >= "2.0"
  2. core >= "v0.11.3" & < "v0.15"
  3. ocaml >= "4.06.0"

Dev Dependencies (1)

  1. ounit with-test & >= "2.2.2"

Used by

None

Conflicts

None