-
Notifications
You must be signed in to change notification settings - Fork 29
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
Differences in Base.Iterators.partition
and IterTools.partition
#67
Comments
update - I think on This might (?) be the last inconsistency that would need to be addressed before something like #30 could be resolved. How do folks want to resolve the differences listed above? I'd propose using the One path forward would be to add the |
Change to make |
I'm in favor of keeping the current behavior of For example, implementing |
Yeah, it's sort of a shame that the implementation needs to be different depending on whether it's designed for long or short partitions (which would use Arrays or Tuples, respectively). For instance, in my use case (streaming audio) I often want to chop the stream into chunks of 512 or 1024 elements, so Tuples aren't good for that. Maybe the partition type should be provided as an optional argument to |
Oh, good. That's an important use too. |
Yeah, array views are good for me |
Difference 2 is handled in Clojure by having partition-all and partition, where base Difference 1 & 2 are grouped together in Transducers under Consecutive vs Partition. So you either get fixed length tuples or variable length arrays. I think this roughly aligns with common usage patterns where you either want to have small fixed length groups, or process large chunks of an array. In my ideal universe both |
There are some differences between
Base.Iterators.partition
andIterTools.partition
. I brought it up on Slack and @oxinabox asked me to file an issue.Base.Iterators.partition
returns each chunk as anArray
, whereasIterTools.partition
returns aTuple
Base.Iterators.partition
returns a shorter chunk, whereasIterTools.partition
drops the last values.IterTools.partition
accepts astep
argument that determines the hop size for each chunk.The text was updated successfully, but these errors were encountered: