R-alpha: unif_rand() again

Luke Tierney luke@stat.umn.edu
Tue, 3 Jun 1997 13:15:43 -0500 (CDT)


Peter Dalgaard BSA wrote:

> Here's a model that does (seem to) work:
> 
> > dyn.load("runif.so");.C("select_rand",runif); .C("unif_rand",3.3)
> [[1]]
...
> with
> 
> double select_rand(void * f)
> {
>         func = f;
> }
> 

I'm not sure I see the point of the separate select_rand -- you can
just pass runif as an argument to unif_rand. The original example
needed to use the global variable because a C routine for finding a
zero of a C function was being used and the C function whose root was
to be found needed to get at the S/R function that it was fronting
for. The global variable is needed to pass this info (since you don't
have C closures). Here there isn't any need that I can see, but maybe
I've missed something (wouldn't be the first time :-)).

-- 
Luke Tierney
University of Minnesota                      Phone:           612-625-7843
School of Statistics                         Fax:             612-624-8868
206 Church Street                            email:      luke@stat.umn.edu
Minneapolis, MN 55455 USA                    WWW:  http://www.stat.umn.edu
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-