Browse thread
'a Set?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2005-01-26 (16:16) |
From: | Jacques Carette <carette@m...> |
Subject: | RE: [Caml-list] 'a Set? |
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