Skip to content

Commit 1a3a13c

Browse files
Removes Swift 4.0 check.
Removes unused import. Refactors an if statement into a guard to be more Swift-y. Removes unnecessarily explicitly defining the function as public.
1 parent 71b20f4 commit 1a3a13c

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
// last checked with Xcode 9.0b4
2-
#if swift(>=4.0)
3-
print("Hello, Swift 4!")
4-
#endif
5-
61
var numberList = [1, 12, 9, 17, 13, 12]
72

8-
slowsort(0, numberList.count-1, &numberList)
3+
slowSort(0, numberList.count-1, &numberList)
94
print(numberList)

Slow Sort/SlowSort.swift

+2-6
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,8 @@
66
//
77
//
88

9-
import Foundation
10-
11-
public func slowsort(_ i: Int, _ j: Int, _ numberList: inout [Int]) {
12-
if i>=j {
13-
return
14-
}
9+
func slowSort(_ i: Int, _ j: Int, _ numberList: inout [Int]) {
10+
guard if i < j else { return }
1511
let m = (i+j)/2
1612
slowsort(i, m, &numberList)
1713
slowsort(m+1, j, &numberList)

0 commit comments

Comments
 (0)