
4.6 Timing: the Timer structure
Shell.Timer
val printTiming: {function: 'a -> 'b, name: string,
stream: MLWorks.IO.outstream} -> 'a -> 'b
printTiming {function=f, name=n, stream=MLWorks.IO.outstream} a -> g
fun g x = let
fun f 0 _ = ()
| f n m = (f m 0; f (n-1) m)
in f x x
end;
printTiming to g with an argument of 1000:
MLWorks>printTiming {function =g,
name="hello",
stream=MLWorks.IO.std_out} 1000;
Time for hello : 0.54 (user: 0.49, system: 0.00, gc: 0.00)
val it : unit = ()
MLWorks>

Generated with Harlequin WebMaker