Logo

Programming-Idioms

History of Idiom 37 > diff from v19 to v20

Edit summary for version 20 by programming-idioms.org:
[Ruby] +DemoURL

Version 19

2016-08-23, 11:02:03

Version 20

2016-11-13, 23:10:20

Idiom #37 Currying

Technique of transforming a function that takes multiple arguments and returning a function for which some of the arguments are preset.

Idiom #37 Currying

Technique of transforming a function that takes multiple arguments and returning a function for which some of the arguments are preset.

Code
adder = -> a, b { a + b }
add_two = adder.curry.(2)
add_two.(5) # => 7
Code
adder = -> a, b { a + b }
add_two = adder.curry.(2)
add_two.(5) # => 7
Demo URL
https://repl.it/EWs6/0