From ggrothendieck at gmail.com  Sun Dec 12 04:19:20 2010
From: ggrothendieck at gmail.com (Gabor Grothendieck)
Date: Sat, 11 Dec 2010 22:19:20 -0500
Subject: [Rd] R <-> Haskell
In-Reply-To: <AANLkTik2Cv-6nzbEnEkgVDT5Y-SN72HT6sBT0gbc5to0@mail.gmail.com>
References: <AANLkTik2Cv-6nzbEnEkgVDT5Y-SN72HT6sBT0gbc5to0@mail.gmail.com>
Message-ID: <AANLkTi=cZaTnFe6GnYVbWXEQdjbEm_uSOtVXwrjRbMFc@mail.gmail.com>

On Sat, Dec 11, 2010 at 9:04 PM, Jason E. Aten <j.e.aten at gmail.com> wrote:
> I'd like to develop, if there is not one already, an interface between R
> code and Haskell code, to allow R code to call Haskell (compiled) code, and
> vice-versa. ?But in the interest of not reinventing the wheel, does anyone
> on this list know of existing bindings for Haskell code?
>
> There is support for loading plugins in Haskell, and for an eval() like set
> of functions provided by the Haskell hs-plugin package that evaluates
> arbitrary strings in the IO monad.
> http://www.cse.unsw.edu.au/~dons/hs-plugins/paper/ describes this
> functionality. For example:
>
> #include <stdio.h>
> #include "RunHaskell.h"
>
> int main(int argc, char *argv[]) {
> ?int *p;
> ?hs_init(&argc, &argv);
> ?p = hs_eval_i("foldl1 (+) [0 .. 10]"); /* this is Haskell code */
> ?printf("%d\n", *p); hs_exit();
> }
>
>
>
> That said, i don't think it will be that difficutl. ?But I imagine the
> hardest part of this will be getting the memory management for garbage
> collection right. I thought I would start by looking at how the rJava or
> rJython packages handle memory. If anyone has pointers or advice on
> integrating R's garbage collection with another language's garbage
> collection, I'd welcome suggestions and warnings about pitfalls.
>

You might look at:

http://home.gna.org/ocaml-r/

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



[Rd] R <-> Haskell
Gabor Grothendieck