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=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 3E803BBC1 for ; Wed, 23 Apr 2008 15:25:46 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqEAAEjWDkhCm3xrnWdsb2JhbACRUgEBAQEBCA4Hm3g X-IronPort-AV: E=Sophos;i="4.25,698,1199660400"; d="scan'208";a="11327995" Received: from janestcapital.com (HELO smtp.janestcapital.com) ([66.155.124.107]) by mail1-smtp-roc.national.inria.fr with ESMTP; 23 Apr 2008 15:25:45 +0200 Received: from [172.25.129.161] [38.105.200.250] by janestcapital.com with ESMTP (SMTPD-9.10) id A8D702A8; Wed, 23 Apr 2008 09:25:43 -0400 Message-ID: <480F38D7.4050503@janestcapital.com> Date: Wed, 23 Apr 2008 09:25:43 -0400 From: Brian Hurt User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jon Harrop Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Announce: xsetxmap, unfunctorized, Sexp-lib aware versions of Set and Map References: <480C60DF.9010000@exalead.com> <480C739F.5080104@lri.fr> <200804231335.25708.jon@ffconsultancy.com> In-Reply-To: <200804231335.25708.jon@ffconsultancy.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; integers:01 functors:01 functors:01 char:01 imho:01 wrote:01 ints:01 caml-list:01 int:01 int:01 modules:02 modules:02 string:02 defining:02 module:03 Jon Harrop wrote: >Actually I would say that your style is more useful than the built-in Set and >Map modules because you don't have to jump through hoops defining your >own "Int" module with its own "int" type and its own comparison function over >ints every time you want a set of integers. I would put the comparison >function in the set itself though. > > > IMHO, the Int module should be in the standard library, and the Set and Map modules should have already instantiated sets and maps for the standard base types (int, float, string, char). Also, I'm not as down on functors as a lot of programmers seem to be. While not perfect, they solve a number of problems very well. For example, there are a number of operations on sets and maps which are O(N) if and only if you know the two trees are in the same order, but O(N log N) if you don't know they're in the same order. Functors lift this check into the type system. Brian