Lazy expressions are expressions that are not evaluated immediately but are evaluated when the result is needed.
The basic syntax of the laze expressions is as follows.
let identifier = lazy ( expression )
expressionis a code that is evaluated only when a result is required, and
identifieris a value that stores the result.
Lazy<'T>, where the actual type used for
'Tis determined from the result of the expression.
To force the expressions to be performed, you will need to call the
Forcemethod causes the execution to be performed only one time.
Forcereturn the same result but do not execute any code.
The following example shows the usage of lazy expressions and the use of the
let input = 39.6 let result = lazy (input * 10.0/12.0) printfn "%f" (result.Force())
In the above code, the type of result is
Lazy<float>, and the
Force method returns a