🥘 Curry fp
Functional currying for Python.
Simple ⬦ Clear ⬦ Concise

Background
Currying is a technique targeting strategic code composition, breaking apart a function into a series of functions, allowing arguments to be applied piece-by-piece until all parameters are fulfilled.
Usage
Curry fp is a powerful tool that can be used as a decorator on Callable objects for the purpose of currying.
Features
- Allows for 1 or more arguments to be passed to the curried function at a time, including all at once.
- Default values can be specified using
... (Ellipsis)
as an argument, at any point.
- Keyword arguments can be used, allowing for arguments to be passed in whenever available.
Example
from curry_fp import curry
@curry
def sum_all(a: int, b: int=2, c: int=3) -> int:
return a + b + c
Without using default values
sum_all(1)(2)(3)
>>> 6
Using default values
sum_all(1)(...)
>>> 6
All arguments at once
sum_all(1, 2, 3)
>>> 6
All arguments at once (with defaults)
sum_all(1, 2, ...)
>>> 6
Using keyword arguments in any order
sum_all(b=2)(c=3)(a=1)
>>> 6
See test/test_curry.py
for more examples. ✨