Hi, At Mon, 4 Jun 2007 13:25:50 +0900, david karapetyan wrote in [ruby-talk:254219]: > thanks. i didn't realize i had to provide the block as well when i was > creating the closure. i was hoping for a closure that could take a different > block every time. i wanted fib to be a function that had access to a and b > and every call to fib would require a block. as it is fib has its block > fixed at creation time. do you know of a way of doing what i wanted to do > originally? You need ruby 1.9. Block passing to a block isn't supported in 1.8. def fibber a = 1 b = 1 lambda do |&block| block.call(a) a,b = a+b,a end end irb(main):010:0> fib = fibber => #<Proc:b7ba2338@(irb):6> irb(main):011:0> 10.times {fib.call {|x|p x}} 1 2 3 5 8 13 21 34 55 89 => 10 -- Nobu Nakada