open Printf (* open Infix *) let ( *< ) f g x = f (g x) let ( **< ) f g x = f (g x) let test1 f g = f *< g *< f *< g *< f *< g *< f *< g *< f *< g let test2 f g = f **< g **< f **< g **< f **< g **< f **< g **< f **< g let clock () = Unix.((times ()).tms_utime) let () = let t0 = clock () in let x = ref 0 in for i = 0 to 1000000 do x := test1 succ pred !x done; let t1 = clock () in for i = 0 to 1000000 do x := test2 succ pred !x done; let t2 = clock () in printf "Left associative: %g\nRight associative: %g\n" (t1 -. t0) (t2 -. t1)