diff --git a/Linear Search/LinearSearch.playground/Contents.swift b/Linear Search/LinearSearch.playground/Contents.swift index 436af2eda..8ac0e9a71 100644 --- a/Linear Search/LinearSearch.playground/Contents.swift +++ b/Linear Search/LinearSearch.playground/Contents.swift @@ -1,6 +1,6 @@ //: Playground - noun: a place where people can play -// last checked with Xcode 4.0b4 +// last checked with Xcode 9.0b4 #if swift(>=4.0) print("Hello, Swift 4!") #endif diff --git a/Minimum Edit Distance/MinimumEditDistance.playground/Contents.swift b/Minimum Edit Distance/MinimumEditDistance.playground/Contents.swift old mode 100755 new mode 100644 index 238afeb9b..479815df7 --- a/Minimum Edit Distance/MinimumEditDistance.playground/Contents.swift +++ b/Minimum Edit Distance/MinimumEditDistance.playground/Contents.swift @@ -1,3 +1,10 @@ +// Minimum Edit Distance + +// last checked with Xcode 9.0b4 +#if swift(>=4.0) +print("Hello, Swift 4!") +#endif + extension String { public func minimumEditDistance(other: String) -> Int { @@ -25,7 +32,7 @@ extension String { } else { // minimum of the cost of insertion, deletion, or substitution // added to the already computed costs in the corresponding cells - matrix[i + 1][j + 1] = min(matrix[i][j] + 1, matrix[i + 1][j] + 1, matrix[i][j + 1] + 1) + matrix[i + 1][j + 1] = Swift.min(matrix[i][j] + 1, matrix[i + 1][j] + 1, matrix[i][j + 1] + 1) } } } diff --git a/Minimum Edit Distance/MinimumEditDistance.playground/contents.xcplayground b/Minimum Edit Distance/MinimumEditDistance.playground/contents.xcplayground old mode 100755 new mode 100644 diff --git a/Minimum Edit Distance/README.markdown b/Minimum Edit Distance/README.markdown index 905b358ae..b8880b2d4 100755 --- a/Minimum Edit Distance/README.markdown +++ b/Minimum Edit Distance/README.markdown @@ -45,7 +45,7 @@ for (i, selfChar) in self.characters.enumerated() { } else { // minimum of the cost of insertion, deletion, or substitution // added to the already computed costs in the corresponding cells - matrix[i + 1][j + 1] = min(matrix[i][j] + 1, matrix[i + 1][j] + 1, matrix[i][j + 1] + 1) + matrix[i + 1][j + 1] = Swift.min(matrix[i][j] + 1, matrix[i + 1][j] + 1, matrix[i][j + 1] + 1) } } } diff --git a/Monty Hall Problem/MontyHall.playground/Contents.swift b/Monty Hall Problem/MontyHall.playground/Contents.swift index bcdafd137..4bfff2340 100644 --- a/Monty Hall Problem/MontyHall.playground/Contents.swift +++ b/Monty Hall Problem/MontyHall.playground/Contents.swift @@ -1,5 +1,10 @@ //: Playground - noun: a place where people can play +// last checked with Xcode 9.0b4 +#if swift(>=4.0) + print("Hello, Swift 4!") +#endif + import Foundation func random(_ n: Int) -> Int { @@ -43,7 +48,7 @@ func playRound() { } // Run the simulation a large number of times. -for i in 1...5000 { +for _ in 1...5000 { playRound() } diff --git a/Naive Bayes Classifier/NaiveBayes.playground/Contents.swift b/Naive Bayes Classifier/NaiveBayes.playground/Contents.swift index 66aefaa32..6a2e01aab 100644 --- a/Naive Bayes Classifier/NaiveBayes.playground/Contents.swift +++ b/Naive Bayes Classifier/NaiveBayes.playground/Contents.swift @@ -1,5 +1,10 @@ import Foundation +// last checked with Xcode 9.0b4 +#if swift(>=4.0) +print("Hello, Swift 4!") +#endif + /*: ## Naive Bayes Classifier diff --git a/Rabin-Karp/Rabin-Karp.playground/Contents.swift b/Rabin-Karp/Rabin-Karp.playground/Contents.swift index 4956fabe3..c0a99339a 100644 --- a/Rabin-Karp/Rabin-Karp.playground/Contents.swift +++ b/Rabin-Karp/Rabin-Karp.playground/Contents.swift @@ -1,5 +1,10 @@ //: Taking our rabin-karp algorithm for a walk +// last checked with Xcode 9.0b4 +#if swift(>=4.0) +print("Hello, Swift 4!") +#endif + import UIKit struct Constants { diff --git a/Radix Tree/RadixTree.playground/Contents.swift b/Radix Tree/RadixTree.playground/Contents.swift index e161e48a2..a5e614849 100644 --- a/Radix Tree/RadixTree.playground/Contents.swift +++ b/Radix Tree/RadixTree.playground/Contents.swift @@ -1,3 +1,10 @@ +// Radix Tree + +// last checked with Xcode 9.0b4 +#if swift(>=4.0) +print("Hello, Swift 4!") +#endif + var radix = RadixTree() var radixWiki = RadixTree() diff --git a/Ring Buffer/RingBuffer.playground/Contents.swift b/Ring Buffer/RingBuffer.playground/Contents.swift index 29b9917a0..5c699f191 100644 --- a/Ring Buffer/RingBuffer.playground/Contents.swift +++ b/Ring Buffer/RingBuffer.playground/Contents.swift @@ -1,5 +1,10 @@ //: Playground - noun: a place where people can play +// last checked with Xcode 9.0b4 +#if swift(>=4.0) +print("Hello, Swift 4!") +#endif + public struct RingBuffer { fileprivate var array: [T?] fileprivate var readIndex = 0 diff --git a/Run-Length Encoding/RLE.playground/Contents.swift b/Run-Length Encoding/RLE.playground/Contents.swift index 26f7dca48..fc2d82505 100644 --- a/Run-Length Encoding/RLE.playground/Contents.swift +++ b/Run-Length Encoding/RLE.playground/Contents.swift @@ -1,5 +1,10 @@ //: Playground - noun: a place where people can play +// last checked with Xcode 9.0b4 +#if swift(>=4.0) +print("Hello, Swift 4!") +#endif + import Foundation let originalString = "aaaaabbbcdeeeeeeef" diff --git a/Run-Length Encoding/RLE.playground/timeline.xctimeline b/Run-Length Encoding/RLE.playground/timeline.xctimeline deleted file mode 100644 index bf468afec..000000000 --- a/Run-Length Encoding/RLE.playground/timeline.xctimeline +++ /dev/null @@ -1,6 +0,0 @@ - - - - - diff --git a/Selection Sampling/SelectionSampling.playground/Contents.swift b/Selection Sampling/SelectionSampling.playground/Contents.swift index 4a2484162..f4aace0c7 100644 --- a/Selection Sampling/SelectionSampling.playground/Contents.swift +++ b/Selection Sampling/SelectionSampling.playground/Contents.swift @@ -1,5 +1,10 @@ //: Playground - noun: a place where people can play +// last checked with Xcode 9.0b4 +#if swift(>=4.0) +print("Hello, Swift 4!") +#endif + import Foundation /* Returns a random integer in the range min...max, inclusive. */ diff --git a/Set Cover (Unweighted)/SetCover.playground/Contents.swift b/Set Cover (Unweighted)/SetCover.playground/Contents.swift index dcf998a66..d61b9c84a 100644 --- a/Set Cover (Unweighted)/SetCover.playground/Contents.swift +++ b/Set Cover (Unweighted)/SetCover.playground/Contents.swift @@ -1,3 +1,10 @@ +// SetCover + +// last checked with Xcode 9.0b4 +#if swift(>=4.0) +print("Hello, Swift 4!") +#endif + let universe1 = Set(1...7) let array1 = randomArrayOfSets(covering: universe1) let cover1 = universe1.cover(within: array1)