From: Allen Lee Date: 2009-11-28T15:17:53+09:00 Subject: Re: closures --00504502b53546c19b0479685e7b Content-Type: text/plain; charset=ISO-8859-1 Hi Burlsm, I think the following is what you want: def make_adder(n) lambda { |x| x + n } end or the following new lambda syntax if you are using Ruby 1.9 or later: def make_adder(n) ->(x) { x + n } end Hope that helps. allenlooplee On Sat, Nov 28, 2009 at 2:10 PM, Burlsm wrote: > hi > > i'm having a little trouble with closures and i'd like to know what > the equivalent code for the canonical make-adder procedure would in > ruby, > > in scheme it would be like > > (define (make-adder n) > (lambda (x) (+ x n)) > > thanks in advance > > --00504502b53546c19b0479685e7b--