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
There was a suggestion to add Compact and CompactFunc, analogous to slices.Compact and slices.CompactFunc. Those seem less important for Seqs than slices, since they are intended for use after slices.Sort, and there is no xiter.Sort, nor can there be. (At that point, code might as well use slices.Collect+slices.Sort.) Filing a separate proposal for these would make sense, to separate that discussion.
There are two reasons to prefer an iterator version for slices
you need to keep the original with duplicates but want to walk it without
you no longer need the slice and could avoid moving its contents around by deduplicating online
There are nonslice uses as well
the input is coming from some kind of process that is sorted but may contain runs of duplicates (DB results, output of a forked process, etc.)
the input is unsorted but you can still ignore runs of duplicates safely
you're mapping the values of a seq in a way that can cause runs of duplicates in the output that weren't in the input
The text was updated successfully, but these errors were encountered:
Add
(and similarly for the
iter.Seq2
variants) tox/exp/xiter
.These are the iter equivalent of
slices.Compact{,Func}
.In #61898, @rsc said:
There are two reasons to prefer an iterator version for slices
There are nonslice uses as well
The text was updated successfully, but these errors were encountered: