English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Possible function to add to Hashtbl?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-10-19 (04:20)
From: Jeremy Fincher <tweedgeezer@h...>
Subject: [Caml-list] Possible function to add to Hashtbl?
On the rare occasions I do find myself using the using multiple bindings of 
single key in a hashtbl, I also find myself needing a "remove_all" function,
which removes all the bindings to a particular key in a hashtbl.  Perhaps 
such a
function should be added to the module?

I'm sure there's a more efficient way to implement such a function in the
hashtbl module, but here's what I've been using thus far:

let hashtbl_remove_all h key =
  for i=1 to List.length (Hashtbl.find_all h key) do
    Hashtbl.remove h key;


Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr