Version franaise
Home About Download Resources Contact us
Browse thread
right-associating infix application operator camlp4 extension
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: osiire@k...
Subject: Re: [Caml-list] right-associating infix application operator camlp4 extension

Hi.

On Sat, 6 Aug 2005 16:03:55 -0700
In <7B0AADBE-23D8-4C63-ABE7-75360C874E13@lrde.epita.fr>
Quc Peyrot <chojin@lrde.epita.fr> wrote:
> Is there any existing camlp4 extensions to define a $ haskell-like  
> operator?

Maybe "@" and "^" are right-associated.

# let ( ^$ ) f x = f x;;
val ( ^$ ) : ('a -> 'b) -> 'a -> 'b = <fun>
# print_string ^$ List.fold_left (fun x sum -> sum ^ x) "" ^$ ["1";"2";"3"];;
321- : unit = ()

# let ( @$ )  f x = f x;;
val ( @$ ) : ('a -> 'b) -> 'a -> 'b = <fun>
#  print_string @$ List.fold_left (fun x sum -> sum ^ x) "" @$ ["1";"2";"3"];;
321- : unit = ()

---
 osiire