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 DAA27345; Wed, 21 Apr 2004 03:40:06 +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 DAA26892 for ; Wed, 21 Apr 2004 03:40:05 +0200 (MET DST) Received: from hirsch.in-berlin.de (hirsch.in-berlin.de [192.109.42.6]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i3L1e4jq018836 for ; Wed, 21 Apr 2004 03:40:04 +0200 X-Envelope-From: oliver@first.in-berlin.de X-Envelope-To: Received: from hirsch.in-berlin.de (localhost [127.0.0.1]) by hirsch.in-berlin.de (8.12.11/8.12.11/Debian-3) with ESMTP id i3L1e1BZ008142 for ; Wed, 21 Apr 2004 03:40:01 +0200 Received: from first.UUCP (uucp@localhost) by hirsch.in-berlin.de (8.12.11/8.12.11/Debian-3) with UUCP id i3L1K1hI006483 for inria.fr!caml-list; Wed, 21 Apr 2004 03:20:01 +0200 Received: by first.in-berlin.de via sendmail from stdin id (Debian Smail3.2.0.114) Wed, 21 Apr 2004 03:19:04 +0200 (CEST) From: oliver@first.in-berlin.de (Oliver Bandel) Date: Wed, 21 Apr 2004 03:19:04 +0200 To: caml-list@inria.fr Subject: [Caml-list] Should be INSIDE STANDARD-LIB: Hashtbl.keys Message-ID: <20040421011904.GA1411@first.in-berlin.de> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline User-Agent: Mutt/1.3.28i X-Miltered: at nez-perce by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; oliver:01 in-berlin:01 oliver:01 bandel:01 hashtbl:01 hash:01 val:01 hashtbl:01 hash:01 bandel:01 mailed:98 bindings:01 ocaml:01 imho:01 exists:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, I think a good addition to the Hashtbl-module would be a function, that gives back a list of keys that are in the hash. Well, ok, I've written code for doing this task, before I've mailed this idea to the list, so I'm not looking for code / for help with sources here. I only think, this is such an often used function, that it should be integrated into the Hastbl-module. Well, should be something like this one: val keys : ('a, 'b) t -> 'a list usage: Hashtbl.keys returns a list of all keys of the hash "hash", that exists and therefore have values bound to it. If a key has several bindings, it will occur only once in this list. IMHO it should be possible to implement a Hashtbl.keys function inside the Hashtbl-module-sources much more efficient than doing it via the already given Hashtbl-functions of that module, that are exported. But even if this would not be true, I think, giving back a list of all keys in a hash (with each key reported only once, even if it has more than one binding) is a rudimentary and necessary function, that should be integrated in the standard-Hashtbl-Lib-module. Best regards to all OCaml core developers (and all other readers too) here. Ciao, Oliver Bandel ------------------- 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