From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 2C4C8BBC1 for ; Wed, 23 Apr 2008 16:23:16 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnABAG/iDkjBL1AZiGdsb2JhbACRUgEBAQ8mm20 X-IronPort-AV: E=Sophos;i="4.25,699,1199660400"; d="scan'208";a="25393358" Received: from gw.exalead.com (HELO exalead.com) ([193.47.80.25]) by mail4-smtp-sop.national.inria.fr with ESMTP; 23 Apr 2008 16:23:15 +0200 Received: from [192.168.204.148] (madpc064.exalead.com [192.168.204.148]) (authenticated bits=0) by exalead.com (8.14.2/8.14.0) with ESMTP id m3NEMwVb007440; Wed, 23 Apr 2008 16:22:58 +0200 Message-ID: <480F4642.20703@exalead.com> Date: Wed, 23 Apr 2008 16:22:58 +0200 From: Berke Durak User-Agent: Thunderbird 1.5.0.10 (X11/20070221) MIME-Version: 1.0 To: David Allsopp Cc: "'Brian Hurt'" , "'Jon Harrop'" , caml-list@yquem.inria.fr Subject: Re: [Caml-list] Announce: xsetxmap, unfunctorized, Sexp-lib awareversions of Set and Map References: <480C60DF.9010000@exalead.com><480C739F.5080104@lri.fr> <200804231335.25708.jon@ffconsultancy.com> <480F38D7.4050503@janestcapital.com> <008b01c8a549$e6fa0600$017ca8c0@countertenor> In-Reply-To: <008b01c8a549$e6fa0600$017ca8c0@countertenor> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; berke:01 durak:01 berke:01 durak:01 pervasives:01 pervasives:01 stdlib:01 mli:01 struct:01 elt:01 cmo:01 cmx:01 iter:01 swallow:98 wrote:01 David Allsopp wrote: > Brian Hurt wrote: > >> Jon Harrop wrote: >> > > Agreed - then we could also have more sensibly located functions such as > Int.of_string (note that it's the same length as int_of_string!!) and remove > lots of random functions from Pervasives! Of course we'll just add an extra Int module and leave Pervasives alone, or at least make it trigger a warning. > All that said, and especially as StdLib changes are reasonably rare, I find > having files IntSet.ml and IntSet.mli containing: > > include Set.Make(struct type t = int let compare = Pervasives.compare end) > > and > > include Set.S with type elt = int > > isn't too bad (except that you have to include IntSet.cmo/.cmx when > compiling, obviously) > > I agree, and someone might write an optimized version for ints or floats. But Xset & Xmap also provide opportunities to add some missing functions. In particular, I often use Sets or Maps as a good priority queue/heap substitute, and reverse_fold / reverse_iter come in handy. The only problem is that I have an allergy to CamlCaseIdentifiers but I'll just swallow some antiHistaminics. -- Berke DURAK