Package Exports
- @rimbu/multiset
- @rimbu/multiset/custom
Readme
@rimbu/multiset
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.
Key Features:
- 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.
Exported Types:
| 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. |
Documentation
For complete documentation, please visit the MultiSet page in the Rimbu Docs, or directly explore the Rimbu MultiSet API Docs.
Try It Out
Experience @rimbu/multiset in action! Try Out Rimbu on CodeSandBox.
Installation
Compabitity
Package Managers
Yarn:
yarn add @rimbu/multisetnpm:
npm install @rimbu/multisetBun:
bun add @rimbu/multisetDeno Setup
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
Usage
import { SortedMultiSet } from '@rimbu/multiset';
console.log(SortedMultiSet.of(1, 3, 2, 3, 2, 3).toString());Author
Created and maintained by Arvid Nicolaas.
Contributing
We welcome contributions! Please read our Contributing guide.
Contributors
Made with contributors-img.
License
This project is licensed under the MIT License. See the LICENSE for details.