On Fri, 17 Nov 2000, Yukihiro Matsumoto wrote:

> Hi,
> 
> In message "[ruby-talk:6401] Array.fill with block?"
>     on 00/11/17, Hugh Sasse Staff Elec Eng <hgs / dmu.ac.uk> writes:
> |
> |Does anyone else think that it might be a good idea for Array.fill to take
> |a block to compute the value for each successive element?  I'm thinking
> |that it might be faster/more efficient than Array.collect! because it need
> |not pass in the value each time. It could pass in the index number,
> |perhaps.
> 
> You mean that Array#fill with a block should be faster since it
> doesn't have to retrieve the element?  I don't think so.  Retrieving
> an array element in this case costs only a few machine instructions
> for each element, I believe.

For large arrays it adds up...  Well, I just wondered if it was worth
considering, and because it would be a bit more orthoganal -- lots
of iterators can take blocks, but Array.fill doesn't.  I was a bit
surprised.  I can live with collect! though.  
> 
> 							matz.
> 
> 
	Hugh