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.1.tar.gz
(2.4 kB
view hashes)
Built Distribution
Close
Hashes for lazyRecursion-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf4b44a7bda03ddf7a23b1ef0f548bb63732d60c46a519df1427d550f2ca096f |
|
MD5 | fdfb9fe07e108b9fe4410ea518765f7b |
|
BLAKE2b-256 | 58f04a8d1e3bbbc463cb0d3c1efa82530b7abc3e05481c9fa6de8336b16f5f68 |