[Gsll-devel] closure out of letm

Tamas K Papp tpapp at Princeton.EDU
Tue Sep 30 18:32:54 UTC 2008


Hi,

I am trying to create a function that would return another function
that generates draws from a beta distribution.  Something like this:

(defun make-beta-generator (a b)
  (letm ((rng (random-number-generator *mt19937* 0)))
    (lambda ()
      ;; of course this won't work, letm deallocated rng
      (beta-rd rng a b))))

As the comment says, this does not work.  Is there a way to prevent
letm from deallocating rng (or achieve the effect I want by some other
means)?

Thanks,

Tamas



More information about the gsll-devel mailing list