Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] operators: compose and Haskell's $ operator
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Brian Rogoff <bpr@b...>
Subject: Re: [Caml-list] operators: compose and Haskell's $ operator
On Wed, 25 Apr 2001, Charles Martin wrote:
> At 05:57 PM 4/25/01 -0700, you wrote:
> >On Wed, 25 Apr 2001, Charles Martin wrote:
> >>equivalent for the $ operator eludes me, as it needs to be right
> >>associative and of low precedence.
> >
> ># let ( <-> ) f x = f x;;
> >val ( <-> ) : ('a -> 'b) -> 'a -> 'b = <fun>
> 
> Unfortunately, this is left-associative:

Oops, you're right of course. Given that there seems to be no solution, I
guess a little extra parenthesization is your only "pure OCaml option" option. 

I've only seen the $ used heavily in code that uses the do notation, where 
OCaml might use (gasp!) imperative code with ;, so I've never been tempted 
to write a syntax extension for this. 

-- Brian


-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr