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=1.8 required=5.0 tests=AWL,RCVD_NUMERIC_HELO, SPF_FAIL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id EDE4FBC69 for ; Wed, 18 Jul 2007 17:28:02 +0200 (CEST) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l6IFS2i9009622 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Wed, 18 Jul 2007 17:28:02 +0200 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1IBBRS-0004jP-OZ for caml-list@inria.fr; Wed, 18 Jul 2007 17:27:54 +0200 Received: from 38.96.172.125 ([38.96.172.125]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 18 Jul 2007 17:27:54 +0200 Received: from sds by 38.96.172.125 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 18 Jul 2007 17:27:54 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: caml-list@inria.fr From: Sam Steingold Subject: modifying hash tables Date: Wed, 18 Jul 2007 11:27:45 -0400 Message-ID: <469E3171.7040205@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 38.96.172.125 User-Agent: Thunderbird 2.0.0.0 (X11/20070326) X-Enigmail-Version: 0.95.2 Sender: news X-Miltered: at concorde with ID 469E3182.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; hash:01 hash:01 hashtable:01 iter:01 hashtable:01 iter:01 data:02 data:02 modifying:02 gnu:03 gnu:03 modify:05 message-----:05 pgp:05 pgp:05 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I want to modify the _current_ datum in Hashtable.iter, e.g., increment a count. Is this code valid? Hashtable.iter ht ~f:(fun ~key ~data -> Hashtable.replace ht ~key ~data:(data+1)) (it appears to work, but I was told that "it is not guaranteed to work", i.e., the documentation does not promise that). If the above code is wrong, what is TRT? -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGnjFxPp1Qsf2qnMcRAhFaAJ0WEo90RwF5e1Ue+0tCdLyW2R5gawCcCJfd T8szhrihvlLwCh5L+er0N1E= =9bhb -----END PGP SIGNATURE-----