From: Dustin Barker Date: 2008-06-11T08:15:51+09:00 Subject: Re: Basic Tree Data Structure On Jun 10, 2008, at 6:16 PM, Justin To wrote: > Your illustration definetely helps. I guess my ultimate confusion > comes > from the last two yields to e: > > > 1. yield e # node b got e='c', so yielding #yielding to t.teach? > 2. yield e # node a got e='c', so yielding ---------- yield value # node c is yielding 'c' ------ yield e # node b got e='c', so yielding 'c' to node a ---- yield e # node a got e='c', so yielding 'c' to t.each > > > For #1, e='c' so why doesn't it yield that 'c' to t.each and puts 'c' It does, but by way of node b and node a. So let's try with different code: def foo bar { |x| yield "foo #{x}" } end def bar baz { |x| yield "bar #{x}" } end def baz yield "baz" end foo { |x| puts x } output: foo bar baz > > > You've helped a lot and done all you could. It'll just be up to me to > try to wrap my mind around it. No problem - good luck! -Dustin