Import Upstream version 20180207
[hcoop/debian/mlton.git] / regression / kitdangle3.sml
1 (*kitdangle3.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,
16 let val x = [(m, mklist 2000)]
17 in fn () => #1(hd x) + f()
18 end)
19
20 val r = ((cycle(1000, fn() => 0);()),
21 (cycle(1000, fn() => 0);()),
22 (cycle(1000, fn() => 0);()))