HCoop
/
hcoop
/
debian
/
mlton.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
Import Upstream version 20180207
[hcoop/debian/mlton.git]
/
benchmark
/
tests
/
imp-for.sml
1
2
fun
for
(
start
,
stop
,
f
)
3
=
let
4
val
i
=
ref start
5
fun
loop
() =
if
!
i
>=
stop
6
then
()
7
else
(
f
(!
i
) ;
i
:= !
i
+
1
;
loop
())
8
in
9
loop
()
10
end
11
12
structure
Main
=
13
struct
14
fun
doit
()
15
=
let
16
val
x
=
ref
0
17
18
val
_
=
for
(
0
,
10
,
fn
_
=>
19
for
(
0
,
10
,
fn
_
=>
20
for
(
0
,
10
,
fn
_
=>
21
for
(
0
,
10
,
fn
_
=>
22
for
(
0
,
10
,
fn
_
=>
23
for
(
0
,
10
,
fn
_
=>
24
for
(
0
,
10
,
fn
_
=>
25
x
:= !
x
+
1
)))))))
26
in
27
if
(!
x
) <>
10000000
28
then raise
Fail
"bug"
29
else
()
30
end
31
val
doit
=
fn
size
=>
for
(
0
,
size
,
fn
_
=>
doit
())
32
end