kachayev / fn.py

Functional programming in Python: implementation of missing features to enjoy FP
Other
3.35k stars 204 forks source link

Add currrying decorator. #50

Closed aitjcize closed 10 years ago

aitjcize commented 10 years ago

Add curried decorator, the function is called as soon as the arguments are all given:

>>> from fn.func import curried
>>> @curried
... def sum5(a, b, c, d, e):
...     return a + b + c + d + e
...
>>> sum5(1)(2)(3)(4)(5)
15
>>> sum5(1, 2, 3)(4, 5)
15
kachayev commented 10 years ago

Cool! I'll update your code with decorator wrapper to deal with origin docs etc.