[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Is iterating in lock-step possible?

George Ogata

3/10/2005 5:37:00 PM

William Morgan <wmorgan-ruby-talk@masanjin.net> writes:

>> In my post, I chose the array.each only as an example. Its not arrays
>> for which I want to do this with - I want to solve the problem for
>> iterator calls. If zip() internally creates a list of values from both
>> iterations, then it does not help me. I want to be able to do the actual
>> computation of the iterator calls in lock-step.
>
> Enum#zip internally turns everything into arrays.

Actually, only the arguments are converted; the receiving object is
iterated over using #each (or for Array, a standard C array
iteration). So, if only one list must not be converted to an array,
just call #zip on that list.



1 Answer

William Morgan

3/10/2005 7:07:00 PM

0

Excerpts from George Ogata's mail of 10 Mar 2005 (EST):
> Actually, only the arguments are converted; the receiving object is
> iterated over using #each (or for Array, a standard C array
> iteration). So, if only one list must not be converted to an array,
> just call #zip on that list.

Oh, you're right. Thanks.

I think it still doesn't solve the original poster's problem, though.

--
William <wmorgan-ruby-talk@masanjin.net>