Logo

Programming-Idioms

History of Idiom 37 > diff from v16 to v17

Edit summary for version 17 by :
[D] indent

Version 16

2016-02-18, 17:22:43

Version 17

2016-03-21, 17:01:50

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.

Imports
import std.functional;
Imports
import std.functional;
Code
int add(int n1, int n2)
{
	return n1 + n2;
}

alias add5 = curry!(add, 5);
Code
int add(int n1, int n2)
{
    return n1 + n2;
}

alias add5 = curry!(add, 5);
Demo URL
http://dpaste.dzfl.pl/6cceb5d75a7c
Demo URL
http://dpaste.dzfl.pl/6cceb5d75a7c