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