caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Guillaume Yziquel <guillaume.yziquel@citycable.ch>
To: OCaml List <caml-list@inria.fr>, r-devel@r-project.org
Subject: [ANN] OCaml-R binding for the R language.
Date: Fri, 12 Feb 2010 23:02:41 +0100	[thread overview]
Message-ID: <4B75D001.5080502@citycable.ch> (raw)

This post is to announce the 0.2 release of OCaml-R.

OCaml-R is a binding embedding the R interpreter into Objective Caml code.

Home page: http://home.gna.org/ocaml-r/
Download page: http://download.gna.org/ocaml-r/
Deb packages: http://yziquel.homelinux.org/debian/pool/main/o/ocaml-r/
Tutorial: http://home.gna.org/ocaml-r/gettingstarted.en.html
OCamlDoc API: http://yziquel.homelinux.org/topos/api/ocaml-r/index.html
               http://home.gna.org/ocaml-r/refdoc/index.html

The goal of OCaml-R is to provide adequate integration of the R 
interpreter into Objective Caml, and a framework suitable to bind R 
library into OCaml code.

Version 0.2 is a near-complete rewrite of the 0.1 version by Maxence 
Guesdon, with an incompatible API. Main features are:

- Safe handling of R default environment variables at compile time, 
following what is done in littler.
- R Signal handlers do not conflict with OCaml code.
- Integration with findlib, enabling the #require "R.interpreter" to 
initialise statically the R interpreter. Compiling with 'ocamlfind 
ocamlopt -package R.interpreter' also initialises the R interpreter at 
compile-time, so to speak.
- Some (most?) functionalities of the R standalone library are wrapped.
- Low-level binding, in the sense that you construct low-level R calls 
to execute them. You can also parse R code to execute it, if you wish.
- R exceptions are chained back to Objective Caml.
- R's garbage collector is chained with OCaml's garbage collector. This 
is done rather inefficiently for the moment (freeing n R values in 
O(n^2) time complexity), and we expect to bring this down to O(n) with a 
thin garbage collecting layer in the future.
- We provide a double typing scheme, with some subtyping features. A 
first typing mimics the dynamic typing of the R language, while a second 
typing, for the end-user, aims at providing a static typing of R values 
and functions. (This can be bettered).
- S3 classes are supported (static typing is however still 
unsatisfying). S4 classes are not yet supported. Help welcome.
- Some basic R datatypes, such as dataframes, are wrapped, and a 
framework to wrap the standard library has been put in place.
- Basic data structures can be converted back and forth between OCaml 
and the R interpreter.
- Ability to inspect (read-only) the inner structure of R values, which 
is quite convenient: you get to know rather quickly what a given piece 
of R code returns, which you need to know to type R code statically in 
order to bind it to OCaml.
- Not thread-safe at all. At least, not more than R is... Lwt-style 
multithreading of R code could be possible, modulo some simple and deep 
(i.e. below R API) changes in the R evaluation functions. POSIX 
threading a single R thread with multiple OCaml threads is not yet 
possible, but is within reach.
- Doesn't interact well the R "Defaults" package.

While most of the code sticks or could stick to the R API, or at least 
to the public part of the R headers, there are some functionalities 
which are outright out of the scope of the R API. Some of these 
functionalities are for convenience only (i.e. inspecting internals of R 
values), while others are crucial to the binding (chaining R exceptions 
to OCaml).

Hopefully, this lays down a foundation on which one could import R 
functionalities, libraries and packages to OCaml.

-- 
      Guillaume Yziquel
http://yziquel.homelinux.org/


                 reply	other threads:[~2010-02-12 22:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B75D001.5080502@citycable.ch \
    --to=guillaume.yziquel@citycable.ch \
    --cc=caml-list@inria.fr \
    --cc=r-devel@r-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).