* Add scan function
* Add initial conditional conformances to Collection and BidirectionalCollection
* Rename scan to reductions
* Add information to the readme about the reductions name
* Add eager API
* Remove Reductions' conformance to BidirectionalCollection
* Implement Reductions subscript such that it occurs in constant time
* Add a variant which includes the given initial result
* Add a variant which takes no initial result value
* Add excluding label to show the initial result is not included
* Test lazy implementations
* Remove reductions(including:_:)
* Add conformance to LazySequenceProtocol and LazyCollectionProtocol when the base sequence conforms
* Fix implementation of lazy reductions
* Add test cases for sequences with one element
* Tidy up tests
* Improve ergonomics of no initial value eager reductions call and provide it as an extension on Sequence
* Add lazy InclusiveReductions sequence
* Rename Reductions to ExclusiveReductions
* Add Collection implementation for InclusiveReductions
* Update guide
* Add links for C++ implementations
* Add conformance to Collection for ExclusiveReductions
* Improve ergonomics of ExclusiveReductions' index representation
* Improve ergonomics of InclusiveReductions' index representation by sharing the Index implementation
* Tidy up internal function
* Add exclusive eager version of reductions(into:_:)
* Use new lazy assertion functions
* Correct the complexity claims for reductions
* Separate the index types
This will allow for future changes to either implementation without causing a breakage for the other.
* Update guide to reflect that arrays are returned directly
* Add scan as deprecated methods
* Add lazy overload of reductions(into:_:)
* Add the reductions(into:_:) functions
* More succinctly introduce reductions
* Add a note about the deprecated scan functions
* Update documentation
* Add @inlinable and @usableFromInline
* Copy documentation to all variants of reductions
* Test the value after the function is complete
* Just use the += operator
* Add an example for reductions(into:_:)
* Improve the documentation of the return value
* Update complexity note
* Use the reduce documentation for inspiration for the discussion of reductions
* Add uniquePermutations as wrapper for nextPermutation
* Implement uniquePermutations(ofCount:) variants
* Simplify UniquePermutations.Iterator.next()
* Add tests for uniquePermutations
* Move to a predicate-based uniquePermutations
* Add method documentation
* Convert to Hashable-based uniquing instead of Comparable
* Streamline tests, cover uniqueness
* Use optional count to collapse no-count method
* Update API documentation
* Remove leftover version of nextPermutation()
* Remove Hashable requirement from the UniquePermutations type
* Update documentation
* Apply Tim's great revisions
Co-authored-by: Tim Vermeulen <tvermeulen@apple.com>
* Add lazy conformance to UniquePermutations
Co-authored-by: Tim Vermeulen <tvermeulen@apple.com>
* Implement StrideSequence so that the default implementation for collection uses IndexingIterator
* Update Sources/Algorithms/Stride.swift
Co-authored-by: Tim Vermeulen <tvermeulen@apple.com>
* reinstate documentation for Sequence and remove explicit Sequence conformance on Stride
* documentation
* rename Stride to StrideCollection
Co-authored-by: Tim Vermeulen <tvermeulen@apple.com>
`split(maxSplits:omittingEmptySubsequences:whereSeparator:)`
and
`split(separator:maxSplits:omittingEmptySubsequences:)`
now operate lazily when called on `LazySequenceProtocol`- or
`LazyCollectionProtocol`-conforming values. In the latter case,
no additional storage is allocated on the heap.
This renames sortedPrefix to min(count:), adds max(count:),
and moves both methods down to Sequence.
In order to still provide the optimization when `count` is close to
a collection's length, we include a Collection-specific overload of
all methods. These won't be accessed when in a Sequence-generic context,
but it's the best we can do without adding these methods as protocol
requirements.