Commit | Line | Data |
---|---|---|
7f918cf1 CE |
1 | structure F = MLton.Finalizable |
2 | ||
3 | fun loop (n, f) = | |
4 | if n = 0 | |
5 | then () | |
6 | else | |
7 | let | |
8 | val f' = F.new n | |
9 | val _ = F.addFinalizer (f', fn _ => | |
10 | F.withValue | |
11 | (f, fn n => | |
12 | print (concat [Int.toString n, "\n"]))) | |
13 | in | |
14 | loop (n - 1, f') | |
15 | end | |
16 | ||
17 | val r = loop (10, F.new 13) | |
18 |