Import Upstream version 20180207
[hcoop/debian/mlton.git] / regression / kitdangle.sml
1 (*kitdangle.sml*)
2
3 infix - + :: =
4 (*fun op = (x: ''a, y: ''a): bool = prim ("=", "=", (x, y)) *)
5
6 exception Hd
7 fun hd (x::l) = x
8 | hd [] = raise Hd
9
10 fun mklist 0 = []
11 | mklist n = n :: mklist(n-1)
12
13 fun cycle(p as (m,f)) =
14 if m=0 then p
15 else cycle(m-1, let val x = [(m, mklist 2000)]
16 in fn () => #1(hd x) + f()
17 end)
18
19 val r = cycle(1000, fn() => 0);