Skip to content

Commit cd58714

Browse files
committed
Add note about ordering contracts; clean example comment
Insert an HTML TODO-style note calling out the need to discuss strict-weak vs total-preorder from the contracts chapter, and remove an inline "// lower bound?" comment from the Swift example to keep the code example clean. Changes are limited to chapter-4-algorithms.md to flag the conceptual discussion and tidy the sample code.
1 parent 089ba6d commit cd58714

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,8 @@ clarity, and enable efficient computation.
462462
{{#include test.swift:2:5}}
463463
```
464464

465+
466+
<!-- If we use this we need discussion about strict-weak vs total-preorder from contracts chapter. -->
465467
```swift
466468
func partitionPoint<T>(_ array: [T], _ predicate: (T) -> Bool) -> Int {
467469
var left = 0
@@ -478,7 +480,7 @@ func partitionPoint<T>(_ array: [T], _ predicate: (T) -> Bool) -> Int {
478480
}
479481

480482
let array = [1, 2, 3, 4, 5, 5, 5, 6, 7, 8, 9, 10]
481-
let index = partitionPoint(array, { $0 <= 5 }) // lower bound?
483+
let index = partitionPoint(array, { $0 <= 5 })
482484
```
483485

484486
### Algorithm categories

0 commit comments

Comments
 (0)