From: Matt Maycock Date: 2004-08-07T01:04:12+09:00 Subject: Re: procs/blocks - blocks with procs, blocks with blocks? > If I understand what you're trying to do, the latest (CVS) ruby allows > blocks to take blocks. > > irb(main):001:0> lammy = lambda{|&b| b.call} > => # > irb(main):002:0> lammy.call{10} > => 10 > irb(main):003:0> Neato! > I don't know if it will change or not. I'm somewhat impartial to it, > though. I always thought the rationale for Proc#[] was not for saving > keystrokes, nor for kludging a #() operator, but rather to allow a > compact representation of a procedurally generated collection. E.g., > instead of explicitly using an array of the numbers [0, 2, 4, ..., > something_big], you can just use lambda{|x| 2*x}. These sorts of uses > generally have no business taking blocks. > > I could of course be wrong, though. I could imagine some uses for it taking a block... like the block being a test for whether to use the current attempted return value, or try to generate another...