This project follows semantic versioning.
No new changes.
1.0.0 - 2021-09-08
- 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.
Chain2 -> Chain2Sequence ChunkedBy -> ChunkedByCollection ChunkedOn -> ChunkedOnCollection ChunkedByCount -> ChunksOfCountCollection Combinations -> CombinationsSequence Cycle -> CycledSequence FiniteCycle -> CycledTimesCollection Indexed -> IndexedCollection Intersperse -> InterspersedSequence LazySplitSequence -> SplitSequence LazySplitCollection -> SplitCollection Permutations -> PermutationsSequence UniquePermutations -> UniquePermutationsSequence Product2 -> Product2Sequence ExclusiveReductions -> ExclusiveReductionsSequence InclusiveReductions -> InclusiveReductionsSequence StrideSequence -> StridingSequence StrideCollection -> StridingCollection Uniqued -> UniquedSequence Windows -> WindowsOfCountCollection
- 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]>>
. - This concerns
JoinedByClosureSequence
,JoinedByClosureCollection
,ExclusiveReductionsSequence
,InclusiveReductionsSequence
.
- 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
.
- 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
- 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)
The 1.0.0 release includes contributions from iainsmith, mdznr, and timvermeulen. Thank you!
0.2.1 - 2021-06-01
Expanded versatility for two existing operations:
- A series of
joined(by:)
overloads concatenate a sequence of sequences using an element or a collection, either passed in or generated from consecutive elements via a closure. (#138) - Additional
trimming(while:)
methods for trimming only the start or end of a collection, as well as mutating versions of all three variants. (#104)
The 0.2.1 release includes contributions from fedeci and timvermeulen. Thank you!
0.2.0 - 2021-05-17
Two new additions to the list of algorithms:
adjacentPairs()
lazily iterates over tuples of adjacent elements of a sequence. (#119)minAndMax()
finds both the smallest and largest elements of a sequence in a single pass. (#90)
-
When calling
chunked(on:)
, the resulting collection has an element type of(Subject, SubSequence)
instead of justSubSequence
, making the subject value available when iterating.let numbers = [5, 6, -3, -9, -11, 2, 7, 6] for (signum, values) in numbers.chunked(on: { $0.signum() }) { print(signum, values) } // 1 [5, 6] // -1 [-3, -9, -11] // 1 [2, 7, 6]
- Improvements to the documentation and PR templates.
The 0.2.0 release includes contributions from CTMacUser, LemonSpike, mpangburn, and natecook1000. Thank you!
0.1.1 - 2021-04-14
Product2
associated type inference error in release build (#130)
0.1.0 - 2021-04-13
- The
compacted()
method lazily finds the non-nil
elements of a sequence or collection (#112).
- The
uniqued()
method now lazily computes the unique elements of a sequence or a collection (#71). Pass this resulting sequence to anArray
initializer to recover the behavior of the previous release. - Calling
cycled(times:)
now returns a newFiniteCycle
type, which has the same conformances as its underlying collection (#106). - The base collections of the sequence and collection wrapper types are no
longer public (#85, #125), and the wrapper types no longer conform to the
Equatable
orHashable
protocols (#124). If you need those conformances, convert the wrapper type to anArray
or other collection currrency type before storing. Please file an issue if these changes pose a problem for your use case.
The 0.1.0 release includes contributions from LemonSpike, LucianoPAlmeida, natecook1000, and timvermeulen. Thank you!
0.0.4 - 2021-03-29
More new algorithms to join the party:
- A lazy version of the standard library's two
split
methods. (#78) firstNonNil(_:)
returns the first non-nil
element from an optional-generating transform. (#31)uniquePermutations()
skips duplicates when generating permutations of a collection. (#91)- The
reductions
methods return all the in-between states of reducing a sequence or collection. (#46)
- Methods and computed properties are more consistently marked as inlinable, resolving a performance regression.
- The
Stride
type now efficiently calculates distances between positions, supported by the underlying collection. - Better test coverage and improved diagnostics for comparing sequences.
- Fixed links and improved documentation.
The 0.0.4 release includes contributions from bjhomer, danielctull, hashemi, karwa, kylemacomber, LucianoPAlmeida, mdznr, natecook1000, ollieatkinson, Qata, timvermeulen, and toddthomas. Thank you!
0.0.3 - 2021-02-26
An exciting group of new algorithms, contributed by the community:
trimming(while:)
returns a subsequence of a bidirectional collection with the matching elements removed from the start and end. (#4)min(ofCount:)
andmax(ofCount:)
find the smallest or largest elements in a collection. (#9, #77)windows(ofCount:)
lets you iterate over all the overlapping subsequences of a particular length. (#20)striding(by:)
iterates over every nth element of a sequence or collection. (#24)interspersed(with:)
places a new element between every pair of elements in a sequence or collection. (#35)chunks(ofCount:)
breaks a collection into subsequences of the given number of elements. (#54)suffix(while:)
matches the standard library'sprefix(while:)
, by returning the suffix of all matching elements from a bidirectional collection. (#65)- Variations of
combinations(ofCount:)
andpermutations(ofCount:)
that take a range expression as a parameter, returning combinations and permutations of multiple lengths. (#51, #56)
- The
LazyChunked
type now precomputes itsstartIndex
, making performance more predictable when using the collection.
randomSample(count:)
no longer traps in rare circumstances.- Index calculations have been improved in a variety of collection wrappers.
- A variety of documentation improvements and corrections.
The 0.0.3 release includes contributions from benrimmington, danielctull, dhruvshah8, karwa, LucianoPAlmeida, markuswntr, mdznr, michiboo, natecook1000, ollieatkinson, rakaramos, rockbruno, Roshankumar350, sidepelican, and timvermeulen. Thank you!
0.0.2 - 2020-10-23
- The
rotate(at:)
method has been updated torotate(toStartAt:)
, with the old name deprecated. - The
chained(with:)
method has been changed to the free functionchain(_:_:)
, with the old version deprecated. Algorithms
now usesRealModule
from theswift-numerics
package for its cross-platform elementary functions.- Sequence/collection wrapper types, like
Permutations
andIndexed
, now have conformance to the lazy protocols, so that any following operations maintain their laziness.
Algorithms
now builds under SwiftPM on Windows.- A wide variety of errors, misspellings, and ommissions in the documentation and guides have been fixed.
- Index/distance calculations for the
Product2
andChain
types have been corrected. - Calling
stablePartition(subrange:by:)
now correctly uses the subrange's length instead of the whole collection.
The 0.0.2 release includes contributions from AustinConlon, egorzhdan, IanKeen, iSame7, karwa, kylemacomber, natecook1000, nordicio, pmtao, schlagelk, stephentyrone, and timvermeulen. Thank you!
0.0.1 - 2020-10-07
- Swift Algorithms initial release.
This changelog's format is based on Keep a Changelog.