Logo

Programming-Idioms

History of Idiom 37 > diff from v9 to v10

Edit summary for version 10 by :

Version 9

2015-09-05, 11:16:52

Version 10

2015-09-05, 11:22:19

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
(curry range 1)
Code
(curry range 1)
Comments bubble
range(a,b) = [a..b]
(curry range 1) = _λ i ↦ [1..i]
Comments bubble
range(a,b) = [a..b]
(curry range 1) = _λ i ↦ [1..i]

Haskell begins with most functions already curried and allowing partial projection, hence the uncurried range sprang to mind as a notable exception for this illustration.
Doc URL
http://hackage.haskell.org/package/base/docs/Prelude.html#v:curry
Doc URL
http://hackage.haskell.org/package/base/docs/Prelude.html#v:curry