kachayev / fn.py

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

Currying #76

Open Comecacahuates opened 9 years ago

Comecacahuates commented 9 years ago

I tried this code for function currying

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

but when I call the function I get the following error

Traceback (most recent call last): File "", line 1, in File "fn/func.py", line 83, in _curried return curried(partial(func, _args, *_kwargs)) File "fn/func.py", line 69, in curried @wraps(func) File "/usr/lib/python2.7/functools.py", line 33, in update_wrapper setattr(wrapper, attr, getattr(wrapped, attr)) AttributeError: 'functools.partial' object has no attribute 'module'

cad106uk commented 9 years ago

Hello,

I have written a pull request dealing with this exact problem #75

However as you can see it has been sitting around for a while. I am not sure if this project is being actively maintain at the moment