June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
13
Task/Currying/Python/currying-4.py
Normal file
13
Task/Currying/Python/currying-4.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
>>> from toolz import curry
|
||||
>>> import operator
|
||||
>>> add = curry(operator.add)
|
||||
>>> add2 = add(2)
|
||||
>>> add2
|
||||
<built-in function add>
|
||||
>>> add2(7)
|
||||
9
|
||||
>>> # Toolz also has pre-curried versions of most HOFs from builtins, stdlib, and toolz
|
||||
>>>from toolz.curried import map
|
||||
>>> double = map(lambda x: x*2)
|
||||
>>> print(*double(range(5)))
|
||||
0 2 4 6 8
|
||||
Loading…
Add table
Add a link
Reference in a new issue