From: Jean-Hugues ROBERT Date: 2002-06-18T06:13:53+09:00 Subject: Re: yield and recursion, how to ? Thanks Guy, that works for me. I forgot about the last block parameter being treated as a list if there is more actual actual parameters than formal ones. Very convenient indeed. Thanks very much. Jean-Hugues At 01:22 18/06/2002 +0900, you wrote: > >>>>> "J" == Jean-Hugues ROBERT writes: > > Well, I've not understood what you want to do but I'll write something > like this > > >J> def each( block = nil, &syntax_block ) >J> block ||= syntax_block >J> block.call( self, @children.length()) >J> @children.each do |x| >J> x.each block >J> end >J> end > > def each > yield self, @children.size > @children.each do |x| > x.each do |y| > yield y > end > end > end > > >Guy Decoux ------------------------------------------------------------------------- Web: http://hdl.handle.net/1030.37/1.1 Phone: +33 (0) 4 92 27 74 17