Skip to content

Swift Algorithms 1.0.0

Compare
Choose a tag to compare
@timvermeulen timvermeulen released this 08 Sep 17:53

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 or Collection 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.
  • 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 returns ExclusiveReductionsSequence<[Int]>, not ExclusiveReductionsSequence<LazySequence<[Int]>>.
  • The generic parameters of the ExclusiveReductions type have been swapped, putting the base collection first and the result type second.
  • The Indices associated type of IndexedCollection now matches Base.Indices.

Removals

  • Previously deprecated type and method names have been removed:
    • The Chain type alias for Chain2Sequence
    • The chained(with:) method which was replaced with the chain(_:_:) free function
    • The LazyChunked and Chunked type aliases for ChunkedByCollection
    • The rotate(subrange:at:) and rotate(at:) methods which were renamed to rotate(subrange:toStartAt:) and rotate(toStartAt:) respectively

Fixes

  • The StridingSequence and StridingCollection types now conditionally conform to LazySequenceProtocol, allowing the striding(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)