Version française
Home     About     Download     Resources     Contact us    
Browse thread
'a Set?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alex Baretta <alex@b...>
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

-- 
*********************************************************************
http://www.barettadeit.com/
Baretta DE&IT
A division of Baretta SRL

tel. +39 02 370 111 55
fax. +39 02 370 111 54

Our technology:

The Application System/Xcaml (AS/Xcaml)
<http://www.asxcaml.org/>

The FreerP Project
<http://www.freerp.org/>