Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/msabramo/python-composed
Compose functions in Python
https://github.com/msabramo/python-composed
Last synced: about 1 month ago
JSON representation
Compose functions in Python
- Host: GitHub
- URL: https://github.com/msabramo/python-composed
- Owner: msabramo
- Created: 2012-09-30T22:52:58.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2012-10-01T17:12:35.000Z (over 12 years ago)
- Last Synced: 2024-05-09T20:39:36.019Z (8 months ago)
- Language: Python
- Size: 113 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
python-composed
=======================================.. image:: https://secure.travis-ci.org/msabramo/python-composed.png
:target: http://travis-ci.org/msabramo/python-composedPython functional composition
Example usage
-------------.. code:: python
# composed_example.py
from function_composition import compose
def plus_2(x):
return x + 2def times_3(x):
return 3 * xprint(compose(times_3, plus_2)(1))
print(compose(times_3, plus_2)(2))
print(compose(times_3, plus_2)(3))
print(map(compose(times_3, plus_2), [1, 2, 3]))$ python composed_example.py
9
12
15
[9, 12, 15]