Exception handling vs. hasNext()
Kris Kowal
kris.kowal at gmail.com
Sat Nov 17 00:31:15 PST 2007
> /* an indefinite iteration of the values in someArray that are at
> indicies that are multiples of six */
> var it = range(100).eachIter(function (n) n * 2).whereIter(function
> (n) !(n % 3)).eachIter(function (i) someArray[i]).each(log)
>
> In that particular example, the last each on the line would catch the
> StopIteration thrown by Range.next when it reaches 100. Naturally, no
> 100 item arrays are ever created.
>
> Kris Kowal
Sorry, that last |each| should be |forEach| for my claim that no 100
item arrays would be created to be accurate.
Kris Kowal
More information about the Es4-discuss
mailing list