repo.or.cz
/
jruby.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Fix for JRUBY-2882. Handle error messages related to constructors better
[jruby.git]
/
bench
/
shootout
/
message.jruby-2.jruby
blob
76c37bcd13135b2c3deca551ff6e508fe3d52420
1
#!/usr/bin/env ruby
2
#
3
# Gonzalo Garramuno -- Dec.31 2006
4
#
5
6
def
coroutine
(
n
)
7
if
n
>
1
8
coroutine
(
n-1
) { |
x
|
yield
x
+
1
}
9
else
10
yield
1
while true
11
end
12
end
13
14
iter
=
0
15
last
=
ARGV
[
0
].
to_i
16
count
=
0
17
18
coroutine
(
500
) { |
x
|
19
break if
iter
>=
last
20
count
+=
x
21
iter
+=
1
22
}
23
24
puts count