curryer

Release v0.1.0.

curryer is a library providing a decorator so all of your python callables can be curried.

Example

Let’s curry some functions:

from curryer import curry

@curry
def add(a, b):
    return a + b

add1 = add(1)
assert add1.curried is True
assert add1(2) == 3

@curry
def variadic(*args, **kwargs):
    return (args, kwargs)

three_var = variadic('one', 'two', 'three')
assert three_var.curried is True
assert three_var() == (('one', 'two', 'three'), {})

six_var = three_var(one='one', two='two', three='three')
assert six_var.curried is True
assert six_var() == (
    ('one', 'two', 'three'),
    {'one': 'one', 'two': 'two', 'three': 'three'}
    )
Read the Docs v: latest
Versions
latest
Downloads
PDF
HTML
Epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.