Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Should be INSIDE STANDARD-LIB: Hashtbl.keys
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: oliver@f...
Subject: [Caml-list] Should be INSIDE STANDARD-LIB: Hashtbl.keys
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 <hash>  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