Skip to content
Prev 40132 / 63424 Next

Curry: proposed new functional programming, er, function.

Hi,
On 5 May 2011 02:56, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
In this particular case I don't think it is. The reason I proposed it
yesterday for the cubature example was that in some cases it can make
the code more concise and clearer in my opinion. This is the case when
you override a considerable number of arguments in a function.

Consider this,

read.table2 = Curry(read.table, header = TRUE, na.strings = "9999",
    colClasses = "numeric", nrows = 23)

vs

read.table2 = function(..., header = TRUE, na.strings = "9999",
    colClasses = "numeric", nrows = 23)
{
     read.table(header = header, na.strings = na.strings,
       colClasses = colClasses, nrows = nrows, ...)
}

Whether or not this should be called curry, I have no idea. In any
case it seems like a useful function to have in a base package,
regardless of its implementation details.

baptiste