Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Compose functions in Python
Python
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
.travis.yml
README.rst
function_composition.py
setup.py
tests.py
tox.ini

README.rst

python-composed

https://secure.travis-ci.org/msabramo/python-composed.png

Python functional composition

Example usage

# composed_example.py

from function_composition import compose

def plus_2(x):
    return x + 2

def times_3(x):
    return 3 * x

print(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]
Something went wrong with that request. Please try again.