Browse thread
[Caml-list] infix precedence
[
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: | 2002-05-28 (15:53) |
From: | Remi VANICAT <vanicat@l...> |
Subject: | Re: [Caml-list] infix precedence |
dengping zhu <zhudp@cs.bu.edu> writes: > Hi, all, I have a question about the precedence of infix in ocaml. > I define a few infixes as follow: > > let (^^) x y = ... > let (^+) x y = ... > let (^<) x y = ... > > Now how can I define the precedence of them? At first, I want to use > brackets to solve it, but later I find out it is almost impossible because > there are a lot of recursive functions and combination of these infixes. > > Can you give me any idea? yes, the precedence of an infix in ocaml is driven by its first letter, so : let (^^) x y = ... let (+^) x y = ... let (<^) x y = ... will make ^^ have the same precedence than ^, +^ have the same precedence than + and so one. otherwise, camlp4 is the only solution. -- Rémi Vanicat vanicat@labri.u-bordeaux.fr http://dept-info.labri.u-bordeaux.fr/~vanicat ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners