package mset
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=25331ce4aef92d04a9bbdc18aec7a545
sha512=083e58170f5ec786e2e33894e0b92a91da754b7f1a7e3ed75c66d24e06747e653e77df31dc53a4720c79ddf4e23a6815373d75024e2c3ca369449792fe2bae58
Description
Implements small multisets using bitmaps.
Published: 02 Feb 2026
README
mset: an OCaml library for small multisets
This module implements a persistent data structure for multisets using bitmaps, for multisets small enough to fit in a single machine integer.
The universe (i.e. the elements that can be stored in the multiset and, for each, its maximal multiplicity) has to be provided upfront.
Example
For instance,
module MS = (val chars ['a',12; 'b',42; 'c',27])provides you with a module MS that implements multisets containing at most 12 occurrences of the element 'a', at most 42 occurrences of the element 'b', and at most 27 occurrences of the element 'c'.
Internally, the data type MS.t is implemented as a bitset of type int, yet behind an abstract data type. The API is defensive: functions over multisets fail if they are given elements not belonging to the universe (i.e. a character other than 'a', 'b', and 'c'), or if the capacity of an element is exceeded.
Elements are not limited to characters. A functor allows you to build multisets for any type of elements.
Documentation
For more details, have a look at the documentation.