Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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 
a
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;
  done
-----

Jeremy


_________________________________________________________________
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