From: Jean-Christophe Filliatre <Jean-Christophe.Filliatre@lri.fr>
To: Ronaldo Carpio <rncarpio@yahoo.com>
Cc: caml-list@inria.fr
Subject: Re: newbie question (map/hashtbl size)
Date: Mon, 12 Feb 2001 14:57:49 +0100 (MET) [thread overview]
Message-ID: <14983.60381.251598.939523@pc803> (raw)
In-Reply-To: <20010211052332.11155.qmail@web704.mail.yahoo.com>
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
prev parent reply other threads:[~2001-02-12 18:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-02-11 5:23 Ronaldo Carpio
2001-02-12 13:57 ` Jean-Christophe Filliatre [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=14983.60381.251598.939523@pc803 \
--to=jean-christophe.filliatre@lri.fr \
--cc=caml-list@inria.fr \
--cc=rncarpio@yahoo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox