From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA02519; Fri, 24 Oct 2003 09:53:03 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id JAA30790 for ; Fri, 24 Oct 2003 09:53:02 +0200 (MET DST) Received: from mail.davidb.org (adsl-64-172-240-129.dsl.sndg02.pacbell.net [64.172.240.129]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h9O7r1110323 for ; Fri, 24 Oct 2003 09:53:01 +0200 (MET DST) Received: from davidb by mail.davidb.org with local (Exim 3.36 #1 (Debian)) id 1ACqCI-0001Jz-00; Thu, 23 Oct 2003 17:52:58 -0700 Date: Thu, 23 Oct 2003 17:52:58 -0700 From: David Brown To: Dustin Sallings Cc: David Brown , caml-list@inria.fr Subject: Re: [Caml-list] newbie type problem Message-ID: <20031024005258.GA5049@davidb.org> References: <20031023233239.GA4477@davidb.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.4i X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 caml-list:01 newbie:01 hashtbl:01 hashtbl:01 mli:01 0700,:01 mutable:01 mutable:01 int:01 int:01 string:03 dave:03 wrote:03 oct:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thu, Oct 23, 2003 at 11:54:07PM -0700, Dustin Sallings wrote: > { 0: < > pb_counts = { "T1": 23, "T2": 43 } > pb_times = { "T1": 291, "T2": 92 } > > > 300: < > pb_counts = { "T1": 29, "T2": 50 } > pb_times = { "T1": 202, "T2": 87 } > > > } > > When I spell it out that way, it looks a little less than optimal. > However, this is more of a learning tool at this point. You may want to consider putting the data for a given transaction type into its own type, and having that be the target of the hashtbl. type transaction_info = { mutable counts : int; mutable times : int; } Then your results could just be a (int * (string, transaction_info) Hashtbl.t) list Dave BTW, this actually seems like a good problem for learning the language. I seem to always choose things too difficult, and end up getting frustrated. BTW, I have found the .mli files for the libraries to be the best documentation. ------------------- 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