Project

General

Profile

Bug #7212 ยป recursive.rb

fiddur (Fredrik Liljegren), 10/24/2012 11:21 PM

 
1
def recursive(level = 0)
2
  -> do
3
    p "In block #{level}"
4
    if level < 1000
5
      subblock = recursive(level + 1)
6
      subblock.call
7
    end
8
  end
9
end
10

    
11
p "Doing recursive call in a fiber"
12
Fiber.new { recursive.call }.resume