Logo

Programming-Idioms

History of Idiom 37 > diff from v36 to v37

Edit summary for version 37 by Debaran:
[Scala] Corrected explanation

Version 36

2019-02-02, 04:27:49

Version 37

2019-02-02, 05:02:25

Idiom #37 Currying

Transform a function that takes multiple arguments into a function for which some of the arguments are preset.

Idiom #37 Currying

Transform a function that takes multiple arguments into a function for which some of the arguments are preset.

Extra Keywords
curry
Extra Keywords
curry
Code
def add(x: Int, y: Int) = x + y
def add5(n: Int) = add(5, n)
Code
def add(x: Int, y: Int) = x + y
def add5(n: Int) = add(5, n)
Comments bubble
With only single parameter list
Comments bubble
With only single parameter list (technically not currying)