From 0d6c1d3ca50f3ecbc5aa11576d4ac74ae76aaf05 Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Fri, 19 Apr 2024 16:36:56 -0700 Subject: [PATCH 1/4] Clarify the docs for partitioned(by:) --- Sources/Algorithms/Partition.swift | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Sources/Algorithms/Partition.swift b/Sources/Algorithms/Partition.swift index 178bd4c4..4f018085 100644 --- a/Sources/Algorithms/Partition.swift +++ b/Sources/Algorithms/Partition.swift @@ -210,8 +210,9 @@ extension Collection { //===----------------------------------------------------------------------===// extension Sequence { - /// Returns two arrays containing, in order, the elements of the sequence that - /// do and don’t satisfy the given predicate. + /// Returns two arrays containing the elements of the sequence that + /// don’t and do satisfy the given predicate, respectively. The order of the + /// arrays matches the order of the elements in the original sequence. /// /// In this example, `partitioned(by:)` is used to separate the input based on /// whether a name is shorter than five characters: @@ -253,8 +254,9 @@ extension Sequence { } extension Collection { - /// Returns two arrays containing, in order, the elements of the collection - /// that do and don’t satisfy the given predicate. + /// Returns two arrays containing the elements of the sequence that + /// don’t and do satisfy the given predicate, respectively. The order of the + /// arrays matches the order of the elements in the original sequence. /// /// In this example, `partitioned(by:)` is used to separate the input based on /// whether a name is shorter than five characters. From 361df104528d3c89886a9aafbb71a7bbaca510c4 Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Fri, 19 Apr 2024 16:39:22 -0700 Subject: [PATCH 2/4] =?UTF-8?q?Say=20=E2=80=9Ccollection=E2=80=9D=20instea?= =?UTF-8?q?d=20of=20=E2=80=9Csequence=E2=80=9D=20in=20the=20Collection=20d?= =?UTF-8?q?ocs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/Algorithms/Partition.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Algorithms/Partition.swift b/Sources/Algorithms/Partition.swift index 4f018085..3812529a 100644 --- a/Sources/Algorithms/Partition.swift +++ b/Sources/Algorithms/Partition.swift @@ -256,7 +256,7 @@ extension Sequence { extension Collection { /// Returns two arrays containing the elements of the sequence that /// don’t and do satisfy the given predicate, respectively. The order of the - /// arrays matches the order of the elements in the original sequence. + /// arrays matches the order of the elements in the original collection. /// /// In this example, `partitioned(by:)` is used to separate the input based on /// whether a name is shorter than five characters. From e8f30330012c6ff29f1aacb3ecd7efc79f2d3bf2 Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Thu, 25 Apr 2024 17:20:17 -0700 Subject: [PATCH 3/4] =?UTF-8?q?Be=20more=20clear=20about=20what=20orders?= =?UTF-8?q?=20I=E2=80=99m=20talking=20about?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/Algorithms/Partition.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Sources/Algorithms/Partition.swift b/Sources/Algorithms/Partition.swift index 3812529a..2777ad6e 100644 --- a/Sources/Algorithms/Partition.swift +++ b/Sources/Algorithms/Partition.swift @@ -212,7 +212,8 @@ extension Collection { extension Sequence { /// Returns two arrays containing the elements of the sequence that /// don’t and do satisfy the given predicate, respectively. The order of the - /// arrays matches the order of the elements in the original sequence. + /// elements in the arrays matches the order of the elements in the original + /// sequence. /// /// In this example, `partitioned(by:)` is used to separate the input based on /// whether a name is shorter than five characters: @@ -254,9 +255,10 @@ extension Sequence { } extension Collection { - /// Returns two arrays containing the elements of the sequence that + /// Returns two arrays containing the elements of the collection that /// don’t and do satisfy the given predicate, respectively. The order of the - /// arrays matches the order of the elements in the original collection. + /// elements in the arrays matches the order of the elements in the original + /// collection. /// /// In this example, `partitioned(by:)` is used to separate the input based on /// whether a name is shorter than five characters. From 76f8a51e85d1f1117352d882b475c71659694c02 Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Tue, 7 May 2024 11:48:03 -0700 Subject: [PATCH 4/4] =?UTF-8?q?Move=20second=20sentence=20from=20the=20abs?= =?UTF-8?q?tract=20to=20=E2=80=9CReturns:=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/Algorithms/Partition.swift | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Sources/Algorithms/Partition.swift b/Sources/Algorithms/Partition.swift index 2777ad6e..181547ed 100644 --- a/Sources/Algorithms/Partition.swift +++ b/Sources/Algorithms/Partition.swift @@ -211,9 +211,7 @@ extension Collection { extension Sequence { /// Returns two arrays containing the elements of the sequence that - /// don’t and do satisfy the given predicate, respectively. The order of the - /// elements in the arrays matches the order of the elements in the original - /// sequence. + /// don’t and do satisfy the given predicate, respectively. /// /// In this example, `partitioned(by:)` is used to separate the input based on /// whether a name is shorter than five characters: @@ -232,7 +230,9 @@ extension Sequence { /// /// - Returns: Two arrays with all of the elements of the receiver. The /// first array contains all the elements that `predicate` didn’t allow, and - /// the second array contains all the elements that `predicate` allowed. + /// the second array contains all the elements that `predicate` allowed. The + /// order of the elements in the arrays matches the order of the elements in + /// the original sequence. /// /// - Complexity: O(*n*), where *n* is the length of the sequence. @inlinable @@ -256,9 +256,7 @@ extension Sequence { extension Collection { /// Returns two arrays containing the elements of the collection that - /// don’t and do satisfy the given predicate, respectively. The order of the - /// elements in the arrays matches the order of the elements in the original - /// collection. + /// don’t and do satisfy the given predicate, respectively. /// /// In this example, `partitioned(by:)` is used to separate the input based on /// whether a name is shorter than five characters. @@ -277,7 +275,9 @@ extension Collection { /// /// - Returns: Two arrays with all of the elements of the receiver. The /// first array contains all the elements that `predicate` didn’t allow, and - /// the second array contains all the elements that `predicate` allowed. + /// the second array contains all the elements that `predicate` allowed. The + /// order of the elements in the arrays matches the order of the elements in + /// the original collection. /// /// - Complexity: O(*n*), where *n* is the length of the collection. @inlinable