caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Jacques Carette" <carette@mcmaster.ca>
To: "'Alex Baretta'" <alex@barettadeit.com>, <caml-list@inria.fr>
Subject: RE: [Caml-list] 'a Set?
Date: Wed, 26 Jan 2005 11:14:48 -0500	[thread overview]
Message-ID: <003e01c503c2$28868350$1b447182@cas.mcmaster.ca> (raw)
In-Reply-To: <41F7BE8F.5090101@barettadeit.com>

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 <radugrigore@gmail.com>

> If you respect this convention, the type tells you about the semantics
> :-)

There are two different patterns for function signatures: the Hashtbl 
pattern and the Map pattern. Both are "good", depending on the context. 
Since I need both approaches I have come up with a little trick to get 
the best of both worlds.

# let (~%) f = fun x y -> f y x

The ~% operator swaps the first and the second parameter in a function 
call. The following is a trivial example of its use.

# ~% Printf.kprintf "Hello %s!" failwith "World";;
Exception: Failure "Hello World!".

Alex


  reply	other threads:[~2005-01-26 16:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-25 23:54 Mike Hamburg
2005-01-26  8:25 ` [Caml-list] " Jean-Christophe Filliatre
2005-01-26 10:13   ` Frédéric Gava
2005-01-26 11:04     ` Radu Grigore
2005-01-26 12:04       ` Jacques Garrigue
2005-01-26 16:00         ` Alex Baretta
2005-01-26 16:14           ` Jacques Carette [this message]
2005-01-26 21:09           ` Mike Hamburg
2005-01-29  9:55         ` Radu Grigore
2005-01-26  9:13 ` Jon Harrop
2005-01-26 15:36   ` Frédéric Gava
2005-01-26 16:06     ` Jon Harrop

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='003e01c503c2$28868350$1b447182@cas.mcmaster.ca' \
    --to=carette@mcmaster.ca \
    --cc=alex@barettadeit.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).