Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Specifying precedence ...
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Andrzej M. Ostruszka <ostruszk@o...>
Subject: [Caml-list] Specifying precedence ...
Hello,

Is it possible to specify precedence of an "operator"?
E.g. if I have something like

let (^^) x y =
  let rec pow res y p =
    if y = 0 then res
    else
      let newres = if y land 1 <> 0 then res * p else res in
      pow newres (y lsr 1) (p*p)
  in
    pow 1 y x

then I'd like to evaluate 2*3^^2 to 18 (not 36).

						Best regards
-- 
    ____   _  ___
   /  | \_/ |/ _ \		Andrzej Marek Ostruszka
  / _ |     | (_) | Instytut Fizyki, Uniwersytet Jagiellonski (Cracow)
 /_/ L|_|V|_|\___/	(PGP <-- finger ostruszk@order.if.uj.edu.pl)
-------------------
To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr