That implementation has a few drawbacks: it allocates a vector of indices
the length of what it's iterating over; it has to know in advance how long
what it's iterating over is; it is more complicated, leading to more
complex machine code.

On Wed, Apr 8, 2015 at 4:51 AM, Jinxuan Zhu <[email protected]> wrote:

> Recently, I am interested about the two functions enumerate(iter) and
> zip(iter).  So I read the iterator.jl and find they are realized by
> different Types.  I thought the enumerate was an alias like
> zip([1:length(a)], a), however it is not.
>
> I am curious that why the two functions are realized by two different
> types. What difference between the type Zip2 and Enumerate do make the
> design an advantage?
>
> Thank you.
>
> Regards,
> Jinxuan Zhu([email protected])
>

Reply via email to