From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA19171; Tue, 28 May 2002 17:53:06 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA19007 for ; Tue, 28 May 2002 17:53:05 +0200 (MET DST) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from mel-rto3.wanadoo.fr (smtp-out-3.wanadoo.fr [193.252.19.233]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g4SFr4v20430 for ; Tue, 28 May 2002 17:53:04 +0200 (MET DST) Received: from mel-rta8.wanadoo.fr (193.252.19.79) by mel-rto3.wanadoo.fr (6.5.007) id 3CF1FAB000117614 for caml-list@inria.fr; Tue, 28 May 2002 17:53:04 +0200 Received: from debian (80.8.82.105) by mel-rta8.wanadoo.fr (6.5.007) id 3CEE106500240E07 for caml-list@inria.fr; Tue, 28 May 2002 17:53:04 +0200 Received: from moi by debian with local (Exim 3.35 #1 (Debian)) id 17CjIp-0001Ix-00 for ; Tue, 28 May 2002 17:54:27 +0200 To: caml-list@inria.fr Subject: Re: [Caml-list] infix precedence References: From: Remi VANICAT Date: Tue, 28 May 2002 17:54:27 +0200 In-Reply-To: (dengping zhu's message of "Tue, 28 May 2002 11:42:27 -0400 (EDT)") Message-ID: <8766181d58.dlv@wanadoo.fr> User-Agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2 (i386-debian-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk dengping zhu 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