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 VAA14244; Fri, 23 Jul 2004 21:52:18 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA14419 for ; Fri, 23 Jul 2004 21:52:17 +0200 (MET DST) Received: from mproxy.gmail.com (rproxy.gmail.com [64.233.170.201]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i6NJqFEV010513 for ; Fri, 23 Jul 2004 21:52:16 +0200 Received: by mproxy.gmail.com with SMTP id 74so32184rnk for ; Fri, 23 Jul 2004 12:52:15 -0700 (PDT) Received: by 10.38.5.73 with SMTP id 73mr68904rne; Fri, 23 Jul 2004 12:52:15 -0700 (PDT) Message-ID: Date: Fri, 23 Jul 2004 15:52:15 -0400 From: John Prevost To: Ocaml Mailing List Subject: Re: [Caml-list] Associativity precedence for the user-defined operator. In-Reply-To: <41014DE9.5020606@ens-lyon.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <41014DE9.5020606@ens-lyon.fr> X-Miltered: at nez-perce with ID 41016C6F.003 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; prevost:01 prevost:01 caml-list:01 camlp:01 user-defined:02 o'caml:02 interaction:05 probably:05 mixing:07 defined:07 followed:92 mesh:91 strange:09 john:09 john:09 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk In general, the associativity and precedence of an operator (unless you go out to camlp4 or something) is based on the operator's first character. For example +/ would act like +, */ would act like *, and so on. For this reason, you'll often see O'Caml operators defined as "basic operator followed by some strange symbol." In your add_num case, +/ and friends would probably mesh well. Then you also get the expected interaction when mixing +/ and */. John. ------------------- 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