Enables Python to be functionally chain-styled.
Project description
Enables Python to be functionally chain-styled.
Document
Simplified Chinese documents here.
If you are interested in me,you can follow my Blog([STRIKEOUT:一波软广2333])。
How to use?
install form pypi:
$ pip install fc
and you just import Fc,like this: from fc import Fc
then you can enjoy lambda like Kotlin/JS:
from fc import Fc
l = (
Fc([1, 2, 3, 4, 5])
.map(lambda x: x + 1)
.filter(lambda x: x > 4).print() # [5, 6]
.map(lambda x: x + 1).print() # [6, 7]
.cat([8, 9]).print() # [6, 7, 8, 9]
.add(10).print() # [6, 7, 8, 9, 10]
.catHead([1, 2, 3, 4, 5]).print() # [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
.limit(3)
.done()
)
assert l == [1, 2, 3]
You can check this this test file and understand more.
Have Fun ;)
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
fc-0.1.11.tar.gz
(6.7 kB
view details)
File details
Details for the file fc-0.1.11.tar.gz
.
File metadata
- Download URL: fc-0.1.11.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 351aa40c97201912694d6238e0959a600f06a1f934c5e725a508eada5dc44850 |
|
MD5 | 076f025fae25a5fd759fc25ceb8c6ec0 |
|
BLAKE2b-256 | 95a365371e777279e063ccc95a196d6ce1ead749bd446e6428aba13aad7b4fec |