Welcome to @rimbu/multiset
! A Rimbu MultiSet is a powerful Set-like structure where each unique element can be added multiple times. It keeps track of the number of occurrences of each element, making it ideal for scenarios where element frequency matters.
- Multiple Occurrences: Each element can occur one or more times.
- Frequency Tracking: Efficiently keeps track of how many times each element was added.
- Flexible Implementations: Choose between hashed and sorted implementations based on your needs.
Name | Description |
---|---|
HashMultiSet<T> |
A MultiSet with hashed elements of type T . |
MultiSet<T> |
A generic MultiSet with elements of type T . |
SortedMultiSet<T> |
A MultiSet with sorted elements of type T . |
VariantMultiSet<T> |
A type-variant MultiSet with elements of type T . |
For complete documentation, please visit the MultiSet page in the Rimbu Docs, or directly explore the Rimbu MultiSet API Docs.
Experience @rimbu/multiset
in action! Try Out Rimbu on CodeSandBox.
Yarn:
yarn add @rimbu/multiset
npm:
npm install @rimbu/multiset
Bun:
bun add @rimbu/multiset
Create or edit import_map.json
in your project root:
{
"imports": {
"@rimbu/": "https://deno.land/x/rimbu@x.y.z/"
}
}
Replace x.y.z
with the desired version.
In this way you can use relative imports from Rimbu in your code, like so:
import { List } from '@rimbu/core/mod.ts';
import { HashMap } from '@rimbu/hashed/mod.ts';
Note that for sub-packages, due to conversion limitations it is needed to import the index.ts
instead of mod.ts
, like so:
import { HashMap } from '@rimbu/hashed/map/index.ts';
To run your script (let's assume the entry point is in src/main.ts
):
deno run --import-map import_map.json src/main.ts
import { SortedMultiSet } from '@rimbu/multiset';
console.log(SortedMultiSet.of(1, 3, 2, 3, 2, 3).toString());
Created and maintained by Arvid Nicolaas.
We welcome contributions! Please read our Contributing guide.
Made with contributors-img.
This project is licensed under the MIT License. See the LICENSE for details.