Skip to content

Commit 34b1705

Browse files
authored
Clarify the docs for partitioned(by:) (#228)
1 parent 33abb69 commit 34b1705

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

Sources/Algorithms/Partition.swift

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ extension Collection {
210210
//===----------------------------------------------------------------------===//
211211

212212
extension Sequence {
213-
/// Returns two arrays containing, in order, the elements of the sequence that
214-
/// do and don’t satisfy the given predicate.
213+
/// Returns two arrays containing the elements of the sequence that
214+
/// don’t and do satisfy the given predicate, respectively.
215215
///
216216
/// In this example, `partitioned(by:)` is used to separate the input based on
217217
/// whether a name is shorter than five characters:
@@ -230,7 +230,9 @@ extension Sequence {
230230
///
231231
/// - Returns: Two arrays with all of the elements of the receiver. The
232232
/// first array contains all the elements that `predicate` didn’t allow, and
233-
/// the second array contains all the elements that `predicate` allowed.
233+
/// the second array contains all the elements that `predicate` allowed. The
234+
/// order of the elements in the arrays matches the order of the elements in
235+
/// the original sequence.
234236
///
235237
/// - Complexity: O(*n*), where *n* is the length of the sequence.
236238
@inlinable
@@ -253,8 +255,8 @@ extension Sequence {
253255
}
254256

255257
extension Collection {
256-
/// Returns two arrays containing, in order, the elements of the collection
257-
/// that do and don’t satisfy the given predicate.
258+
/// Returns two arrays containing the elements of the collection that
259+
/// don’t and do satisfy the given predicate, respectively.
258260
///
259261
/// In this example, `partitioned(by:)` is used to separate the input based on
260262
/// whether a name is shorter than five characters.
@@ -273,7 +275,9 @@ extension Collection {
273275
///
274276
/// - Returns: Two arrays with all of the elements of the receiver. The
275277
/// first array contains all the elements that `predicate` didn’t allow, and
276-
/// the second array contains all the elements that `predicate` allowed.
278+
/// the second array contains all the elements that `predicate` allowed. The
279+
/// order of the elements in the arrays matches the order of the elements in
280+
/// the original collection.
277281
///
278282
/// - Complexity: O(*n*), where *n* is the length of the collection.
279283
@inlinable

0 commit comments

Comments
 (0)