how would i break it down to two functions?

example:
>> inc = lambda {|n|n+=1}
 => #<Proc:0x00000100926318@(irb):23 (lambda)>

>> counter = lambda {n=1; n=inc.call(n)}.call(&inc)
=> 2

>> counter[]
ArgumentError: wrong number of arguments(0 for 1)


On Tue, Apr 19, 2011 at 3:15 AM, Brian Candler <b.candler / pobox.com> wrote:

> Brian Candler wrote in post #993704:
> > And you can do the same without explicitly binding 'counter_maker'
> > either:
> >
> > c = lambda { |init| lambda { init += 1 } }.call(200)
> > c.call  # 201
> > c.call  # 202
>
> Which of course simplifies to:
>
> c = lambda { init = 200; lambda { init += 1 } }.call
> c.call  # 201
> c.call  # 202
>
>