On Thu, Aug 12, 2010 at 10:49 AM, Brian Candler <b.candler / pobox.com> wrote=
:
> Jes=FAs Gabriel y Gal=E1n wrote:
>> But you still need the outer iteration. If I'm already iterating with
>> #each, I change it to map to do both things at the same time :-)
>
> Of course. But for a newcomer to ruby (who is still using 'for' instead
> of 'each'), it may be easier to take one step at a time along the road
> to enlightenment.

Yes, you are right.


>
> Step 1:
>
> threads =3D []
> for page in str
> =A0threads << Thread.new do
> =A0 =A0...
> =A0end
> end
>
> Step 2:
>
> threads =3D []
> str.each do |page|
> =A0threads << Thread.new do
> =A0 =A0...
> =A0end
> end
>
> Step 3:
>
> threads =3D str.map do |page|
> =A0Thread.new do
> =A0 =A0...
> =A0end
> end