From: Chris Carter Date: 2007-06-13T23:53:36+09:00 Subject: Re: Passing block to Proc#call On 6/13/07, Jenda Krynicky wrote: > Chris Carter wrote: > > On 6/12/07, Jenda Krynicky wrote: > >> > end > >> Jenda > >> > >> -- > >> Posted via http://www.ruby-forum.com/. > >> > >> > > > > Hmm, well, it is a feature that most languages don't have in the first > > place, it exists in later versions of ruby, and I really wouldn't call > > currying "jumping through hoops", its a pretty common and easy thing > > to do... > > Beg your pardon? Where's there any currying in your code??? > Or does Ruby have its own definition of the term different from the one > everyone else uses? > > Jenda > > -- > Posted via http://www.ruby-forum.com/. > > It is essentially a curry that is called immediately. It expects the function in question to take a function as the last argument, and #bcall traps a block, and sets it as that last argument. The equivalent version that "actually curries" (returns a function) would be class Proc def bcurry(&blk) proc { |*args| self.call(*args.concat([*block]))} end end -- Chris Carter concentrationstudios.com brynmawrcs.com