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
Fix lazy sequence bug with separator count >= element count.
Because the array into which the lazy sequence iterator collected the subsequence
elements was a member property, it had to be manually emptied before each
invocation of `next`. Since there are multiple exit points from that method, there
were multiple places that had to be done, and of course I missed at least one. This
caused the last element of the base sequence to be repeated as necessary to make
`sequenceLength` equal `separatorCount + 1`, in the case where the number of
separators was equal to or great than the number of non-separators in the base
sequence, and the last sequence element was a non-separator.
Happily, it's not necessary for the subsequence array to be a member property of
the iterator, and making it a local fixes this bug, in addition to being the right and
proper thing to do.
0 commit comments