From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id B474DBBCA for ; Sun, 16 Mar 2008 22:24:04 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAJQs3UfAXQIn/2dsb2JhbAChR4Ra X-IronPort-AV: E=Sophos;i="4.25,510,1199660400"; d="scan'208";a="23837790" Received: from concorde.inria.fr ([192.93.2.39]) by mail4-smtp-sop.national.inria.fr with ESMTP; 16 Mar 2008 22:24:04 +0100 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id m2GLO3Bj029763 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Sun, 16 Mar 2008 22:24:04 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Aq0BAAst3UdC+Vysfmdsb2JhbACRAAEBCQQECgkWkAuEWg X-IronPort-AV: E=Sophos;i="4.25,510,1199660400"; d="scan'208";a="10332982" Received: from ug-out-1314.google.com ([66.249.92.172]) by mail3-smtp-sop.national.inria.fr with ESMTP; 16 Mar 2008 22:24:03 +0100 Received: by ug-out-1314.google.com with SMTP id k40so539421ugc.18 for ; Sun, 16 Mar 2008 14:24:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:cc:message-id:from:to:in-reply-to:content-type:content-transfer-encoding:mime-version:subject:date:references:x-mailer:sender; bh=isq5FAJfwiVidcBqwlyDSdTXNjD2YDifvfqY7JiWWLw=; b=VZK4hnWBWOKKa4Al3oFm/FxBebzbQpNFUOJgGNyFAAKYTdN4XDMg9HGL7/RCUX4ZEE0ose53kEo8crFYIozDPqlCfPtv5MhMWC0RCsrsewdtsM6mcDFl4u2HLcyoavFDmZzGVOILy5w6w9CGTE+BPhraXA1Yrz2oElaPx9zt5jo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=cc:message-id:from:to:in-reply-to:content-type:content-transfer-encoding:mime-version:subject:date:references:x-mailer:sender; b=PPlLKq2EDIOCG4ZrkkKep72YWEk3J7nDI2ZmzMJTKT0xG+KDwSfveOSUHWdieC/4GdHpQOd8x5rhGWQl21fQER1qIoXZgGudoZqX58hPAP+GVczuKU0NrkMHjAxxURtYhwyTeUcGNqz+pZmMrpEdy9BIGEIoyZBPDahvgh7zqMo= Received: by 10.67.24.11 with SMTP id b11mr2337559ugj.2.1205702642835; Sun, 16 Mar 2008 14:24:02 -0700 (PDT) Received: from ?192.168.1.39? ( [85.2.19.213]) by mx.google.com with ESMTPS id q1sm9816409uge.7.2008.03.16.14.24.02 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 16 Mar 2008 14:24:02 -0700 (PDT) Cc: caml-list@inria.fr Message-Id: <9CECF824-9C61-48A9-809C-D2B152F0EBD3@erratique.ch> From: =?ISO-8859-1?Q?B=FCnzli_Daniel?= To: Maxence Guesdon In-Reply-To: <20080316200146.vgd0u64rw4gcckwg@pops-rocq.inria.fr> Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Apple Message framework v919.2) Subject: Re: [Caml-list] R bindings ? Date: Sun, 16 Mar 2008 22:24:19 +0100 References: <20080314123242.vnqmbo1j44s0gkcg@pops-rocq.inria.fr> <20080316200146.vgd0u64rw4gcckwg@pops-rocq.inria.fr> X-Mailer: Apple Mail (2.919.2) Sender: =?ISO-8859-1?Q?Daniel=20B=FCnzli?= X-Miltered: at concorde with ID 47DD8FF3.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; bunzli:01 buenzli:01 bindings:01 maxence:01 guesdon:01 error-prone:01 computed:01 compiler:01 computations:01 ocaml:01 scsh:01 camlp:01 computed:01 scsh:01 ocaml:01 Le 16 mars 08 =E0 20:01, Maxence Guesdon a =E9crit : > 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 =20 > the errors at execution time. This need not be the case if you apply language embedding/meta-=20 programmation techniques (see for example [1]). You can even mask R =20 computations behind plain caml functional types. I have an unpolished toy example that does this to program arithmetic =20= functions on regular ocaml types but that use scsh to actually compute =20= the result (no camlp4 or unsafe features required), I can forward it =20 to you if you are interested. Here's an example of a polymorphic cube function, when you invoke =20 cubei or cubef the result will actually be computed by scsh. The =20 drawback is that you need to "write" the type your functions by hand =20 (cf argi argf reti retf). open Mini open Override open Program let cube_s =3D fun x -> x * x * x let cubei_p =3D compile (argi (reti cube_s)) let cubef_p =3D compile (argf (retf cube_s)) let cubei : int -> int =3D as_fun cubei_p let cubef : float -> float =3D as_fun cubef_p However as Ashish pointed out the biggest problem are the data sets, =20 but it may be that you can keep them in R only with suitable types to =20= represent them in ocaml. Best, Daniel [1] article{967844, author =3D {Conal Elliott and Sigbj\&\#248;rn Finne and Oege De = Moor}, title =3D {Compiling embedded languages}, journal =3D {J. Funct. Program.}, volume =3D {13}, number =3D {3}, year =3D {2003}, issn =3D {0956-7968}, pages =3D {455--481}, doi =3D {http://dx.doi.org/10.1017/S0956796802004574}, publisher =3D {Cambridge University Press}, address =3D {New York, NY, USA}, }