Function
Shell.Timer
val printTiming: {function: 'a -> 'b, name: string, outputter: string -> unit} -> 'a -> 'b
Syntax
printTiming {function=f, name=n, outputter=o} a -> g
This function returns the value of f applied to a, and as a side effect it prints the time taken to evaluate the expression.
Define the following function:
fun g x = let fun f 0 _ = () | f n m = (f m 0; f (n-1) m) in f x x end;
Below is an example of applying printTiming to g with an argument of 1000: