lazy RecursiveSequence with optional caching
Project description
lazyRecursion
Usage Example:
>>> from lazyRecursion import RecursiveSequence
>>>
>>> fibonacci = RecursiveSequence(
... induction_start={0: 1, 1:1},
... relative_indices=[-2,-1],
... recursion_function=lambda x1,x2: x1+x2,
... cache_file='fib_cache.json' # (optional) deactivates caching if missing
... )
>>> fibonacci[:10]
[1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
>>> linear = RecursiveSequence(
... induction_start={0:0},
... relative_indices=[-1],
... recursion_function=lambda x: x+5,
... )
>>> linear[:5]
[0, 5, 10, 15, 20]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
lazyRecursion-0.1.tar.gz
(2.3 kB
view hashes)
Built Distribution
Close
Hashes for lazyRecursion-0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5f13e1c00212ef971fac4bf2ae70012d1f464374b87982fc6dc75c08c3a936f |
|
MD5 | 1d527db7c7178cb19005fcff3dc7e376 |
|
BLAKE2b-256 | cd26efd26afa61e1b9a45cbefcc43eeff115f0f32b5b31dc6fa1b54295912cfa |