caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* R bindings ?
@ 2008-03-14 11:32 Maxence Guesdon
  2008-03-15 12:40 ` [Caml-list] " Ashish Agarwal
  0 siblings, 1 reply; 6+ messages in thread
From: Maxence Guesdon @ 2008-03-14 11:32 UTC (permalink / raw)
  To: caml-list

Hello,

Has anyone developed any kind of bindings with R-project to call R  
from OCaml programs ? If so, is it available somewhere ?

Thanks,

Maxence Guesdon

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] R bindings ?
  2008-03-14 11:32 R bindings ? Maxence Guesdon
@ 2008-03-15 12:40 ` Ashish Agarwal
  2008-03-15 16:08   ` Francois Rouaix
  0 siblings, 1 reply; 6+ messages in thread
From: Ashish Agarwal @ 2008-03-15 12:40 UTC (permalink / raw)
  To: Maxence Guesdon; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 770 bytes --]

I searched a few weeks ago for this but did not find anything.


On Fri, Mar 14, 2008 at 7:32 AM, Maxence Guesdon <maxence.guesdon@inria.fr>
wrote:

> Hello,
>
> Has anyone developed any kind of bindings with R-project to call R
> from OCaml programs ? If so, is it available somewhere ?
>
> Thanks,
>
> Maxence Guesdon
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
>
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>

[-- Attachment #2: Type: text/html, Size: 1337 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] R bindings ?
  2008-03-15 12:40 ` [Caml-list] " Ashish Agarwal
@ 2008-03-15 16:08   ` Francois Rouaix
  2008-03-15 19:53     ` Ashish Agarwal
  2008-03-16 19:01     ` Maxence Guesdon
  0 siblings, 2 replies; 6+ messages in thread
From: Francois Rouaix @ 2008-03-15 16:08 UTC (permalink / raw)
  To: Ashish Agarwal; +Cc: Maxence Guesdon, caml-list

[-- Attachment #1: Type: text/plain, Size: 1403 bytes --]

And why do you need bindings instead of simply feeding generated source code
to the R toplevel?Low-level bindings are mostly useful if the calls go both
ways or if the parsing costs represent a high overhead.
--f


2008/3/15 Ashish Agarwal <agarwal1975@gmail.com>:

> I searched a few weeks ago for this but did not find anything.
>
>
>
> On Fri, Mar 14, 2008 at 7:32 AM, Maxence Guesdon <maxence.guesdon@inria.fr>
> wrote:
>
> > Hello,
> >
> > Has anyone developed any kind of bindings with R-project to call R
> > from OCaml programs ? If so, is it available somewhere ?
> >
> > Thanks,
> >
> > Maxence Guesdon
> >
> > ----------------------------------------------------------------
> > This message was sent using IMP, the Internet Messaging Program.
> >
> >
> > _______________________________________________
> > Caml-list mailing list. Subscription management:
> > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> > Archives: http://caml.inria.fr
> > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> > Bug reports: http://caml.inria.fr/bin/caml-bugs
> >
>
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
>

[-- Attachment #2: Type: text/html, Size: 2559 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] R bindings ?
  2008-03-15 16:08   ` Francois Rouaix
@ 2008-03-15 19:53     ` Ashish Agarwal
  2008-03-16 19:01     ` Maxence Guesdon
  1 sibling, 0 replies; 6+ messages in thread
From: Ashish Agarwal @ 2008-03-15 19:53 UTC (permalink / raw)
  To: Francois Rouaix; +Cc: Maxence Guesdon, caml-list

[-- Attachment #1: Type: text/plain, Size: 1754 bytes --]

There would be high overhead because I would be passing very large data sets
back and forth. And I thought a binding would be easier to use.
Printing/parsing becomes tedious.


On Sat, Mar 15, 2008 at 12:08 PM, Francois Rouaix <francois.rouaix@gmail.com>
wrote:

> And why do you need bindings instead of simply feeding generated source
> code to the R toplevel?Low-level bindings are mostly useful if the calls
> go both ways or if the parsing costs represent a high overhead.
> --f
>
>
> 2008/3/15 Ashish Agarwal <agarwal1975@gmail.com>:
>
> I searched a few weeks ago for this but did not find anything.
> >
> >
> >
> > On Fri, Mar 14, 2008 at 7:32 AM, Maxence Guesdon <
> > maxence.guesdon@inria.fr> wrote:
> >
> > > Hello,
> > >
> > > Has anyone developed any kind of bindings with R-project to call R
> > > from OCaml programs ? If so, is it available somewhere ?
> > >
> > > Thanks,
> > >
> > > Maxence Guesdon
> > >
> > > ----------------------------------------------------------------
> > > This message was sent using IMP, the Internet Messaging Program.
> > >
> > >
> > > _______________________________________________
> > > Caml-list mailing list. Subscription management:
> > > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> > > Archives: http://caml.inria.fr
> > > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> > > Bug reports: http://caml.inria.fr/bin/caml-bugs
> > >
> >
> >
> > _______________________________________________
> > Caml-list mailing list. Subscription management:
> > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> > Archives: http://caml.inria.fr
> > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> > Bug reports: http://caml.inria.fr/bin/caml-bugs
> >
> >
>

[-- Attachment #2: Type: text/html, Size: 3116 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] R bindings ?
  2008-03-15 16:08   ` Francois Rouaix
  2008-03-15 19:53     ` Ashish Agarwal
@ 2008-03-16 19:01     ` Maxence Guesdon
  2008-03-16 21:24       ` Bünzli Daniel
  1 sibling, 1 reply; 6+ messages in thread
From: Maxence Guesdon @ 2008-03-16 19:01 UTC (permalink / raw)
  To: caml-list

Francois Rouaix <francois.rouaix@gmail.com> a ?it :

> And why do you need bindings instead of simply feeding generated source code
> to the R toplevel?Low-level bindings are mostly useful if the calls go both
> ways or if the parsing costs represent a high overhead.

Because
- Printf-ing the code is kind of heavy and error-prone,
- parsing the computed values is some work to handle correctly,
- the compiler can't tell me if I did something wrong so I get all the  
errors at execution time.

Maxence
> --f
>
>
> 2008/3/15 Ashish Agarwal <agarwal1975@gmail.com>:
>
>> I searched a few weeks ago for this but did not find anything.
>>
>>
>>
>> On Fri, Mar 14, 2008 at 7:32 AM, Maxence Guesdon <maxence.guesdon@inria.fr>
>> wrote:
>>
>> > Hello,
>> >
>> > Has anyone developed any kind of bindings with R-project to call R
>> > from OCaml programs ? If so, is it available somewhere ?
>> >
>> > Thanks,
>> >
>> > Maxence Guesdon
>> >
>> > ----------------------------------------------------------------
>> > This message was sent using IMP, the Internet Messaging Program.
>> >
>> >
>> > _______________________________________________
>> > Caml-list mailing list. Subscription management:
>> > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
>> > Archives: http://caml.inria.fr
>> > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>> > Bug reports: http://caml.inria.fr/bin/caml-bugs
>> >
>>
>>
>> _______________________________________________
>> Caml-list mailing list. Subscription management:
>> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
>> Archives: http://caml.inria.fr
>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>> Bug reports: http://caml.inria.fr/bin/caml-bugs
>>
>>
>



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Caml-list] R bindings ?
  2008-03-16 19:01     ` Maxence Guesdon
@ 2008-03-16 21:24       ` Bünzli Daniel
  0 siblings, 0 replies; 6+ messages in thread
From: Bünzli Daniel @ 2008-03-16 21:24 UTC (permalink / raw)
  To: Maxence Guesdon; +Cc: caml-list


Le 16 mars 08 à 20:01, Maxence Guesdon a écrit :

> Because
> - Printf-ing the code is kind of heavy and error-prone,
> - parsing the computed values is some work to handle correctly,
> - the compiler can't tell me if I did something wrong so I get all  
> the errors at execution time.

This need not be the case if you apply language embedding/meta- 
programmation techniques (see for example [1]). You can even mask R  
computations behind plain caml functional types.

I have an unpolished toy example that does this to program arithmetic  
functions on regular ocaml types but that use scsh to actually compute  
the result (no camlp4 or unsafe features required), I can forward it  
to you if you are interested.

Here's an example of a polymorphic cube function, when you invoke  
cubei or cubef the result will actually be computed by scsh. The  
drawback is that you need to "write" the type your functions by hand  
(cf argi argf reti retf).

open Mini
open Override
open Program

let cube_s = fun x -> x * x * x

let cubei_p = compile (argi (reti cube_s))
let cubef_p = compile (argf (retf cube_s))

let cubei : int   -> int   = as_fun cubei_p
let cubef : float -> float = as_fun cubef_p

However as Ashish pointed out the biggest problem are the data sets,  
but it may be that you can keep them in R only with suitable types to  
represent them in ocaml.

Best,

Daniel

[1]

article{967844,
   author = {Conal Elliott and Sigbj\&\#248;rn Finne and Oege De Moor},
   title = {Compiling embedded languages},
   journal = {J. Funct. Program.},
   volume = {13},
   number = {3},
   year = {2003},
   issn = {0956-7968},
   pages = {455--481},
   doi = {http://dx.doi.org/10.1017/S0956796802004574},
   publisher = {Cambridge University Press},
   address = {New York, NY, USA},
   }


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-03-16 21:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-14 11:32 R bindings ? Maxence Guesdon
2008-03-15 12:40 ` [Caml-list] " Ashish Agarwal
2008-03-15 16:08   ` Francois Rouaix
2008-03-15 19:53     ` Ashish Agarwal
2008-03-16 19:01     ` Maxence Guesdon
2008-03-16 21:24       ` Bünzli Daniel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).