Import Upstream version 20180207
[hcoop/debian/mlton.git] / benchmark / tests / vector32-concat.sml
1 (* Written by Stephen Weeks (sweeks@sweeks.com). *)
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