Haskell-like intervals for Python
Project description
lange
Lazy lists (i.e. Haskell-like ranges) for Python.
Features
- Stable floating-point range generation, e.g.:
0.8 - 0.6 == 0.2
up to 28 digits (customizable). - Infinite
[1 2 ...]
or bounded. - O(1) access/evaluation
lst[3443]
Examples
Arithmetic Progression
# "Forbidden" syntax.
import lange
print(-[0.6, 0.8, ..., 2])
# [0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0]
# Conservative syntax.
from lange_ import a_
print(a_[0.6, 0.8, ..., 2])
# [0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0]
pr = a_[0.6, 0.8, ...]
print(pr[:5])
# [0.6 0.8 1.0 1.2 1.4]
Geometric Progression
# "Forbidden" syntax.
import lange
print(~[0.4, 0.8, ..., 2])
# [0.4 0.8 1.6]
# Conservative syntax.
from lange_ import g_
print(g_[0.4, 0.8, ..., 2])
# [0.4 0.8 1.6]
pr = g_[0.4, 0.8, ...]
print(pr[:5])
# [0.4 0.8 1.6 3.2 6.4]
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
lange-0.2101.21.tar.gz
(5.9 kB
view details)
Built Distribution
lange-0.2101.21-py3-none-any.whl
(19.2 kB
view details)
File details
Details for the file lange-0.2101.21.tar.gz
.
File metadata
- Download URL: lange-0.2101.21.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11977038dde530cfe1170eee2c5d6c87036e8f59aeea958f13a508b6a000ed4b |
|
MD5 | 831b7185515b5ea53a4e1d55b1d507ca |
|
BLAKE2b-256 | fd7c35e5a2eb8955a1add35b6ddd18964d87d60bb1163b96d7c7120e42baf92a |
File details
Details for the file lange-0.2101.21-py3-none-any.whl
.
File metadata
- Download URL: lange-0.2101.21-py3-none-any.whl
- Upload date:
- Size: 19.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9baf42e3eb193c7d0974b9c1a83fc3a5729a11ef1ab0cd0142b14c4fe502e511 |
|
MD5 | 4756d1fc6f7e0b0bbed858312d76246f |
|
BLAKE2b-256 | ca116a457537d2288b1c5de85a2a771a8b115d785f3e87ee9f2ba97cf495d195 |