From luke@stat.umn.edu  Tue Jun  3 19:15:43 1997
From: luke@stat.umn.edu (Luke Tierney)
Date: Tue, 3 Jun 1997 13:15:43 -0500 (CDT)
Subject: R-alpha: unif_rand() again
In-Reply-To: <x2pvu34n62.fsf@bush.kubism.ku.dk> from "Peter Dalgaard BSA" at Jun 3, 97 07:21:57 pm
Message-ID: <9706031815.AA15866@nokomis.stat.umn.edu>

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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


R-alpha: unif_rand() again
Luke Tierney