Le 2013-10-26 22:57, Kevin Ushey a écrit :
Other thing worth considering for implementation: how might it fit in
with Rcpp Attributes? It would be very nice if we could define a
function like

// [[Rcpp::export]]
ListOf<IntegerVector> fun( ListOf<IntegerVector> x ) {
   ...
}

and have the wrapper function automatically generated as we're used
to. Ideally, ListOf would have most of the non-ctor methods from List
as well.

Could make ListOf derive from List instead of having it contain a List

Should the constructor do validation on the contents (ensure all
elements in the ListOf object have the template type)? Or could that
be part of a separate method (e.g. validate)?

I'd put this in the same bucket as bounds check. Something kind of nice conceptually, but too expensive.

For example in dplyr, I'm using ListOf where I already exactly know the type.

That said, this would be a lot of work and I understand if it's not a
priority. I'd like to contribute to the implementation but my C++
programming chops aren't up to par yet... unit tests and examples, I
can gladly contribute though.

You can always try :)

Let me know if you get a chance to revisit this later.

I will.

-Kevin

On Fri, Oct 25, 2013 at 12:00 PM, Romain Francois
<rom...@r-enthusiasts.com> wrote:
Cool. I've got lots on my plate right now, so this is not a priority. Did you have a chance to look at the (simplistic) implementation of ListOf
in dplyr:

https://github.com/hadley/dplyr/blob/master/inst/include/tools/ListOf.h

The indexing operator should be proxified so that we could handle
assignments, i.e.:

NumericVector z ;
ListOf<NumericVector> x( xxx );
x[0] = z ;

At the moment it only has read access because that's all I needed for now in
dplyr.

So maybe if we wanted something more generic in Rcpp, this should be
designed a bit more.

Romain

Le 25/10/2013 20:40, Kevin Ushey a écrit :

Hi Romain, Dirk,

I'd be willing to contribute an Rcpp Gallery post and some tests if
this were added to Rcpp; I think it would be quite useful.

-Kevin

On Wed, Oct 23, 2013 at 6:31 AM, Dirk Eddelbuettel <e...@debian.org> wrote:


On 23 October 2013 at 14:31, Romain Francois wrote:
| Le 23/10/2013 13:47, Dirk Eddelbuettel a écrit :
| > As always, preferably with a usage example (Rcpp Gallery post?
Section in a (new)
| > vigntte?) and tests so that people have some info on how to use it.
|
| That means it will take me more time than what I wanted to commit to
| this. I'll come back to it later then.

Up to you. FWIW your previous commits are still undocumented in NEWS.Rd.

Dirk

--
Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com



--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30


_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to