Calculemus


Time Module

Timing: useful for documentation but not logically necessary.

Functions and values

Function or value Description

time f x

Full Usage: time f x

Parameters:
    f : 'a -> 'b - The input function.
    x : 'a - The input argument for the function.

Returns: 'b The application f x plus the CPU time taken to evaluate it.

Report CPU time taken by a function.

A call time f x will evaluate f x as usual, but will also print the CPU time taken by that function evaluation.

Never fails in itself, though it propagates any exception generated by the call f x itself.

f : 'a -> 'b

The input function.

x : 'a

The input argument for the function.

Returns: 'b

The application f x plus the CPU time taken to evaluate it.

Example

 time tab p38
Evaluates to:
 Searching with depth limit 0
 Searching with depth limit 1
 Searching with depth limit 2
 Searching with depth limit 3
 Searching with depth limit 4
 CPU time (user): 0.088133