Browse thread
[Caml-list] Should be INSIDE STANDARD-LIB: Hashtbl.keys
-
oliver@f...
- Richard Jones
- Martin Jambon
- Xavier Leroy
- John Goerzen
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | John Goerzen <jgoerzen@c...> |
| Subject: | Re: [Caml-list] Should be INSIDE STANDARD-LIB: Hashtbl.keys |
On Wed, Apr 21, 2004 at 03:19:04AM +0200, Oliver Bandel wrote: > I only think, this is such an often used function, that > it should be integrated into the Hastbl-module. You may be interested that Missinglib, which I will announce here shortly, has this in its Hashtblutil module: let map f hash = Hashtbl.fold (fun key value l -> (f key value) :: l) hash [];; let keys hash = map (fun key value -> key) hash;; let values hash = map (fun key value -> value) hash;; let items hash = map (fun key value -> key, value) hash;; let length hash = List.length (keys hash);; ------------------- 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