⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Backport191
All Projects
Ruby
»
Backport191
Overview
Activity
Issues
Like
Download (381 Bytes)
Bug #1613
» closure_segfault.rb
RobertDober (Robert Dober)
, 06/12/2009 09:20 AM
#!/usr/local/bin/ruby -w
# encoding: utf-8
# file: /home/robert/log/ruby/tmp/closure_segfault.rb
module
Closing
cache
=
[
1
,
1
]
define_method
:fibo
do
|
n
|
return
cache
[
n
]
if
cache
[
n
]
(
fibo
(
n
.
pred
)
+
fibo
(
n
.
pred
.
pred
)).
tap
do
|
result
|
cache
[
n
]
=
result
end
end
end
include
Closing
puts
fibo
(
42
*
42
*
5
)
# vim: sts=2 sw=2 ft=ruby expandtab nu :
« Previous
1
2
Next »
(1-1/2)
Loading...