chimera: Lazy infinite streams with O(1) indexing
There are plenty of memoizing libraries on Hackage, but they usually fall into two categories:
Store cache as a flat array, enabling us to obtain cached values in O(1) time, which is nice. The drawback is that one must specify the size of the array beforehand, limiting an interval of inputs, and actually allocate it at once.
Store cache as a lazy binary tree. Thanks to laziness, one can freely use the full range of inputs. The drawback is that obtaining values from a tree takes logarithmic time and is unfriendly to CPU cache, which kinda defeats the purpose.
This package intends to tackle both issues,
providing a data type
lazy infinite compact streams with cache-friendly O(1) indexing.
Additional features include:
memoization of recursive functions and recurrent sequences,
memoization of functions of several, possibly signed arguments,
efficient memoization of boolean predicates.
[Skip to Readme]
|Versions [faq]||0.2.0.0, 0.3.0.0|
|Dependencies||base (>=4.9 && <5), vector [details]|
|Source repo||head: git clone https://github.com/Bodigrim/chimera|
|Uploaded||by Bodigrim at Tue Dec 31 01:20:01 UTC 2019|
|Downloads||487 total (94 in the last 30 days)|
|Rating||(no votes yet) [estimated by Bayesian average]|
Docs available [build log]
Last success reported on 2019-12-31 [all 1 reports]
For package maintainers and hackage trustees