Last update October 11, 2012

Doc Comments /


That's not Currying

Actually they call it "partial function application"

Currying is something else often mistaken for partial evaluation.

Currying is treating a function of N args that returns Ret

    func: (Arg1,Arg2,Arg3) -> Ret
as a function that does partial application of arguments "to the max"
    func: Arg1 -> (Arg2 -> (Arg3 -> Ret))
That's a
   function that takes an Arg1 and returns
    (a function that takes an Arg2 and returns
       (a function that takes an Arg3 and returns a Ret))

So the call func a b c is treated as (((func a) b ) c) with currying. In ML for instance, all functions are curried by default (but you can sort of override the behavior by declaring your function to take a tuple as a single argument). Python has a partial application library that was originally called 'curry' until the functional folks shot it down as a misnomer. Now it's called 'partial'. Python Partial Function Application

Tuples' expand property

After the section starting with "Tuples can be used as arguments to templates, and if so ...", you should mention, that tuples don't expand automatically to multiple function arguments, but their expand property can be used to effect this. Then show an example of this.


Corresponding page in the D Specification

FrontPage | News | TestPage | MessageBoard | Search | Contributors | Folders | Index | Help | Preferences | Edit

Edit text of this page (date of last change: October 11, 2012 4:38 (diff))