Thanks for the example. The same result might be achieved by iterating the array with the old-school for loop. The array will be iterated only once as well.
This is only possible when you have your conditions when you want to iterate it, imagine series of function passing each other generators, and final evaluator does not have access to all conditions.
Conditions functions should exist somewhere. I think it's always possible to refactor the code and have access to these functions (for example, by moving the conditions functions higher in lexical scope).
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks for the example. The same result might be achieved by iterating the array with the old-school
for
loop. The array will be iterated only once as well.I see that generators help to write code in FP-style and save iteration cycles at the same time.
This is only possible when you have your conditions when you want to iterate it, imagine series of function passing each other generators, and final evaluator does not have access to all conditions.
Conditions functions should exist somewhere. I think it's always possible to refactor the code and have access to these functions (for example, by moving the conditions functions higher in lexical scope).