On 12 September 2012 at 08:38, Rodney Sparapani wrote:
| On 09/07/2012 12:19 PM, Dirk Eddelbuettel wrote:
| > |>  As a general, looking at the unit test files can be helpful. Here is 
one for qnorm:
| > |>
| > |>     "runit_qnorm_prob" = list(
| > |>     signature( x = "numeric" ),
| > |>     '
| > |>     NumericVector xx(x) ;
| > |>     return List::create(_["lower"] = qnorm( xx, 0.0, 1.0 ),
| > |>                  _["upper"] = qnorm( xx, 0.0, 1.0, false));
| > |>     ')
| 
| The unit tests are indeed very helpful.  However, I have been trying to
| figure out how the unit tests were developed.  As far as I can see,
| there is nothing in Rcpp nor Rmath.h that actually specifies the
| prototypes like the example above (and I did look, hence my initial

If that were true, the code would compile. The code compiles so ...

And:

   edd@max:~$ grep -r qnorm /usr/local/lib/R/site-library/Rcpp/include/ | wc -l
   10
   edd@max:~$ 

| confusion about the syntax of qnorm).  Were these written simply by
| looking at the R help itself like ?qnorm or were they automated in
| some way?  Thanks

There is no magic pixie dust. Some headers are script-generated, even those
scripts are in SVN.  Some of the p/q/d/r-sugar functions are from macro
expansions as you will see.

Dirk

-- 
Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com  
_______________________________________________
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