small playground library for fp in python
Project description
boxcat
A small playground library for fp in Python, inspired from my time writing Scala
Development testing
pytest
Usage
To wrap values in Option monad
.map()
Integer example
option_ten = Option(10)
option_multiply_by_two = option_ten.map(lambda x: x * 2)
print(option_multiply_by_two.get_or_else(0))
result:
20
String example
option_hello_world = Option("hello world")
option_uppercase = option_hello_world.map(lambda s: s.upper())
option_uppercase.get_or_else("")
print(option_uppercase.get_or_else(""))
result:
HELLO WORLD
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
boxcat-0.0.3.tar.gz
(4.6 kB
view details)
Built Distribution
File details
Details for the file boxcat-0.0.3.tar.gz
.
File metadata
- Download URL: boxcat-0.0.3.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 408456ba7ea744a2b0bceaa0e42c766edaa4859f1992429c3618c6ddb63d1263 |
|
MD5 | b113997467a8ab9d5e7a0ef00218a566 |
|
BLAKE2b-256 | cf4747f7e93a32dd5e478418dfa3d646b396995d2e414a76d81ecff37cfc51cc |
File details
Details for the file boxcat-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: boxcat-0.0.3-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/41.4.0 requests-toolbelt/1.0.0 tqdm/4.64.1 CPython/2.7.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c3eb3d6105e126c6b5e2a5702ab6c9b32c66625113874f652a2079613926204 |
|
MD5 | bb46822bd4adf0d85d95c69118c2505f |
|
BLAKE2b-256 | 938d780b3d7d860f2aa705d19aaf8b5c885ce1d1ff3a8b3b4162d4034735ace8 |