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 XAA15203; Thu, 12 Jul 2001 23:27:22 +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 XAA15167 for ; Thu, 12 Jul 2001 23:27:21 +0200 (MET DST) Received: from smtp1.cswv.com (smtp1.cswv.com [4.17.129.17]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f6CLRKn13779 for ; Thu, 12 Jul 2001 23:27:20 +0200 (MET DST) Received: from smtp1.cswv.com ([4.17.129.17]) by smtp1.cswv.com with Microsoft SMTPSVC(5.5.1877.197.19); Thu, 12 Jul 2001 17:27:44 -0400 Received: FROM exchange1.cswv.com BY smtp1.cswv.com ; Thu Jul 12 17:27:43 2001 -0400 Received: by exchange1.cswv.com with Internet Mail Service (5.5.2653.19) id ; Thu, 12 Jul 2001 17:30:07 -0400 Message-ID: From: "Krishnaswami, Neel" To: caml-list@inria.fr Subject: Re: [Caml-list] A G'Caml question" + additional info Date: Thu, 12 Jul 2001 17:30:00 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Markus Mottl [mailto:markus@mail4.ai.univie.ac.at] wrote: > On Wed, 11 Jul 2001, Krishnaswami, Neel wrote: > > For instance, I recently wrote yet another set > > implementation, because the functorial interface to the Set module > > in the standard library wouldn't let me use it in a fully polymorphic > > fashion. > > This is a shortcoming of the standard library that there are no > polymorphic implementations of "Set" and similar. It's very easy to > extract a polymorphic (module-) version from the existing code. Are there any plans to add them? I /really/ need them, and while their lack has led to me learning an awful lot about red-black trees, Patricia tries and treaps, I can't help but feel that I've been busy reinventing the wheel. :) If desired, I can offer a red-black tree implementation that implements the whole Map and Set interfaces. (I wonder how many other people have been inspired by that Okasaki paper?) > Note that the non-polymorphic version also has advantages for > users: e.g. they don't have to pass around comparison functions > all the time. ??? I don't understand this. In both the object version I posted and the functorial version that Brian Rogoff posted, a hacker only needs to mention the comparison function when creating the type, and then never again when making or using trees. In fact, my first experiment along these lines was to use a record with a tree and a comparison function in it. But even there, one could use currying to mention the function comparison only once. (I rejected it because it permitted trees with different but type- compatible comparison functions to intermix.) -- Neel Krishnaswami neelk@cswcasa.com ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr