Logo

Programming-Idioms

History of Idiom 37 > diff from v1 to v2

Edit summary for version 2 by :

Version 1

2015-05-06, 21:04:50

Version 2

2015-07-31, 20:08:41

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
sub curry {
   my ($func, $fixed_arg) = @_;
   return sub {
      $func->($fixed_arg, @_);
   }
}