Skip to content

Commit ebd295b

Browse files
committed
Remove redundant comment and usage example in algorithms doc
Clean up chapter-4-algorithms.md by removing an inline partition comment and a short usage example for halfStablePartition. This trims redundant explanatory lines while leaving the function implementation unchanged.
1 parent 998d46c commit ebd295b

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

better-code/src/chapter-4-algorithms.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ func halfStablePartition<T>(
169169
) -> Int {
170170
var writeIndex = 0
171171

172-
// Partition: move all elements that don't satisfy predicate to the front
173172
for readIndex in 0..<array.count {
174173
if !belongsInSecondPartition(array[readIndex]) {
175174
if writeIndex != readIndex {
@@ -181,10 +180,6 @@ func halfStablePartition<T>(
181180

182181
return writeIndex
183182
}
184-
185-
// Usage example:
186-
// let pivot = halfStablePartition(&shapes, by: { $0.isSelected })
187-
// shapes.removeSubrange(pivot...) // Remove all selected shapes
188183
```
189184

190185
Given `halfStablePartition()` we can rewrite `removeAllSelected()`.

0 commit comments

Comments
 (0)