Debian Codegraph @

doc/examples/profiling/list-rev.sml

raw
1 fun append (l1, l2) =
2 case l1 of
3 [] => l2
4 | x :: l1 => x :: append (l1, l2)
5
6 fun rev l =
7 case l of
8 [] => []
9 | x :: l => append (rev l, [x])
10
11 val l = List.tabulate (1000, fn i => i)
12 val _ = 1 + hd (rev l)