2 * This example tests for a bug that was
in refFlatten at one point
. The idea
3 * is to allocate a ref cell outside a loop
, and then allocate a tuple containing
4 * the ref cell at each iteration
of the loop
. At one point
, refFlatten
5 * mistakenly flattened the ref cell
, which meant that it wasn
't shared across
6 * all the tuples allocated
in the loop
, as it should have been
.
14 val l
= List.tabulate (10, fn i
=> (r
, ref i
))
15 val (r1
, r2
) = List.nth (l
, 0)
17 val (r1
, _
) = List.nth (l
, 1)
18 val () = print (concat
[Int.toString (!r1
), "\n"])