Clojure inspired helper functions
Project description
Clojure inspired helper functions
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 find useful. To keep it in the spirit of Clojure's immutability cloj functions make heavy use of copy.copy
to make sure that the copy is returned, and changing it will not modify the data in original data structures.
Implemented:
- take/drop
- some
- nth, first, second, third, fourth, fifth, forty_second, last
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
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.1.0.tar.gz
(1.7 kB
view hashes)
Built Distribution
cloj-0.1.0-py3-none-any.whl
(1.9 kB
view hashes)