回答編集履歴
2
改行前にカンマを追加
test
CHANGED
@@ -28,7 +28,7 @@
|
|
28
28
|
|
29
29
|
zip(a, ThreeCount()).forEach {
|
30
30
|
|
31
|
-
print($0.0, terminator: $0.1 ? "\n" : ",")
|
31
|
+
print($0.0, terminator: $0.1 ? ",\n" : ",")
|
32
32
|
|
33
33
|
}
|
34
34
|
|
1
SequenceのElementをBoolにすることで無駄な処理をなくした
test
CHANGED
@@ -8,23 +8,17 @@
|
|
8
8
|
|
9
9
|
var current = 0
|
10
10
|
|
11
|
-
mutating func next() ->
|
11
|
+
mutating func next() -> Bool? {
|
12
12
|
|
13
13
|
let res = current
|
14
14
|
|
15
15
|
current = (current + 1) % 3
|
16
16
|
|
17
|
-
return res
|
17
|
+
return res == 2
|
18
18
|
|
19
19
|
}
|
20
20
|
|
21
21
|
}
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
func isThree(_ val: Int) -> Bool { return val == 3 }
|
26
|
-
|
27
|
-
|
28
22
|
|
29
23
|
|
30
24
|
|
@@ -34,7 +28,7 @@
|
|
34
28
|
|
35
29
|
zip(a, ThreeCount()).forEach {
|
36
30
|
|
37
|
-
print($0.0, terminator:
|
31
|
+
print($0.0, terminator: $0.1 ? "\n" : ",")
|
38
32
|
|
39
33
|
}
|
40
34
|
|