Version française
Home     About     Download     Resources     Contact us    
Browse thread
ocaml prefix syntax
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Pierre Weis <Pierre.Weis@i...>
Subject: Re: ocaml prefix syntax
> CAML allows me to define the following prefix identifier:
> 
> let prefix !~ = ....
> 
> Objective CAML documentation says it allows ! (and ? and ~) as prefix
> operators, too, but I get "Characters 11-13: Syntax error" when I try.
> How do I use prefix characters in OCAML?
> 
> Trent
> 
> (Apologies for no French.)

You should enclose your infix operator into parens, instead of using
the prefix keyword:

#  let (!~) x = x + 1;;
val !~ : int -> int = <fun>

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/