From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id MAA15320; Tue, 1 Jun 2004 12:07:40 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id MAA15303 for ; Tue, 1 Jun 2004 12:07:39 +0200 (MET DST) Received: from pat.uio.no (pat.uio.no [129.240.130.16]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i51A7bEV026679 for ; Tue, 1 Jun 2004 12:07:38 +0200 Received: from mail-mx6.uio.no ([129.240.10.47]) by pat.uio.no with esmtp (Exim 4.30) id 1BV6BF-0005g8-Jo for caml-list@inria.fr; Tue, 01 Jun 2004 12:07:37 +0200 Received: from itherther.simula.no ([129.240.228.187]) by smtp.uio.no with esmtp (Exim 4.34) id 1BV6BB-0005hc-Ib for caml-list@inria.fr; Tue, 01 Jun 2004 12:07:33 +0200 From: Hans Ole Rafaelsen Reply-To: hans@simula.no Organization: Simula Research Laboratory To: caml-list@inria.fr Subject: [Caml-list] Lazy recomputing Date: Tue, 1 Jun 2004 12:07:33 +0200 User-Agent: KMail/1.6 MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Message-Id: <200406011207.33006.hans@simula.no> X-MailScanner-Information: This message has been scanned for viruses/spam. Contact postmaster@uio.no if you have questions about this scanning X-UiO-MailScanner: No virus found X-UiO-Spam-info: not spam, SpamAssassin (score=-5, required 12, UIO_MAIL_IS_INTERNAL -5.00) X-Miltered: at nez-perce with ID 40BC5569.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; rafaelsen:01 simula:01 hash:01 hashtbl:01 hashtbl:01 rafaelsen:01 computed:01 int:01 int:01 supported:01 lazy:02 lazy:02 unit:03 dependent:03 dependent:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, I have a hash table which contains values, of which some are dependent on=20 other values in the table. I store the contents as lazy values. The proble= m=20 I'm having is that once a dependent value have been computed, it will not g= et=20 recomputed when the values it depends on changes. let _ =3D List.iter (fun (k,v) -> Hashtbl.add tbl k v) [ ("a", lazy 1); ("c", lazy ((Lazy.force (Hashtbl.find tbl "b")) + (Lazy.force=20 (Hashtbl.find tbl "a")))); ("b", lazy 4); ];; # let _ =3D Lazy.force (Hashtbl.find tbl "b");; =2D : int =3D 4 # let _ =3D Lazy.force (Hashtbl.find tbl "c");; =2D : int =3D 5 # let _ =3D Hashtbl.replace tbl "b" (lazy 6);; =2D : unit =3D () # let _ =3D Lazy.force (Hashtbl.find tbl "b");; =2D : int =3D 6 # let _ =3D Lazy.force (Hashtbl.find tbl "c");; =2D : int =3D 5 #=20 Is there some trick to get it recomputed, other that keep a list of all=20 dependent values, and "refresh" the table whenever some value is updated? =46rom the documentation of Lazy it does not seem that such behavior is=20 supported. =2D-=20 Hans Ole Rafaelsen ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners