Tamas, I didn't know about finalizers, it sounds interesting. From a quick glance at the web page it looks like it might be useful, but it's not clear how many implementations support it. Even with that, letm might still be useful because for some GSL objects the creation and initialization steps are separate, and letm lets you combine them. With the advent of foreign-friendly arrays, letm will be mandatory for arrays; as it ultimately expands to a sb-sys:with-pinned-objects on SBCL. Also, a macro is provided for initializing the proper type array, and that type is extracted from the letm binding. Thanks for the suggestion, I will keep it in mind. Liam On Thu, Oct 2, 2008 at 8:44 PM, Tamas K Papp <tpapp@princeton.edu> wrote:
Liam,
Thanks for the solution. I worked around the issue by using the inverse distribution function and (random 1d0).
A general question about the architecture of GSLL: would it be possible to integrate it into Lisp better using finalizers? The idea is that when GSLL functions return native GSLL objects (maybe wrapped in a class, etc), they could also set up a finalizer that would free the object when it is no longer used. The library trivial-garbage provides a standardized interface to finalizers of various implementations.
Then letm would not be needed at all, and we would achieve a much better integration into CL. Just a thought. Let me know what you think,
Tamas