Skip to content

Commit c9afacb

Browse files
committed
[Swift 4] Update Combinatorics
1 parent 7077bc1 commit c9afacb

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

Combinatorics/Combinatorics.playground/Contents.swift

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
//: Playground - noun: a place where people can play
22

3+
// last checked with Xcode 9.0b4
4+
#if swift(>=4.0)
5+
print("Hello, Swift 4!")
6+
#endif
7+
38
/* Calculates n! */
49
func factorial(_ n: Int) -> Int {
510
var n = n
@@ -44,9 +49,9 @@ func permuteWirth<T>(_ a: [T], _ n: Int) {
4449
var a = a
4550
permuteWirth(a, n - 1)
4651
for i in 0..<n {
47-
swap(&a[i], &a[n])
52+
a.swapAt(i, n)
4853
permuteWirth(a, n - 1)
49-
swap(&a[i], &a[n])
54+
a.swapAt(i, n)
5055
}
5156
}
5257
}

Combinatorics/Combinatorics.playground/timeline.xctimeline

-6
This file was deleted.

0 commit comments

Comments
 (0)