https://github.com/aymanizz/exotic-functions
A python module for currying, partially applying, and composing functions in an exotic way.
https://github.com/aymanizz/exotic-functions
composing-functions currying declarative functional python python3
Last synced: 5 months ago
JSON representation
A python module for currying, partially applying, and composing functions in an exotic way.
- Host: GitHub
- URL: https://github.com/aymanizz/exotic-functions
- Owner: aymanizz
- License: unlicense
- Created: 2019-01-11T00:20:37.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-11T00:24:35.000Z (almost 7 years ago)
- Last Synced: 2025-02-17T12:45:26.354Z (8 months ago)
- Topics: composing-functions, currying, declarative, functional, python, python3
- Language: Python
- Homepage:
- Size: 1.95 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Exotic Function
A module for writing in a functional and/or declarative style, but in an exotic way!
You can curry, compose, and do other stuff with the help of the exotic functions.
## Quick Example
Here is an example:
```python
>>> exotic % print * 'output: ' | unpack << exotic % map * int @ str.split @ input * 'numbers: ' | apply
numbers: 1 2 3 4
output: 1 2 3 4
```which is equivalent to:
```python
>>> print('output: ', *(list(map(int, str.split(input('numbers: '))))))
```or in a more readable way:
```python
inp = input('numbers: ').split()
inp = map(int, inp)
print('output: ', *inp)
```more examples can be found in the module source file, `builder.py`.
## Testing
To test the module run:
```
$ python3 -m doctest -v builder.py
```