Factorial, Twice
Implement the functions
val fact_dir : int -> int val fact_tr : int -> int
so that fact_dir n and fact_tr n are \(n!\), but fact_dir is
implemented directly, i.e., using the definition
\[ n ! = \begin{cases} 1 & n = 0 \\ n \times (n - 1)! & \text{n > 0} \end{cases} \]
and fact_tr is implemented tail recursively.
Examples
let _ = assert (fact_dir 5 = 120) let _ = assert (fact_tr 5 = 120)