caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* newbie question (map/hashtbl size)
@ 2001-02-11  5:23 Ronaldo Carpio
  2001-02-12 13:57 ` Jean-Christophe Filliatre
  0 siblings, 1 reply; 2+ messages in thread
From: Ronaldo Carpio @ 2001-02-11  5:23 UTC (permalink / raw)
  To: caml-list


Hello,

How do you get the size of a hashtable or map?

Thanks in advance,


Ronnie N. Carpio
rncarpio@yahoo.com

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: newbie question (map/hashtbl size)
  2001-02-11  5:23 newbie question (map/hashtbl size) Ronaldo Carpio
@ 2001-02-12 13:57 ` Jean-Christophe Filliatre
  0 siblings, 0 replies; 2+ messages in thread
From: Jean-Christophe Filliatre @ 2001-02-12 13:57 UTC (permalink / raw)
  To: Ronaldo Carpio; +Cc: caml-list


In his message of Sat February 10, 2001, Ronaldo Carpio writes: 
> 
> How do you get the size of a hashtable or map?

An  esay solution is  to use  a reference  and the  iteration function
provided with the datatype, like this:

======================================================================
# let hashtbl_size h = 
    let n = ref 0 in Hashtbl.iter (fun _ _ -> incr n) h; !n;;
val hashtbl_size : ('a, 'b) Hashtbl.t -> int = <fun>
======================================================================

Hope this helps,
-- 
Jean-Christophe FILLIATRE
  mailto:Jean-Christophe.Filliatre@lri.fr
  http://www.lri.fr/~filliatr



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-02-12 18:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-11  5:23 newbie question (map/hashtbl size) Ronaldo Carpio
2001-02-12 13:57 ` Jean-Christophe Filliatre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).