Clojure inspired helper functions
Project description
Clojure inspired helper functions for Python
This is a small library with Clojure inspired helper functions. It uses only the standard library, without any external dependencies.
The goal is to implement replicas of the Clojure funcs that I admire.
Installation
With poetry (always recommended):
poetry add cloj
With pip:
pip install cloj
Implemented:
- take/drop
- take_while/drop_while
- some
- nth, first, second, third, fourth, fifth, forty_second, last
- get-in
Some examples:
from cloj import take, drop
take(3, [1, 2, 3, 4, 5])
>> [1, 2, 3]
drop(3, [1, 2, 3, 4, 5])
>> [4, 5]
drop (100, [1, 2, 3, 4, 5])
>> []
from cloj import first, second, third, fourth, fifth, forty_second, last
first([1, 2, 3])
>> 1
last([1, 2, 3])
>> 3
first([])
>> None
from cloj import get_in
sample = {"foo": {"bar": [0, {"spam": "target"}, 1]}}
get_in(sample, ["foo", "bar", 1, "spam"])
>>> "target"
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
cloj-0.2.0.tar.gz
(3.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
cloj-0.2.0-py3-none-any.whl
(3.2 kB
view details)
File details
Details for the file cloj-0.2.0.tar.gz.
File metadata
- Download URL: cloj-0.2.0.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.5 CPython/3.7.10 Linux/5.4.0-1040-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abe7d82d6c500e980197b3e4d0cbdc4fe0d11f7221b5513ea383cf98c2902be9
|
|
| MD5 |
189f6184c293bd5b95baae47cbabb768
|
|
| BLAKE2b-256 |
67f45ff25b52d172b3e8b40fc7a1995d6767b0ec15fc2ed365f66814452bdd58
|
File details
Details for the file cloj-0.2.0-py3-none-any.whl.
File metadata
- Download URL: cloj-0.2.0-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.5 CPython/3.7.10 Linux/5.4.0-1040-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
216ff9cd1747c2c43b946a548ca987b8c2aea8c85b0ffd3669cebc212c1f7649
|
|
| MD5 |
84413b65a985dad58de058f1fc223fdb
|
|
| BLAKE2b-256 |
7c949260bb2a1aead521086c29c752f0f40461a21d7e027b156c5036ef663f7b
|