https://github.com/aionescu/vec
Fast, safe mutable dynamic arrays for OCaml
https://github.com/aionescu/vec
collections ocaml polymorphic-variants vectors
Last synced: 7 months ago
JSON representation
Fast, safe mutable dynamic arrays for OCaml
- Host: GitHub
- URL: https://github.com/aionescu/vec
- Owner: aionescu
- License: gpl-3.0
- Created: 2020-03-29T06:29:01.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-01-18T22:36:55.000Z (over 1 year ago)
- Last Synced: 2024-11-14T16:45:04.879Z (8 months ago)
- Topics: collections, ocaml, polymorphic-variants, vectors
- Language: OCaml
- Homepage:
- Size: 669 KB
- Stars: 28
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-list - vec
README
# vec
[](https://opam.ocaml.org/packages/vec/)
Fast, safe mutable dynamic arrays for OCaml.
You can find API documentation [here](https://aionescu.github.io/vec/docs/vec/Vec/index.html).
## Summary
The idea behind this library is to provide efficient, mutable dynamic arrays with Rust-like mutability permissions.
To achieve this, the `Vec.t` type uses a polymorphic variant as a phantom type parameter, which is ``[`R | `W]`` for read-write vectors,
``[`R]`` for read-only vectors, or ``[`W]`` for write-only vectors.All functions defined in the `Vec` module are polymorphic in this type parameter, only requiring it to contain each function's needed capability.
For example, functions that only read data from a vector accept a ``('a, [> `R]) Vec.t`` parameter,
so both ``[`R]`` vectors and ``[`R | `W]`` vectors can be passed.## Installing
The package can be found on OPAM [here](https://opam.ocaml.org/packages/vec/).
To install it, run:
```sh
opam install vec
```## Building from source
To build the project and run the test suite, run the following in the root of the repository:
```sh
dune build @doc @runtest
```## License
This repository is licensed under the terms of the GNU General Public License v3.
For more details, see [the license file](LICENSE.txt).