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 KAA27237; Fri, 24 Oct 2003 10:21:36 +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 KAA31537 for ; Fri, 24 Oct 2003 10:21:34 +0200 (MET DST) Received: from bob.west.spy.net (mail.west.spy.net [66.149.231.226]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h9O8LX112996 for ; Fri, 24 Oct 2003 10:21:33 +0200 (MET DST) Received: from spy.net (dustinti.west.spy.net [192.168.1.50]) by bob.west.spy.net (Postfix) with ESMTP id 0D13D5712; Fri, 24 Oct 2003 01:21:15 -0700 (PDT) Date: Fri, 24 Oct 2003 01:21:14 -0700 Subject: Re: [Caml-list] newbie type problem Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v552) Cc: caml-list@inria.fr To: David Brown From: Dustin Sallings In-Reply-To: <20031024005258.GA5049@davidb.org> Message-Id: <087CB9D7-05FB-11D8-B1A2-000393DC8AE4@spy.net> Content-Transfer-Encoding: 7bit X-Mailer: Apple Mail (2.552) X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 newbie:01 hashtbl:01 hashtbl:01 amazes:01 caml's:01 python:01 bigloo:01 bigloo:01 rewrote:01 mli:01 hash:01 iterates:01 cae:99 ocaml:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thursday, Oct 23, 2003, at 17:52 US/Pacific, David Brown wrote: > 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; > } That's exactly what I did, 'cept my time is a float. :) > Then your results could just be a > > (int * (string, transaction_info) Hashtbl.t) list Well, part of the problem is that my log files aren't necessarily sequential, so I have to be able to go back to any point in time and update the thing. Other than that, that's about right (from what I can read of that syntax so far). > 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. It's still plenty foreign to me, but this is complex enough to help me out with a bunch of concepts in the language. What amazes me is the lack of resources I've been able to find in ocaml so far (just googling). It seems like caml's been around for a while, and it works quite well. I wrote these log processor things in python originally because I know it pretty well, but it doesn't run very fast. In my early tests, ocaml and bigloo ran at roughly the same speed, and caml seems very foreign to me. However, recently, I've had a few instability problems with bigloo under certain circumstances. I rewrote that app in ocaml and it was many, many times faster and it worked more reliably. > BTW, I have found the .mli files for the libraries to be the best > documentation. Yeah, but I still couldn't figure out how to make a Map, assuming that's what I really wanted in the first place. A hash table that iterates in key sorted order would make my app faster and reduce complexity. I want to see it actually work first, though. :) -- SPY My girlfriend asked me which one I like better. pub 1024/3CAE01D5 1994/11/03 Dustin Sallings | Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE L_______________________ I hope the answer won't upset her. ____________ ------------------- 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