Skip to main content

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


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)

Uploaded Source

Built Distribution

lazyRecursion-0.1.1-py3-none-any.whl (8.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page