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 TAA08976; Fri, 23 Jul 2004 19:42:04 +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 TAA10252 for ; Fri, 23 Jul 2004 19:42:03 +0200 (MET DST) Received: from reformers.mr.itd.umich.edu (reformers.mr.itd.umich.edu [141.211.93.147]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i6NHg2SH030516 for ; Fri, 23 Jul 2004 19:42:02 +0200 Received: from ens-lyon.fr (posare.physics.lsa.umich.edu [141.211.97.44]) by reformers.mr.itd.umich.edu (smtp) with ESMTP id i6NHg15h020971 for ; Fri, 23 Jul 2004 13:42:01 -0400 Message-ID: <41014DE9.5020606@ens-lyon.fr> Date: Fri, 23 Jul 2004 13:42:01 -0400 From: Jean-Baptiste Rouquier User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.2) Gecko/20040301 X-Accept-Language: en-us, en MIME-Version: 1.0 To: caml-list@inria.fr Subject: Re: [Caml-list] Associativity precedence for the user-defined operator. References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 41014DEA.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; ens-lyon:01 caml-list:01 trento:99 sometype:01 printf:01 printf:01 val:01 htmlman:01 ocaml:01 caml:01 int:01 int:01 user-defined:02 wrote:03 let:04 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Claudio Trento wrote: >Hi, > >I've defined a set of new operetors, for instance: > >let ( /+/ ) = add_num (where add_num is a function that added two sometype > elements.) > >but I don't know if I can set associativity precedence for this operator, >writing: el1 ( /+/ ) el2 ( /+/ ) el3 without parenthesis, what happens? > The manual says that here you have left associativity. See http://caml.inria.fr/ocaml/htmlman/manual015.html. # let ( /+/ ) a b = Printf.printf "a=%i, b=%i\n%!" a b; a + b;; val ( /+/ ) : int -> int -> int = # let _ = 1 /+/ 2 /+/ 39;; a=1, b=2 a=3, b=39 - : int = 42 Cheers, Jean-Baptiste. ------------------- 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