Swift Algorithms 1.0.0
Swift Algorithms is now source stable!
Changes
- Most sequence and collection types have been renamed, following a more consistent naming structure:
- The
Lazy
prefix was dropped. - Either a
Sequence
orCollection
suffix was added depending on whether or not the type is unconditionally a collection. - The base name was derived from the name of the method that produces it, including an argument label to disambiguate if necessary.
- The
- Types that can only be produced from a lazy sequence chain now unconditionally conform to
LazySequenceProtocol
and wrap the base sequence instead of the lazy wrapper, making some return types slightly simpler.- e.g.
[1, 2, 3].lazy.reductions(+)
now returnsExclusiveReductionsSequence<[Int]>
, notExclusiveReductionsSequence<LazySequence<[Int]>>
.
- e.g.
- The generic parameters of the
ExclusiveReductions
type have been swapped, putting the base collection first and the result type second. - The
Indices
associated type ofIndexedCollection
now matchesBase.Indices
.
Removals
- Previously deprecated type and method names have been removed:
- The
Chain
type alias forChain2Sequence
- The
chained(with:)
method which was replaced with thechain(_:_:)
free function - The
LazyChunked
andChunked
type aliases forChunkedByCollection
- The
rotate(subrange:at:)
androtate(at:)
methods which were renamed torotate(subrange:toStartAt:)
androtate(toStartAt:)
respectively
- The
Fixes
- The
StridingSequence
andStridingCollection
types now conditionally conform toLazySequenceProtocol
, allowing thestriding(by:)
method to properly propagate laziness in a lazy sequence chain. - Fixed
chunked(by:)
to always compare two consecutive elements rather than each element with the first element of the current chunk. (#162)