Message-ID: <19509.49477.364639.739166@ron.nulle.part>
Date: 2010-07-08T12:15:01Z
From: Dirk Eddelbuettel
Subject: [Rcpp-devel] sugar version of apply
In-Reply-To: <4C35BF50.8020307@r-enthusiasts.com>
On 8 July 2010 at 14:06, Romain Francois wrote:
| Hello,
|
| Now that we have extended sugar so that it can deal with matrices, e.g :
|
| signature( x = "numeric", y = "numeric" ),
| '
| NumericVector xx(x) ;
| NumericVector yy(y);
| NumericMatrix m = outer( xx, yy, std::plus<double>() ) ;
| return m ;
| ' )
|
|
|
| I'd like to have a sugar version of apply. We cannot retain the same
| interface :
|
| apply( { matrix expression }, { 1 or 2 }, { function } )
|
| because we need compile time dispatch, which is not possible with the
| second argument. So I'm just wondering how we should call the row and
| column versions:
|
| apply_1
| apply_2
| apply_row
| apply_col
| col_apply
| row_apply
|
| Any preference ?
I like the last two, and I'd drop the underscore for camelCase. applyRow and
applyCol would also work. The first two I like the least.
--
Regards, Dirk