From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 168B2BB91 for ; Wed, 26 Jan 2005 17:16:43 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j0QGGg6Y030357 for ; Wed, 26 Jan 2005 17:16:42 +0100 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 RAA13743 for ; Wed, 26 Jan 2005 17:16:42 +0100 (MET) Received: from cgpsrv2.cis.mcmaster.ca (univmail.CIS.McMaster.CA [130.113.64.46]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j0QGGf88026498 for ; Wed, 26 Jan 2005 17:16:41 +0100 Received: from [130.113.68.27] (account carette@univmail.cis.mcmaster.ca HELO pccarettej) by cgpsrv2.cis.mcmaster.ca (CommuniGate Pro SMTP 4.1.8) with ESMTP id 80626093; Wed, 26 Jan 2005 11:16:40 -0500 Reply-To: From: "Jacques Carette" To: "'Alex Baretta'" , Subject: RE: [Caml-list] 'a Set? Date: Wed, 26 Jan 2005 11:14:48 -0500 Organization: McMaster University Message-ID: <003e01c503c2$28868350$1b447182@cas.mcmaster.ca> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 In-Reply-To: <41F7BE8F.5090101@barettadeit.com> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Miltered: at concorde with ID 41F7C26A.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 41F7C269.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 haskell:01 surprising:01 pervasives:01 baretta:01 caml-list:01 wrote:01 semantics:01 hashtbl:01 trivial:01 printf:01 kprintf:01 failwith:01 26,:98 exception:01 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: This (~%) operator is called 'flip' in Haskell, and it is used there all = the time. It is kind-of surprising that flip is not in Pervasives [as has = been mentionned before http://caml.inria.fr/archives/200106/msg00093.html]. Jacques -----Original Message----- From: caml-list-admin@yquem.inria.fr = [mailto:caml-list-admin@yquem.inria.fr] On Behalf Of Alex Baretta Sent: January 26, 2005 11:00 AM To: caml-list@inria.fr Subject: Re: [Caml-list] 'a Set? Jacques Garrigue wrote: > From: Radu Grigore > If you respect this convention, the type tells you about the semantics > :-) There are two different patterns for function signatures: the Hashtbl=20 pattern and the Map pattern. Both are "good", depending on the context.=20 Since I need both approaches I have come up with a little trick to get=20 the best of both worlds. # let (~%) f =3D fun x y -> f y x The ~% operator swaps the first and the second parameter in a function=20 call. The following is a trivial example of its use. # ~% Printf.kprintf "Hello %s!" failwith "World";; Exception: Failure "Hello World!". Alex