[Rcpp-devel] generalizing make_list

Dirk Eddelbuettel edd at debian.org
Thu Mar 18 12:55:22 CET 2010


Hi Romain,

On 18 March 2010 at 12:22, Romain Francois wrote:
| Hello,
| 
| I am very happy about the make_list templates, but it only handles 
| lists, and the next best thing would be having something that would 
| handle all sorts of vectors.

My first question would be "Why exactly?"  We have a very clear use case for
lists as we need to ship results back to the calling R process.  But why do
we need that ?
 
| With some imagination, I think we can achieve this, but I was wondering 
| what the interface should be like. I was thinking maybe making it static 
| member function templates of Vector<>, so that we would do for example:
| 
| NumericVector x = NumericVector::create(
| 	_["x"] = 2.0,
| 	_["y"] = 1.0
| ) ;

Again, why?  I would guess that the corpus of existing C++ code calling its
elements by name is pretty limited.  So why do we need or want to create
named vectors at the c++ level?  For returning to R, sure, but can't that be
had with less firepower?

Don't want to be difficult here but maybe our time is spend more fruitfully
one layer up (eg returning to RProtoBuf) than the endlessly add features
here.  Rcpp is pretty good as it stands, why not let it rest a little?

Dirk  
 
| I am more interested about a discussion about what should it be instead 
| of create than the usual conversation about _. There will be an 
| alternative to _, although it might involve more syntax, e.g.
| 
| NumericVector x = NumericVector::create(
| 	named<REALSXP>("x") = 2.0,
| 	named<REALSXP>("y") = 1.0
| ) ;
| 
| or :
| 
| NumericVector x = NumericVector::create(
| 	NumericVector::named("x") = 2.0,
| 	NumericVector::named("y") = 1.0
| ) ;
| 
| etc ...
| 
| Ideas ?
| 
| -- 
| Romain Francois
| Professional R Enthusiast
| +33(0) 6 28 91 30 30
| http://romainfrancois.blog.free.fr
| |- http://tr.im/OIXN : raster images and RImageJ
| |- http://tr.im/OcQe : Rcpp 0.7.7
| `- http://tr.im/O1wO : highlight 0.1-5
| 
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

-- 
  Registration is open for the 2nd International conference R / Finance 2010
  See http://www.RinFinance.com for details, and see you in Chicago in April!


More information about the Rcpp-devel mailing list