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 RAA07672; Mon, 26 Jul 2004 17:17:41 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA07637 for ; Mon, 26 Jul 2004 17:17:40 +0200 (MET DST) Received: from herd.plethora.net (herd.plethora.net [205.166.146.1]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i6QFHdEV010377 for ; Mon, 26 Jul 2004 17:17:39 +0200 Received: from bhurt.plethora.net (bhurt.plethora.net [205.166.146.49]) by herd.plethora.net (8.11.6/8.10.1) with ESMTP id i6QFHao27783; Mon, 26 Jul 2004 10:17:36 -0500 (CDT) Date: Mon, 26 Jul 2004 10:25:28 -0500 (CDT) From: Brian Hurt X-X-Sender: bhurt@localhost.localdomain To: Matthieu Sozeau cc: caml-list@inria.fr Subject: Re: [Caml-list] Map + Set In-Reply-To: <20040726104051.GA9736@mattam.ath.cx> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at nez-perce with ID 41052093.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 matthieu:01 2004:99 val:01 elt:01 elt:01 pervasives:01 descend:01 val:01 implemented:01 enums:01 enums:01 ocaml:01 caml:01 equality:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Mon, 26 Jul 2004, Matthieu Sozeau wrote: > On Sun, Jul 25, 2004 at 12:01:03PM -0500, Brian Hurt wrote: > > On Sun, 25 Jul 2004, Martin Jambon wrote: > > > > A better interface might be: > > > > val find: (elt -> int) -> t -> elt > > Why an int ? Isn't a boolean enough ? Two reasons: 1) This allows you to use Pervasives.compare (or other compatible function) partially applied. 2) In addition to equality, you also need less than/greater than in order to keep the function in O(log N)- which branch do you descend? With just equality, you need to do an O(N) exhaustive search. > > > There is a lot of functionality I'd like to be able to add to map and set. > > I find myself reimplementing them on a regular basis myself (and no, I > > haven't thought of a better solution). > > Apart from "val of_list : elt list -> t" (a one liner) and the find > function (a fold with an exception or using `exists` and keeping a > reference, which indicates, I think, that it should be implemented > directly in set.ml), i don't remember truly missing functions. > What are those ? Map, fold, and iter over pairs of maps or sets is the one I always end up needing. Also, enums would be nice. Actually, I could do the pairwise comprehensions if I had enums. > > > Many people on this list don't like modules, however. > > That seems like a weird opinion to me, and mine is that most OCaml hackers > are really caml hackers who don't want to know about the OO part. > When I tossed out my changes to map and set, they were bounced with a "they use modules- you should apply them to the demodulized versions of the code instead". And about the only feed back I ever got on priority search queues amounted to "it uses modules- we don't like modules". -- "Usenet is like a herd of performing elephants with diarrhea -- massive, difficult to redirect, awe-inspiring, entertaining, and a source of mind-boggling amounts of excrement when you least expect it." - Gene Spafford Brian ------------------- 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