From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 858F77F84F for ; Mon, 24 Feb 2014 02:30:27 +0100 (CET) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of berenger@riken.jp) identity=pra; client-ip=134.160.33.162; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="berenger@riken.jp"; x-sender="berenger@riken.jp"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of berenger@riken.jp designates 134.160.33.162 as permitted sender) identity=mailfrom; client-ip=134.160.33.162; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="berenger@riken.jp"; x-sender="berenger@riken.jp"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of postmaster@postman.riken.jp designates 134.160.33.162 as permitted sender) identity=helo; client-ip=134.160.33.162; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="berenger@riken.jp"; x-sender="postmaster@postman.riken.jp"; x-conformance=sidf_compatible; x-record-type="v=spf1" X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkgBAC+gClOGoCGinGdsb2JhbABZg0HBOYEkDgEBAQEBCAsJCRQogiUBAQUnEUARCxgJFg8JAwIBAgFFEwgBAYgBDcYmEwSOaxaEIgEDiUaObpVj X-IPAS-Result: AkgBAC+gClOGoCGinGdsb2JhbABZg0HBOYEkDgEBAQEBCAsJCRQogiUBAQUnEUARCxgJFg8JAwIBAgFFEwgBAYgBDcYmEwSOaxaEIgEDiUaObpVj X-IronPort-AV: E=Sophos;i="4.97,531,1389740400"; d="scan'208";a="50187123" Received: from postman2.riken.jp (HELO postman.riken.jp) ([134.160.33.162]) by mail3-smtp-sop.national.inria.fr with ESMTP; 24 Feb 2014 02:30:25 +0100 Received: from postman.riken.jp (postman2.riken.jp [127.0.0.1]) by postman.riken.jp (Postfix) with SMTP id 1FCD71260658; Mon, 24 Feb 2014 10:30:22 +0900 (JST) Received: from watson.prg.gsc.riken.jp (ipm04.gsc.riken.go.jp [134.160.83.74]) by postman.riken.jp (Postfix) with ESMTPA id E612A1270051; Mon, 24 Feb 2014 10:30:21 +0900 (JST) Message-ID: <530AA0AD.6050008@riken.jp> Date: Mon, 24 Feb 2014 10:30:21 +0900 From: Francois Berenger User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: caml-list@inria.fr References: <5309E82E.5060802@gmail.com> <530A590B.2040004@gmail.com> In-Reply-To: <530A590B.2040004@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2014.2.24.12114 Subject: Re: [Caml-list] how to convert strings to Ocaml values at run-time? On 02/24/2014 05:24 AM, Matej Kosik wrote: > On 23/02/14 13:12, Tianyi Cui wrote: >> If you know the type of this string in advance, you can do so with ocaml_plugin: https://github.com/janestreet/ocaml_plugin > > Hm, imagine that the expected type is: > > 'a * 'a -> bool > > Now, if user provides a string, say: > > "fun (a,b) -> a = b" > > how can I convert that string to Ocaml value of the above type (like how toplevel does it)? > > Is this something ocaml_plugin is able to do for me? I've failed to figure out the trick. I think MLdonkey could do that, but I have no idea how it was doing it.