From: transfire@... Date: 2006-07-21T08:32:28+09:00 Subject: Re: Using .each with constructors Robert Dober wrote: > I prefer to write > > class Class > def *(num) > a = [] > num.times do > a << new > end > a > end > end Hmm...It's too bad that #times below returns 3. It be pretty neat if it acted like #map in this respect instead. 3.times { Object.new } Also ([lambda{Object.new}]*3).collect{|c| c.call } and Robert's solution lead me too: class Proc def *(i) a = [] i.times{ a << call } a end end lambda{ Object.new } * 3 Which is pretty versitle. Unforunately I already have Proc#* tied up with function composition. T.