1 datatype t
= Z | S
of t
;
5 val rec add
: t
* t
-> t
= fn (Z
, n
) => n |
(S m
, n
) => S (add (m
, n
));
6 val rec mul
: t
* t
-> t
= fn (Z
, n
) => Z |
(S z
, n
) => add (n
, mul (z
, n
));
7 val four
= mul (two
, two
);
8 val rec exp
: t
* t
-> t
= fn (n
, Z
) => one |
(n
, S m
) => mul (n
, exp (n
, m
));
9 val _
= exp (exp (four
, four
), two
);