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.2 required=5.0 tests=AWL,SUBJECT_EXCESS_QP autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 48749BBAF for ; Thu, 29 May 2008 15:25:19 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmMIAItLPkhA6bjtaWdsb2JhbACSKQ0EAwQJDwUTlWOHHA X-IronPort-AV: E=Sophos;i="4.27,561,1204498800"; d="scan'208";a="13211700" Received: from concorde.inria.fr ([192.93.2.39]) by mail3-smtp-sop.national.inria.fr with ESMTP; 29 May 2008 15:25:19 +0200 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id m4TDPIhk026579 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Thu, 29 May 2008 15:25:18 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmMIAItLPkhA6bjtaWdsb2JhbACSKQ0EAwQJDwUTlWOHHA X-IronPort-AV: E=Sophos;i="4.27,561,1204498800"; d="scan'208";a="13211698" Received: from wr-out-0506.google.com ([64.233.184.237]) by mail3-smtp-sop.national.inria.fr with ESMTP; 29 May 2008 15:25:17 +0200 Received: by wr-out-0506.google.com with SMTP id c57so1965062wra.9 for ; Thu, 29 May 2008 06:25:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:reply-to:to:subject:date:user-agent:cc:references:in-reply-to:content-type:content-transfer-encoding:content-disposition:message-id; bh=QK1UEck+XThTrQidrZxR2ZKiyxtwRyQlb6w+qOjTEtc=; b=fauOugATYya6BSZV208gkgzQqzXMjsnukRyypw3ZAWEZv4cgGf78kUZtAkpuv+KOjpeS4RZa8gHOAvOlKQRGQaDMaXcnQqHnLI/z1mxqJywsr0PlwybfIWKEWDShi0J2D3hxIr2JCqoSBHPcD/K/PN+rRJdkUra5Y6yV8+FKHHs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:reply-to:to:subject:date:user-agent:cc:references:in-reply-to:content-type:content-transfer-encoding:content-disposition:message-id; b=IDeCGU8+oMs+FGt2ZDSwr+vIv8n+cPnPhDZwriq+J6eSxEozSnoaIyGLi5oejJF0Yn8Ciicq8T5hEJeTPyPsz0ElPZBmabbi4AbFp2zc6l57DDeYn+0sMR3LdoUZNQm/IXr/51nO1hYpYeLHqtgJURZ84W4VElgnZREQs5Yuxbc= Received: by 10.90.97.18 with SMTP id u18mr5340286agb.8.1212067516848; Thu, 29 May 2008 06:25:16 -0700 (PDT) Received: from ?192.168.0.103? ( [24.99.180.210]) by mx.google.com with ESMTPS id n26sm1236503ele.13.2008.05.29.06.25.14 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 29 May 2008 06:25:15 -0700 (PDT) From: Peng Zang Reply-To: peng.zang@gmail.com To: Christophe Raffalli Subject: Re: [Caml-list] on objects,=?iso-8859-1?q?=09equality_and_playing_nicely_with_the?= stdlib Date: Thu, 29 May 2008 09:25:11 -0400 User-Agent: KMail/1.9.7 Cc: caml-list References: <200805290050.36980.peng.zang@gmail.com> <200805290813.18027.jon@ffconsultancy.com> <483E65A0.3060405@univ-savoie.fr> In-Reply-To: <483E65A0.3060405@univ-savoie.fr> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200805290925.14135.peng.zang@gmail.com> X-Miltered: at concorde with ID 483EAEBE.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; stdlib:01 hash:01 christophe:01 raffalli:01 functor:01 syntax:01 val:01 val:01 hash:01 christophe:01 peng:98 peng:98 equality:01 polymorphic:01 wrote:01 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thursday 29 May 2008 04:13:20 am Christophe Raffalli wrote: > Via Custom block (section 18.9.1 of the manual), you could create a functor > with the following shape (I did not check my syntax): > > module type Quotient = > type t > type qt > val class : t -> qt > val get_representent : qt -> t > end > > module type Equivalence = > type t > val compare : t -> t -> int > end > > module Make_Quotient (R : Equivalence) : Quotient with type t = R.t > > Such that (class x) builds a custom block with > the given compare as comparison function ... > You can add hash and serialization to the Equivalence type too ... > > It is a pity we have to do that from C, this should be the default way > to bridge the gap between polymorphic comparison and specific comparison. > (and PML will provide a buildin class constructor in the near future). > > Hope this helps, > Christophe This is very interesting. I've never read that part of the manual. It's probably too much overhead for me, so I'll resort to cut + paste first and see how it goes. Thanks, Peng -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.7 (GNU/Linux) iD8DBQFIPq66fIRcEFL/JewRAh2mAKCjCBE3OLYeAudddf5qCoF5jtKmLgCfTRWP Q5xoPoXccaD512zj99mDs7Q= =X2pn -----END PGP SIGNATURE-----