This comment is hidden because it contains spoiler information about the solution
(also, a bunch of existing solutions just got trashed by the null yields test... rip)
thanks, i've added your new tests. i've also added a note to the description warning that yielded values may be null
null
this kata isn't really meant to test for multiple threads of execution, but i suspect using static variables to store generator-specific data will likely fail in cases with multiple generators anyways
static
a good implementation probably should allow for unrelated generators to run in parallel threads, but this kata doesn't require or test for that
For those stuck, i found it helpful to visualize whats happening with a pen and paper.
see here
Tags are mostly automatic (and bad, yes), don't post suggestions about that, it's useless. Thx.
This is not about refactoring, please remove the tag.
Don't you think it's incorrect to tag it "functional programming"?
Or don't you think incorrect tagging is an issue?
You could also test yielding null-values, with and without combining with yieldFrom.
When a generator is done, next() should return null. But if yielding null the generator might not be done.
Loading collection data...
This comment is hidden because it contains spoiler information about the solution
(also, a bunch of existing solutions just got trashed by the null yields test... rip)
thanks, i've added your new tests. i've also added a note to the description warning that yielded values may be
null
this kata isn't really meant to test for multiple threads of execution, but i suspect using
static
variables to store generator-specific data will likely fail in cases with multiple generators anywaysa good implementation probably should allow for unrelated generators to run in parallel threads, but this kata doesn't require or test for that
For those stuck, i found it helpful to visualize whats happening with a pen and paper.
see here
see here
Tags are mostly automatic (and bad, yes), don't post suggestions about that, it's useless. Thx.
This is not about refactoring, please remove the tag.
This is not about refactoring, please remove the tag.
This is not about refactoring, please remove the tag.
Don't you think it's incorrect to tag it "functional programming"?
Or don't you think incorrect tagging is an issue?
This comment is hidden because it contains spoiler information about the solution
You could also test yielding null-values, with and without combining with yieldFrom.
When a generator is done, next() should return null. But if yielding null the generator might not be done.
Loading more items...