From: James Edward Gray II Date: 2007-05-02T22:57:07+09:00 Subject: Re: [QUIZ][SOLUTION] Checking Credit Cards (#122) On Apr 29, 2007, at 1:17 PM, Brad Ediger wrote: > # Maps n-at-a-time (n = arity of given block) and collects the > results > def mapn(&b) > r = [] > each_slice(b.arity) {|*args| r << b.call(*args) } > r > end That's pretty darn clever. You can collapse it to one line with inject() of course: def mapn(&b) enum_slice(b.arity).inject([]) {|r, args| r << b.call(*args) } end James Edward Gray II