Import Upstream version 20180207
[hcoop/debian/mlton.git] / regression / unary.2.sml
CommitLineData
7f918cf1
CE
1datatype num = Z | S of num
2
3val rec plus =
4 fn (n, Z) => n
5 | (n, S m) => S (plus (n,m))
6
7val rec times =
8 fn (_, Z) => Z
9 | (n, S m) => plus (n, times (n,m))
10
11val rec fact =
12 fn Z => S Z
13 | n as S m => times (n, fact m)
14
15val x = fact (S (S (S Z)))
16