You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Iterators.partition is useful when you want to implement, e.g., foreach on arrays. This package does not try to replace it.
This is essentially just an API I extracted out from Transducers.jl as I thought it may be useful for someone else as well. It's also easier to ask collection implementers to add support for halve (as they don't need to add Transducers.jl to their dependencies).
Although halve is more-or-less a special case of partition (well, exactly so for arrays), the requirements for halve is more relaxed than partition. I think it has some benefits. Since the resulting length doesn't have to be exactly half (or within +/- 1), it makes implementation cheaper for something like AbstractString and Iterators.product. It is also possible to implement this API for iterators "with computation" like Base.Generator and Iterators.Filter. (But I'm not doing this since treating it via transducers is much better for me.) I haven't looked into yet, but I think halve is much easier to implement for sets and dicts.
could you clarify in what situations this package is preferable to just using
Iterators.partition
?The text was updated successfully, but these errors were encountered: