From: ara.t.howard@... Date: 2006-08-25T02:56:12+09:00 Subject: Re: do not understand this closure On Fri, 25 Aug 2006, Dave Rose wrote: > in The Ruby Way...chap 1...a crude example of closure doesn't work as > this irb > session: >>> def power(exponent) >>> proc {|base| base**exponent} >>> end > => nil >>> square = power(2) > => # >>> cube = power(3) > => # >>> p square > # > => nil >>> square(11) > NoMethodError: undefined method `square' for main:Object > from (irb):7 >>> a=square(11) >>> a=square[11] ^ ^ ^ ^ ^ ^ ^ ^ -a -- to foster inner awareness, introspection, and reasoning is more efficient than meditation and prayer. - h.h. the 14th dali lama