benchmark/tests/vector32-concat.sml
raw| 1 | (* Written by Stephen Weeks ([email protected]). *) |
| 2 | |
| 3 | structure Main = |
| 4 | struct |
| 5 | fun doit n = |
| 6 | let |
| 7 | val len = 20000 |
| 8 | val sum = Int32.fromInt (len * (len - 1)) |
| 9 | val v = Vector.tabulate (len, fn i => Int32.fromInt i) |
| 10 | fun loop n = |
| 11 | if n < 0 |
| 12 | then () |
| 13 | else |
| 14 | if sum = Vector.foldl (op +) 0 (Vector.concat [v, v]) |
| 15 | then loop (n - 1) |
| 16 | else raise Fail "bug" |
| 17 | in loop (n * 10000) |
| 18 | end |
| 19 | end |