circular: Circular fixed-sized mutable vectors

[ bsd3, data-structures, library, math ] [ Propose Tags ] [ Report a vulnerability ]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0, 0.1.1, 0.2.0, 0.3.0, 0.3.1, 0.3.1.1, 0.4.0.0, 0.4.0.1, 0.4.0.2, 0.4.0.3
Change log ChangeLog.md
Dependencies aeson, base (>=4.7 && <5), primitive, vector [details]
License BSD-3-Clause
Copyright 2021 Dominik Schrempf
Author Dominik Schrempf
Maintainer dominik.schrempf@gmail.com
Category Math, Data Structures
Home page https://github.com/dschrempf/circular#readme
Bug tracker https://github.com/dschrempf/circular/issues
Source repo head: git clone https://github.com/dschrempf/circular
Uploaded by dschrempf at 2022-07-10T08:35:13Z
Distributions LTSHaskell:0.4.0.3, NixOS:0.4.0.3, Stackage:0.4.0.3
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 1718 total (22 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2022-07-10 [all 1 reports]

Readme for circular-0.4.0.3

[back to package description]

Circular

Circular stacks of fixed size.

Circular stacks are just normal vectors with a pointer to the last element.

Circular stacks may not be what you need because:

  • You need all values at a later time anyways.
  • You don't want a monadic work flow, because circular stacks use mutable vectors.

Circular stacks are useful to you because:

  • They have a fixed size and consequently have constant memory usage. Constant memory usage is important if values are gathered continuously but only a specific number of values is needed at a later time.
  • They are fast, especially when summary statistics need to be computed across the stack.

Elements pushed on a circular stack replace the oldest (deepest) elements on the stack. QuickCheck and unit tests with HSpec give promising results — have a look yourself.

I use circular stacks, for example, as the data type for traces of Markov chains. In this case, lists cannot be used reliably, because the space requirement increases linearly with the chain length.

Circular is actively developed and functions may be removed, renamed, or changed. Ideas are welcome!