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=2.5 required=5.0 tests=AWL,DNS_FROM_RFC_POST, SPF_NEUTRAL 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 E3C9BBC37 for ; Fri, 19 Jun 2009 20:23:08 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArsBANp0O0rRVdrbmGdsb2JhbACYLT8BAQEBAQgJDAcTpkGQOgEDAgSEBQWHJQ X-IronPort-AV: E=Sophos;i="4.42,255,1243807200"; d="scan'208";a="42109074" Received: from mail-bw0-f219.google.com ([209.85.218.219]) by mail4-smtp-sop.national.inria.fr with ESMTP; 19 Jun 2009 20:23:08 +0200 Received: by bwz19 with SMTP id 19so2152640bwz.9 for ; Fri, 19 Jun 2009 11:23:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:cc:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-mailer; bh=qvySGDtNFUvv5qY9CNSxCvN2RhV5F3xlME4iwasAGSA=; b=koBSNy76Of8aVm2F8caBkWIjl70ELJI0OJQnnDa4enU8zRGPwnHnU7muBqXLBqWvxU RA+BVmp5j6++nr7sZDZZWgBJMCyZbcv9mMbVN2z+Qhp8RfNd7x6ILcS+onsvYQlByGo2 IXJJ+kMqFZm354gy0JYhLYof0fZKLkzEFO/08= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:cc:message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer; b=eBAceo6zp6xxP5F2cqUS+nemNEqozsBW4xMk1w/eWR7tnsg1GRVEUe5/LcCOBzut4w KeeXaRCmT1uWO4k612tQmuwVRTMQfQj8Ixedh1o88CqvPDj6crIeghwhHuCyrM+jqZXa qQh05b5rPlc0Ley7REwL/oyOvnBNRQOHmybW0= Received: by 10.103.160.9 with SMTP id m9mr2029578muo.53.1245435786391; Fri, 19 Jun 2009 11:23:06 -0700 (PDT) Received: from ?192.168.1.34? (218-220.76-83.cust.bluewin.ch [83.76.220.218]) by mx.google.com with ESMTPS id j2sm6950857mue.42.2009.06.19.11.23.05 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 19 Jun 2009 11:23:06 -0700 (PDT) Sender: =?UTF-8?Q?Daniel_B=C3=BCnzli?= Cc: caml-list@inria.fr Message-Id: From: =?ISO-8859-1?Q?Daniel_B=FCnzli?= To: guillaume.yziquel@citycable.ch In-Reply-To: <4A3BCE1A.3010403@citycable.ch> Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Apple Message framework v935.3) Subject: Re: Obj.magic and existential types. Date: Fri, 19 Jun 2009 20:21:34 +0200 References: <4A3BCE1A.3010403@citycable.ch> X-Mailer: Apple Mail (2.935.3) X-Spam: no; 0.00; bunzli:01 buenzli:01 existential:01 guillaume:01 computations:01 rewrote:01 ocaml:01 cmo:01 val:01 abstr:01 val:01 abstr:01 int:01 int:01 data:02 Le 19 juin 09 =E0 19:42, Guillaume Yziquel a =E9crit : > But the result is rather interesting. It can record a flow of =20 > computations, and recompute them only when upstream data has been =20 > modified: Not directly responding to your question but you are looking for =20 functional reactive programming (frp). http://erratique.ch/software/react I rewrote your example below with react (no magic used). Best, Daniel > ocaml react.cmo Objective Caml version 3.11.0 # open React;; # let n, set_n =3D S.create 1;; val n : int React.signal =3D val set_n : int -> unit =3D # let m =3D S.map (fun x -> x + 1) n ;; val m : int React.signal =3D # S.value m;; - : int =3D 2 # set_n 3;; - : unit =3D () # S.value m;; - : int =3D 4