-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do we need an indicator whether the range was completely fulfilled? #72
Comments
what is |
It's essentially syntactic sugar, if you will, for const max = 5
const iterator = Iterator.range(0, max, 2)
const r = [ ...iterator ]
iterator.exhausted = r.at(-1) === max resp. const max = 5
const iterator = Iterator.range(0, max, 2)
const r = [ ...iterator ]
iterator.remainder = max - r.at(-1)
iterator.exhausted = iterator.remainder === 0 |
Iterators aren’t inherently finite, and if they’re “done” then they’re always exhausted. |
It's not about finite or infinite. Infinite would mean, they are never done. But what I propose is to determine if done was a spot landing/precision landing. |
What's the use case for needing to know that |
Yes, I wonder the use case of this |
But I mean, in #64, it's currently discussed that |
you can use variables in a for loop too, and in both cases you can check your own first. I don't see why it would ever throw. |
Yeah, but that was only part of my answer.
That's the point of syntactic salt. Syntactic sugar doesn't introduce anything that wasn't possible before but removed unnecessary boilerplate.
My reference was primarily meant to indicate that I'm not the only one discussing this. |
I'm still not seeing a concrete use case for why you care if the end condition is specifically hit or not. |
Imagine, we have a range like this:
Then we get
and both
iterator.done
and, let's say,iterator.exhausted
would betrue
.ALright, now image this:
This would also yield
but now,
iterator.done
, whileiterator.exhausted
would befalse
. A hypotheticaliterator.remainder
would be1
.Would anyone need that? Has this already been considered?
The text was updated successfully, but these errors were encountered: