Solution
= Solution
A <Standard ML> length function visits each list constructor once:
``
sml
fun length [] = 0
| length (_ :: xs) = 1 + length xs;
``
Writing $T(n)$ for its <time complexity>, $T(n)=T(n-1)+\Theta(1)$ and $T(0)=\Theta(1)$. Thus \b[$T(n)=\Theta(n)$]. Arithmetic is treated as unit cost; the example concerns list traversal rather than arbitrary-precision arithmetic.