-
Notifications
You must be signed in to change notification settings - Fork 8
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
Speculative: should we return chunk
s of the object instead of chunks of indices?
#25
Comments
I agree that it's a bit of a misnomer. I kind of like that it returns indices though. It's cheap and well defined. Maybe we should have both variants. About returning chunks of data (i.e. elements), what would |
I think that should be up to the implementer, but the default should be a We could also have |
I agree that the name is not very good, and appears to signify the data of the chunk, not its indices. I have actually implemented for chunk in chunks(A; n)
f(chunk)
end
That's why, after experimenting with some names, I ended up not changing the simplest name At the same time, except for the breaking aspect of the changes, I wouldn't mind that we had both behaviors in different functions (or just using |
I guess from my point of view, |
I do not disagree. I think the name is not good. Also I think that most users of this package will end up using I'm just afraid of releasing another breaking change. From what I've checked none of the dependents (which are only ~10 by now) updated to the new interface. |
a non-breaking change could be done by adding |
We have to mass-PR packages for deprecating the old syntax anyway, so that's one alternative before releasing 3.0. There are ~10 packages that depend on it, that's simple. I'm worried about the now various discourse threads that propose using this package, and the possible breaking of other non-public scripts. |
Speaking of misnomer, (Even if we don't like the "Iterator" part, it should at least be the plural |
To summarize, the current proposal is
|
|
See 3.x release :) |
I feel like
chunks
is a bit of a misnomer. If I do[x for x in chunks([:a, :b, :c, :d, :e]; n=2)]
, it seems much more natural and also more useful to me that the result would be[[:a, :b, :c], [:d, :e]]
rather than[1:1:3, 4:1:5]
.This way instead of writing
we could just simply write
The current behaviour could then be emulated by doing
Any thoughts on this? @lmiq @carstenbauer ? I think doing it like this would potentially make it easier to do things like support
Dict
andDictionary
or other more exotic containers.The text was updated successfully, but these errors were encountered: