trackler 2.0.8.30 → 2.0.8.31

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/common/exercises/wordy/description.md +1 -1
  3. data/lib/trackler/version.rb +1 -1
  4. data/tracks/ocaml/exercises/etl/test.ml +26 -24
  5. data/tracks/ocaml/tools/test-generator/templates/etl/template.ml +19 -0
  6. data/tracks/swift/.swiftlint.yml +2 -1
  7. data/tracks/swift/.travis.yml +2 -1
  8. data/tracks/swift/Dangerfile +6 -3
  9. data/tracks/swift/Package.swift +1 -1
  10. data/tracks/swift/exercises/accumulate/Tests/AccumulateTests/AccumulateTests.swift +1 -1
  11. data/tracks/swift/exercises/acronym/Sources/AcronymExample.swift +3 -3
  12. data/tracks/swift/exercises/bob/Sources/BobExample.swift +2 -2
  13. data/tracks/swift/exercises/crypto-square/Sources/CryptoSquareExample.swift +1 -1
  14. data/tracks/swift/exercises/custom-set/Sources/CustomSetExample.swift +5 -5
  15. data/tracks/swift/exercises/dominoes/Sources/DominoesExample.swift +6 -6
  16. data/tracks/swift/exercises/flatten-array/Sources/FlattenArrayExample.swift +1 -1
  17. data/tracks/swift/exercises/gigasecond/Sources/GigasecondExample.swift +5 -5
  18. data/tracks/swift/exercises/grains/Sources/GrainsExample.swift +1 -1
  19. data/tracks/swift/exercises/luhn/Sources/LuhnExample.swift +4 -4
  20. data/tracks/swift/exercises/meetup/Sources/MeetupExample.swift +8 -8
  21. data/tracks/swift/exercises/ocr-numbers/Sources/OcrNumbersExample.swift +1 -1
  22. data/tracks/swift/exercises/octal/Sources/OctalExample.swift +1 -1
  23. data/tracks/swift/exercises/perfect-numbers/Sources/PerfectNumbersExample.swift +1 -1
  24. data/tracks/swift/exercises/pig-latin/Sources/PigLatinExample.swift +3 -3
  25. data/tracks/swift/exercises/poker/Sources/PokerExample.swift +10 -10
  26. data/tracks/swift/exercises/pythagorean-triplet/Sources/PythagoreanTripletExample.swift +3 -3
  27. data/tracks/swift/exercises/pythagorean-triplet/Tests/PythagoreanTripletTests/PythagoreanTripletTests.swift +3 -3
  28. data/tracks/swift/exercises/secret-handshake/Sources/SecretHandshakeExample.swift +2 -2
  29. data/tracks/swift/exercises/series/Sources/SeriesExample.swift +1 -1
  30. data/tracks/swift/exercises/sieve/Sources/SieveExample.swift +4 -4
  31. data/tracks/swift/exercises/strain/Tests/StrainTests/StrainTests.swift +11 -11
  32. data/tracks/swift/exercises/tournament/Sources/TournamentExample.swift +2 -2
  33. data/tracks/swift/exercises/word-count/Sources/WordCountExample.swift +1 -1
  34. data/tracks/swift/exercises/wordy/Sources/WordyExample.swift +5 -5
  35. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d22e34478d4a5e03a5e77c1b87f9fc2100d8faa8
4
- data.tar.gz: 8bddfa98a3186438edfda24f6e61909d4250dbeb
3
+ metadata.gz: ec9e8cd131aab975f2949305731a5eceef951290
4
+ data.tar.gz: f2825b0807a002fb5f28b2f0a42dc4159ed59353
5
5
  SHA512:
6
- metadata.gz: d80291aa38a823730f5629df9a4f94032ccc6433f9b92c53cc6e96fbd8ad1fcf0ea3731ccf74bde0aaca7c81c02152f9680a095f532ccf365aa46ea8be16848e
7
- data.tar.gz: c5152bb280c3a7afd284af2d8bbbea0d833baa517ae2ffe34b05918ee05fe9a2d13e4debf9cd078b8749e68d3eca12a6f26fced9d212106135ab7e45bde90e21
6
+ metadata.gz: b14e3d7c62d9f65bd83e693a9d866c473d386a1e06a118d54ea1a840eebeabe0c26c570046afcb91836c07fcd7dfecf7c63a247f6fa6f6b7e81d058d03c257e2
7
+ data.tar.gz: 572d3829ff054e6e3526f16b338c2fba8782fd73effcdcf302ccb5d0ceaed948162bd2699300fc740db5a2d5b5731fb8a6594285b2b461e8b3d90f999b63604f
@@ -38,7 +38,7 @@ left-to-right, _ignoring the typical order of operations._
38
38
 
39
39
  24
40
40
 
41
- > What is 3 plus 2 times 3?
41
+ > What is 3 plus 2 multiplied by 3?
42
42
 
43
43
  15 (i.e. not 9)
44
44
 
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.0.8.30"
2
+ VERSION = "2.0.8.31"
3
3
  end
@@ -2,34 +2,36 @@ open Core.Std
2
2
  open OUnit2
3
3
  open Etl
4
4
 
5
-
6
5
  let ae exp got _test_ctxt =
7
6
  let sexpr_of l = List.sexp_of_t (Tuple2.sexp_of_t Char.sexp_of_t Int.sexp_of_t) l in
8
7
  let printer l = Sexp.to_string (sexpr_of l) in
9
8
  assert_equal exp got ~printer
10
9
 
11
- let tests =
12
- ["transform one character">::
13
- ae [('a', 1)] (transform [(1,['A'])]);
14
- "transform multiple characters">::
15
- ae [('a', 1);('e', 1);('i', 1);('o', 1);('u', 1)] (transform [(1, ['A';'E';'I';'O';'U'])]);
16
- "transform multiple values">::
17
- ae [('a',1);('d',2);('e',1);('g',2);('i',1);('o',1);('u',1)] (transform [(1, ['A';'E';'I';'O';'U']);
18
- (2, ['D';'G'])]);
19
- "transform full dataset">::
20
- ae [('a',1);('b',3);('c',3);('d',2);('e',1);
21
- ('f',4);('g',2);('h',4);('i',1);('j',8);
22
- ('k',5);('l',1);('m',3);('n',1);('o',1);
23
- ('p',3);('q',10);('r',1);('s',1);('t',1);
24
- ('u',1);('v',4);('w',4);('x',8);('y',4);
25
- ('z',10)] (transform [(1,['A';'E';'I';'O';'U';'L';'N';'R';'S';'T']);
26
- (2,['D';'G']);
27
- (3,['B';'C';'M';'P']);
28
- (4,['F';'H';'V';'W';'Y']);
29
- (5,['K']);
30
- (8,['J';'X']);
31
- (10,['Q';'Z'])]);
32
- ]
10
+ let tests = [
11
+ "a single letter" >::
12
+ ae [('a', 1)]
13
+ (transform [(1, ['A'])]);
14
+ "single score with multiple letters" >::
15
+ ae [('a', 1); ('e', 1); ('i', 1); ('o', 1); ('u', 1)]
16
+ (transform [(1, ['A'; 'E'; 'I'; 'O'; 'U'])]);
17
+ "multiple scores with multiple letters" >::
18
+ ae [('a', 1); ('d', 2); ('e', 1); ('g', 2)]
19
+ (transform [(1, ['A'; 'E']); (2, ['D'; 'G'])]);
20
+ "multiple scores with differing numbers of letters" >::
21
+ ae [('a', 1); ('b', 3); ('c', 3); ('d', 2); ('e', 1);
22
+ ('f', 4); ('g', 2); ('h', 4); ('i', 1); ('j', 8);
23
+ ('k', 5); ('l', 1); ('m', 3); ('n', 1); ('o', 1);
24
+ ('p', 3); ('q', 10); ('r', 1); ('s', 1); ('t', 1);
25
+ ('u', 1); ('v', 4); ('w', 4); ('x', 8); ('y', 4);
26
+ ('z', 10)]
27
+ (transform [(1, ['A'; 'E'; 'I'; 'O'; 'U'; 'L'; 'N'; 'R'; 'S'; 'T']);
28
+ (2, ['D'; 'G']);
29
+ (3, ['B'; 'C'; 'M'; 'P']);
30
+ (4, ['F'; 'H'; 'V'; 'W'; 'Y']);
31
+ (5, ['K']);
32
+ (8, ['J'; 'X']);
33
+ (10, ['Q'; 'Z'])]);
34
+ ]
33
35
 
34
36
  let () =
35
- run_test_tt_main ("etl tests" >::: tests)
37
+ run_test_tt_main ("etl tests" >::: tests)
@@ -0,0 +1,19 @@
1
+ open Core.Std
2
+ open OUnit2
3
+ open Etl
4
+
5
+ let ae exp got _test_ctxt =
6
+ let sexpr_of l = List.sexp_of_t (Tuple2.sexp_of_t Char.sexp_of_t Int.sexp_of_t) l in
7
+ let printer l = Sexp.to_string (sexpr_of l) in
8
+ assert_equal exp got ~printer
9
+
10
+ let tests = [
11
+ (* TEST
12
+ "$description" >::
13
+ ae $expected
14
+ (transform $input);
15
+ END TEST *)
16
+ ]
17
+
18
+ let () =
19
+ run_test_tt_main ("etl tests" >::: tests)
@@ -1,4 +1,4 @@
1
- variable_name:
1
+ identifier_name:
2
2
  min_length:
3
3
  warning: 1
4
4
  error: 0
@@ -16,5 +16,6 @@ disabled_rules: # rule identifiers to exclude from running
16
16
  - function_body_length
17
17
  - line_length
18
18
  - trailing_comma
19
+ - force_try
19
20
 
20
21
  reporter: "json"
@@ -8,8 +8,9 @@ before_install:
8
8
  matrix:
9
9
  include:
10
10
  - script:
11
- - swiftlint lint --quiet >> lintreport.json
11
+ - swiftlint lint --quiet >> lintreport.json || true # Dont crash on errors
12
12
  - ls
13
+ - python -m json.tool lintreport.json
13
14
  - ./xswift-test-spm
14
15
  env: JOB=SPM
15
16
  os: osx
@@ -33,11 +33,14 @@ json.each do |object|
33
33
  shortFile.sub! "/Users/travis/build/exercism/xswift/", ''
34
34
  shortFile = shortFile.to_s || ''
35
35
  msg = object["reason"].to_s || ''
36
+ severity = object["severity"].to_s || ''
37
+ isError = severity == "Error"
36
38
  line = object["line"] || 1
37
39
  #only warn for files that were edited in this PR.
38
- if git.modified_files.include? shortFile
39
- shortFile.prepend("/") # get away from doing inline comments since they are buggy as of Sep-2016
40
- warn(msg, file: shortFile, line: line)
40
+ if isError
41
+ fail(msg, file: "/" + shortFile, line: line) if isError
42
+ elsif git.modified_files.include? shortFile
43
+ warn(msg, file: "/" + shortFile, line: line) unless isError
41
44
  else
42
45
  message(msg, file: shortFile, line: line)
43
46
  end
@@ -9,7 +9,7 @@ if
9
9
  let json = try? JSONSerialization.jsonObject(with: jsonData, options: []) ,
10
10
  let jsonDict = json as? [String: Any],
11
11
  let exercisesDict = jsonDict["exercises"] as? [[String:Any]],
12
- let exercises = exercisesDict.map({$0["slug"]}) as? [String],
12
+ let exercises = exercisesDict.map({ $0["slug"] }) as? [String],
13
13
  let deprecated = jsonDict["deprecated"] as? [String] {
14
14
 
15
15
  allProblems += exercises
@@ -2,7 +2,7 @@ import XCTest
2
2
  @testable import Accumulate
3
3
 
4
4
  private extension String {
5
- var length: Int {return self.characters.count}
5
+ var length: Int { return self.characters.count }
6
6
 
7
7
  func reverse() -> String {
8
8
  var result: String = ""
@@ -46,7 +46,7 @@ struct Acronym {
46
46
  var accumulate = ""
47
47
  var lastIndexAdded = 0
48
48
 
49
- for (index, each) in inString.characters.map({String($0)}).enumerated() {
49
+ for (index, each) in inString.characters.map({ String($0) }).enumerated() {
50
50
  if splitCamelcaseAt(each, withString: &previousLetter) {
51
51
  accumulate += inString.substringWithRangeInt(lastIndexAdded, end: index)+" " // inserts a space
52
52
  lastIndexAdded = index
@@ -67,10 +67,10 @@ struct Acronym {
67
67
 
68
68
  func splitStringToArray(_ inString: String) -> [String] {
69
69
 
70
- return inString.characters.split(whereSeparator: { splitAt($0) }).map {String($0)}
70
+ return inString.characters.split(whereSeparator: { splitAt($0) }).map { String($0) }
71
71
  }
72
72
 
73
- return splitStringToArray(insertSpaceAtCamelcase(inString)).map({$0.uppercased().substringWithRangeInt(0, end: 1)}).joined(separator: "")
73
+ return splitStringToArray(insertSpaceAtCamelcase(inString)).map({ $0.uppercased().substringWithRangeInt(0, end: 1) }).joined(separator: "")
74
74
  }
75
75
 
76
76
  }
@@ -41,8 +41,8 @@ private extension String {
41
41
  private func containsLetters(_ input: String) -> Bool {
42
42
  let abc = "abcdefghijklmnopqrstuvwxyz"
43
43
  var contains = false
44
- let inputStringCollection = input.characters.map({String($0)})
45
- let abcStringCollection = abc.characters.map({String($0)})
44
+ let inputStringCollection = input.characters.map({ String($0) })
45
+ let abcStringCollection = abc.characters.map({ String($0) })
46
46
 
47
47
  for each in inputStringCollection {
48
48
  abcStringCollection.forEach({
@@ -35,7 +35,7 @@ struct Crypto {
35
35
  let tempRoot = tempDouble.squareRoot()
36
36
  let tempCeil = ceil(tempRoot)
37
37
  let tempFloor = floor(tempRoot)
38
- if floorNoCeling { return Int(tempFloor)} else {
38
+ if floorNoCeling { return Int(tempFloor) } else {
39
39
  return Int(tempCeil)}
40
40
  }
41
41
 
@@ -1,5 +1,5 @@
1
1
  func == <T> (lh: CustomSet<T>, rh: CustomSet<T>) -> Bool {
2
- return lh.contents.keys.sorted {$0.hashValue < $1.hashValue} == rh.contents.keys.sorted {$0.hashValue < $1.hashValue}
2
+ return lh.contents.keys.sorted { $0.hashValue < $1.hashValue } == rh.contents.keys.sorted { $0.hashValue < $1.hashValue }
3
3
 
4
4
  }
5
5
  struct CustomSet<T:Hashable>:Equatable {
@@ -8,9 +8,9 @@ struct CustomSet<T:Hashable>:Equatable {
8
8
 
9
9
  fileprivate var contents = [Element: Bool]()
10
10
 
11
- var size: Int {return contents.count}
11
+ var size: Int { return contents.count }
12
12
 
13
- var toSortedArray: [Element] {return Array(contents.keys.sorted {$0.hashValue < $1.hashValue})}
13
+ var toSortedArray: [Element] { return Array(contents.keys.sorted { $0.hashValue < $1.hashValue }) }
14
14
 
15
15
  init<S: Sequence>(_ sequence: S) where S.Iterator.Element == Element {
16
16
  self.contents = [:]
@@ -34,7 +34,7 @@ struct CustomSet<T:Hashable>:Equatable {
34
34
  func intersection(_ item: CustomSet) -> CustomSet {
35
35
  var temp = [Element: Bool]()
36
36
  for each in Array(item.contents.keys) {
37
- guard let _ = contents[each] else {continue}
37
+ guard let _ = contents[each] else { continue }
38
38
  temp[each] = true
39
39
  }
40
40
  return CustomSet(temp.keys)
@@ -56,7 +56,7 @@ struct CustomSet<T:Hashable>:Equatable {
56
56
  }
57
57
  func isSupersetOf (_ item: CustomSet) -> Bool {
58
58
 
59
- return item.contents.count == item.contents.filter {self.contents.keys.contains($0.0)}.count
59
+ return item.contents.count == item.contents.filter { self.contents.keys.contains($0.0) }.count
60
60
 
61
61
  }
62
62
  func isDisjoint(_ item: CustomSet) -> Bool {
@@ -4,12 +4,12 @@ struct Dominoes {
4
4
  let doubles: [Bone]
5
5
 
6
6
  var chained: Bool {
7
- if singles.isEmpty && doubles.count == 1 {return true }
7
+ if singles.isEmpty && doubles.count == 1 { return true }
8
8
  let (success, result) = chainning(swapDuplicate(singles))
9
9
  if doubles.isEmpty {
10
10
  return success
11
11
  } else if success == true {
12
- return doubles.count == doubles.filter({each in return result.contains(where: {e in return e.value.head == each.value.head})}).count
12
+ return doubles.count == doubles.filter({ each in return result.contains(where: { e in return e.value.head == each.value.head }) }).count
13
13
  } else {
14
14
  return false
15
15
  }
@@ -31,7 +31,7 @@ struct Dominoes {
31
31
  private func chainning(_ input: [Bone]) -> (Bool, [Bone]) {
32
32
  var matched = input
33
33
 
34
- guard !matched.isEmpty else {return (false, [])}
34
+ guard !matched.isEmpty else { return (false, []) }
35
35
 
36
36
  let total = matched.count - 1
37
37
 
@@ -40,7 +40,7 @@ struct Dominoes {
40
40
  matched[index].connect(matched[innerIndex])
41
41
  }
42
42
  }
43
- return (matched.filter({$0.connected >= 2}).count == matched.count) ?
43
+ return (matched.filter({ $0.connected >= 2 }).count == matched.count) ?
44
44
  (true, matched) : (false, [])
45
45
  }
46
46
 
@@ -74,8 +74,8 @@ class Bone: CustomStringConvertible, Equatable {
74
74
  @discardableResult
75
75
  func connect(_ input: Bone) -> Bool {
76
76
 
77
- guard self !== input else {return false}
78
- guard self !== input.connectedTo else {return false}
77
+ guard self !== input else { return false }
78
+ guard self !== input.connectedTo else { return false }
79
79
 
80
80
  var toReturn = false
81
81
 
@@ -6,7 +6,7 @@ func flattenArray<T>(_ list: [Any?]) -> [T] {
6
6
 
7
7
  func extractArrayElements(array: [Any?]) {
8
8
 
9
- for element in array.flatMap({$0}) {
9
+ for element in array.flatMap({ $0 }) {
10
10
 
11
11
  let anyObjectArray = element as? [Any?]
12
12
 
@@ -37,13 +37,13 @@ private extension tm {
37
37
  }
38
38
  if addZero {
39
39
  return "0\(input)"
40
- } else {return String(input)}
40
+ } else { return String(input) }
41
41
 
42
42
  }
43
43
 
44
44
  var description: String {
45
45
 
46
- let date = [year, month, day, time.hour, time.mins, time.secs].map {addLeadingZero($0)}
46
+ let date = [year, month, day, time.hour, time.mins, time.secs].map { addLeadingZero($0) }
47
47
 
48
48
  return date[0] + "-" + date[1] + "-" + date[2] + "T" + date[3] + ":" + date[4] + ":" + date[5]
49
49
  }
@@ -72,10 +72,10 @@ struct Gigasecond: Equatable, CustomStringConvertible {
72
72
  }
73
73
  private func parse(_ input: String) -> tm? {
74
74
 
75
- let dateTime = input.characters.split(separator: "T").map {String($0)}
75
+ let dateTime = input.characters.split(separator: "T").map { String($0) }
76
76
  if dateTime.count > 1 {
77
- let date = dateTime[0].characters.split(separator: "-").map {String($0)}
78
- let time = dateTime[1].characters.split(separator: ":").map {String($0)}
77
+ let date = dateTime[0].characters.split(separator: "-").map { String($0) }
78
+ let time = dateTime[1].characters.split(separator: ":").map { String($0) }
79
79
  if date.count == 3 && time.count == date.count {
80
80
 
81
81
  let year = Int32(date[0]) ?? 0
@@ -27,7 +27,7 @@ struct Grains {
27
27
  let numbers = (1...64).map { $0 }
28
28
 
29
29
  return numbers.reduce(UInt64(0)) {
30
- guard let squared = try? square($1) else {return $0}
30
+ guard let squared = try? square($1) else { return $0 }
31
31
  return $0 + squared
32
32
  }
33
33
  }
@@ -3,9 +3,9 @@ import Foundation
3
3
  struct Luhn {
4
4
 
5
5
  var number: Int64 = 0
6
- var addends: [Int] { return addendsFunc(number)}
7
- var checksum: Int {return addends.reduce(0, +) }
8
- var isValid: Bool { return checksum % 10 == 0}
6
+ var addends: [Int] { return addendsFunc(number) }
7
+ var checksum: Int { return addends.reduce(0, +) }
8
+ var isValid: Bool { return checksum % 10 == 0 }
9
9
 
10
10
  init(_ num: Int64) {
11
11
  self.number = num
@@ -54,7 +54,7 @@ struct Luhn {
54
54
 
55
55
  let tempString = "\(num)"
56
56
 
57
- return oddIndexInt64Minus9(Array(tempString.characters).map {char2Int($0)})
57
+ return oddIndexInt64Minus9(Array(tempString.characters).map { char2Int($0) })
58
58
  }
59
59
 
60
60
  }
@@ -67,7 +67,7 @@ extension Date:CustomStringConvertible {
67
67
 
68
68
  var description: String {
69
69
 
70
- let date = [year, month, day, hour, mins, secs].map {addLeadingZero($0)}
70
+ let date = [year, month, day, hour, mins, secs].map { addLeadingZero($0) }
71
71
 
72
72
  let dateOnly = date[0] + "-" + date[1] + "-" + date[2]
73
73
  let dateTime = dateOnly + "T" + date[3] + ":" + date[4] + ":" + date[5]
@@ -97,8 +97,8 @@ extension Date {
97
97
  var minute = Int32()
98
98
  var second = Int32()
99
99
 
100
- let dateTime = input.characters.split(separator: "T").map {String($0)}
101
- let date = dateTime[0].characters.split(separator: "-").map {String($0)}
100
+ let dateTime = input.characters.split(separator: "T").map { String($0) }
101
+ let date = dateTime[0].characters.split(separator: "-").map { String($0) }
102
102
  if date.count == 3 {
103
103
  year = Int32(date[0]) ?? 0
104
104
  month = Int32(date[1]) ?? 0
@@ -106,7 +106,7 @@ extension Date {
106
106
  }
107
107
 
108
108
  if dateTime.count == 2 {
109
- let time = dateTime[1].characters.split(separator: ":").map {String($0)}
109
+ let time = dateTime[1].characters.split(separator: ":").map { String($0) }
110
110
  if time.count == 3 {
111
111
  hour = Int32(time[0]) ?? 0
112
112
  minute = Int32(time[1]) ?? 0
@@ -134,7 +134,7 @@ struct Meetup {
134
134
 
135
135
  let starDay = dateStart.weekday
136
136
  var month = Array(dateStart.day ... dateEnd.day)
137
- month = month.map {(($0 + 5 + starDay) % 7) + 1 }
137
+ month = month.map { (($0 + 5 + starDay) % 7) + 1 }
138
138
 
139
139
  for (index, eachDay) in month.enumerated() {
140
140
  dateMonthWeekDays.append([Int32(index + 1), eachDay])
@@ -144,11 +144,11 @@ struct Meetup {
144
144
 
145
145
  if which == "teenth" {
146
146
  let teenthRange = Array(dateMonthWeekDays[13...19])
147
- let teenth = teenthRange.filter({$0[1] == Int32(dayOfTheWeek) })[0][0]
147
+ let teenth = teenthRange.filter({ $0[1] == Int32(dayOfTheWeek) })[0][0]
148
148
  return Date(from: "\(dateStart.year)-\(dateStart.month)-\(teenth)") ?? Date()
149
149
 
150
150
  }
151
- let count = dateMonthWeekDays.filter({$0[1] == Int32(dayOfTheWeek) }).count
151
+ let count = dateMonthWeekDays.filter({ $0[1] == Int32(dayOfTheWeek) }).count
152
152
  var dayIndex: Int = 0
153
153
  switch dateInput {
154
154
  case "1st": dayIndex = 0
@@ -160,7 +160,7 @@ struct Meetup {
160
160
  default: dayIndex = -1
161
161
  }
162
162
 
163
- let first2last = dateMonthWeekDays.filter({$0[1] == Int32(dayOfTheWeek) })[dayIndex][0]
163
+ let first2last = dateMonthWeekDays.filter({ $0[1] == Int32(dayOfTheWeek) })[dayIndex][0]
164
164
 
165
165
  return Date(from:"\(dateStart.year)-\(dateStart.month)-\(first2last)") ?? Date()
166
166
  }
@@ -77,7 +77,7 @@ struct OCR {
77
77
  }
78
78
 
79
79
  func patternForGrouping(_ grouping: [String]) -> String {
80
- guard let number = patterns.index(where: {$0 == grouping}) else {
80
+ guard let number = patterns.index(where: { $0 == grouping }) else {
81
81
  return "?"
82
82
  }
83
83
  return "\(number)"
@@ -24,7 +24,7 @@ struct Octal {
24
24
  var tempInt: Int = 0
25
25
  for (inx, each) in orderedInput.enumerated() {
26
26
  let tempCharInt = Int("\(each)") ?? 0
27
- if tempCharInt > 7 {return 0}
27
+ if tempCharInt > 7 { return 0 }
28
28
  let tempOctPower = Int(pow(Double(8), Double(inx)))
29
29
  tempInt += tempOctPower * tempCharInt
30
30
  }
@@ -22,7 +22,7 @@ struct NumberClassifier {
22
22
  func aliquotSum (_ input: Int) -> Int {
23
23
  let array = Array(1..<(input-1))
24
24
 
25
- return array.filter({input % $0 == 0}).reduce(0, +)
25
+ return array.filter({ input % $0 == 0 }).reduce(0, +)
26
26
  }
27
27
 
28
28
  init(number: Int) {
@@ -16,13 +16,13 @@ private extension String {
16
16
  struct PigLatin {
17
17
 
18
18
  static func translate (_ word: String) -> String {
19
- return word.components(separatedBy: " ").map {self.translateWord($0)}.joined(separator: " ")
19
+ return word.components(separatedBy: " ").map { self.translateWord($0) }.joined(separator: " ")
20
20
  }
21
21
 
22
22
  static func translateWord(_ word: String) -> String {
23
23
 
24
24
  func wordStartsWithPrefixes(_ word: String, prefixes: [String]) -> Bool {
25
- return 0 < prefixes.filter {word.hasPrefix($0)}.count
25
+ return 0 < prefixes.filter { word.hasPrefix($0) }.count
26
26
  }
27
27
 
28
28
  func wordStartsWithVowelLike(_ word: String) -> Bool {
@@ -34,7 +34,7 @@ struct PigLatin {
34
34
  return word.substring(from: index).hasPrefix("qu")
35
35
  }
36
36
 
37
- if wordStartsWithVowelLike(word) {return word + "ay"}
37
+ if wordStartsWithVowelLike(word) { return word + "ay" }
38
38
  if wordStartsWithPrefixes(word, prefixes: ["thr", "sch"]) {
39
39
  return (word.substringFromIndexInt(3) + word.substringWithRangeInt(0..<3) + "ay") }
40
40
 
@@ -27,7 +27,7 @@ struct Poker {
27
27
  }
28
28
 
29
29
  guard let topHand = (pokerHandsParsed.sorted(by: >)).first,
30
- let indexTop = pokerHandsParsed.index(of: topHand) else {return nil}
30
+ let indexTop = pokerHandsParsed.index(of: topHand) else { return nil }
31
31
 
32
32
  return hands[indexTop]
33
33
 
@@ -60,7 +60,7 @@ enum HandRank {
60
60
  }
61
61
 
62
62
  static func parsePairs(_ inputHand: PokerHand) -> [(rank: Rank, count: Int)] {
63
- let ranks = inputHand.hand.map({$0.rank})
63
+ let ranks = inputHand.hand.map({ $0.rank })
64
64
  let rankSet = Set(ranks)
65
65
  var toReturn = [Rank: Int]()
66
66
  for each in ranks {
@@ -68,7 +68,7 @@ enum HandRank {
68
68
  toReturn[each] = (toReturn[each] ?? 0) + 1
69
69
  }
70
70
  }
71
- let result = toReturn.map({key, value in return (rank:key, count:value)}).sorted(by: {
71
+ let result = toReturn.map({ key, value in return (rank:key, count:value) }).sorted(by: {
72
72
  (one, two) in
73
73
  return one.count == two.count ? one.rank > two.rank : one.count > two.count
74
74
  })
@@ -76,22 +76,22 @@ enum HandRank {
76
76
  }
77
77
 
78
78
  static func isFlush(_ inputHand: PokerHand) -> (bool: Bool, suit: Suit) {
79
- let suits = inputHand.hand.map({$0.suit})
79
+ let suits = inputHand.hand.map({ $0.suit })
80
80
  let first = suits[0]
81
81
  for each in suits {
82
- guard first == each else { return (false, .None)}
82
+ guard first == each else { return (false, .None) }
83
83
  }
84
84
  return (true, first)
85
85
  }
86
86
 
87
87
  static func isStraight(_ inputHand: PokerHand) -> (bool: Bool, highest: Rank) {
88
- let sorted = inputHand.hand.sorted(by: {$0.rank < $1.rank})
88
+ let sorted = inputHand.hand.sorted(by: { $0.rank < $1.rank })
89
89
  let first = sorted[0].rank.rawValue
90
90
  for (index, each) in sorted.enumerated() {
91
91
  if each.rank.rawValue != index + first {
92
92
  // checks for Ace as the lowest card
93
- guard let aceIndex = inputHand.hand.index(where: {$0.rank.rawValue == 14})else {return (false, .ace)}
94
- var replacedAced = inputHand.hand.map({$0.rank.rawValue})
93
+ guard let aceIndex = inputHand.hand.index(where: { $0.rank.rawValue == 14 })else { return (false, .ace) }
94
+ var replacedAced = inputHand.hand.map({ $0.rank.rawValue })
95
95
  replacedAced[aceIndex] = 1 // swaps ace value to lowest
96
96
  replacedAced.sort()
97
97
  let firstVal = replacedAced[0]
@@ -255,11 +255,11 @@ struct PokerHand {
255
255
  var handParsed: [PlayingCard] = []
256
256
 
257
257
  for each in stringHand.split(" ") {
258
- guard let card = PlayingCard(each) else {return nil}
258
+ guard let card = PlayingCard(each) else { return nil }
259
259
  handParsed.append(card)
260
260
  }
261
261
 
262
- if handParsed.count == 5 {self.hand = handParsed } else {return nil}
262
+ if handParsed.count == 5 { self.hand = handParsed } else { return nil }
263
263
  }
264
264
  }
265
265
  extension PokerHand : Equatable, Comparable {}
@@ -14,11 +14,11 @@ struct Triplet {
14
14
  self.c = c
15
15
  }
16
16
 
17
- var sum: Int {return a + b + c }
17
+ var sum: Int { return a + b + c }
18
18
 
19
- var product: Int {return a * b * c }
19
+ var product: Int { return a * b * c }
20
20
 
21
- var isPythagorean: Bool {return pow(Double(a), 2) + pow(Double(b), 2) == pow(Double(c), 2)}
21
+ var isPythagorean: Bool { return pow(Double(a), 2) + pow(Double(b), 2) == pow(Double(c), 2) }
22
22
 
23
23
  static func Where(_ minFactor: Int = 1, maxFactor: Int, sum: Int = 0) -> [Triplet] {
24
24
 
@@ -20,19 +20,19 @@ class PythagoreanTripletTests: XCTestCase {
20
20
 
21
21
  func testTripletsUpTo10() {
22
22
  let triplets = Triplet.Where(maxFactor: 10)
23
- let products = triplets.map {$0.product}.sorted(by: <)
23
+ let products = triplets.map { $0.product }.sorted(by: <)
24
24
  XCTAssertEqual([60, 480], products)
25
25
  }
26
26
 
27
27
  func testTripletsFrom11UpTo20() {
28
28
  let triplets = Triplet.Where(11, maxFactor: 20)
29
- let products = triplets.map {$0.product}.sorted(by: <)
29
+ let products = triplets.map { $0.product }.sorted(by: <)
30
30
  XCTAssertEqual([3840], products)
31
31
  }
32
32
 
33
33
  func testTripletsWhereSumX() {
34
34
  let triplets = Triplet.Where( maxFactor: 100, sum: 180)
35
- let products = triplets.map {$0.product}.sorted(by: <)
35
+ let products = triplets.map { $0.product }.sorted(by: <)
36
36
  XCTAssertEqual([118_080, 168_480, 202_500], products)
37
37
  }
38
38
 
@@ -7,9 +7,9 @@ struct SecretHandshake {
7
7
  self.commandValue = commandValue
8
8
  }
9
9
 
10
- var shouldReverse: Bool {return (commandValue & 16) != 0}
10
+ var shouldReverse: Bool { return (commandValue & 16) != 0 }
11
11
 
12
- var commands: [String] {return commandsFunc()}
12
+ var commands: [String] { return commandsFunc() }
13
13
 
14
14
  private func commandsFunc() -> [String] {
15
15
  var commands = [String]()
@@ -7,7 +7,7 @@ struct Series {
7
7
  }
8
8
 
9
9
  func slices(_ chunkSize: Int) -> [[Int]] {
10
- var numberStringArray = Array(numberString.characters).map {Int("\($0)") ?? 0}
10
+ var numberStringArray = Array(numberString.characters).map { Int("\($0)") ?? 0 }
11
11
  let count = numberStringArray.count
12
12
  var start = 0
13
13
  var end = chunkSize
@@ -4,13 +4,13 @@ struct Sieve {
4
4
  self.value = num
5
5
  }
6
6
 
7
- var primes: [Int] {return primesFunc(self.value ) }
7
+ var primes: [Int] { return primesFunc(self.value ) }
8
8
 
9
9
  func primesFunc(_ limit: Int) -> [Int] {
10
10
 
11
- if limit < 2 { return []} else {
11
+ if limit < 2 { return [] } else {
12
12
  let tempArray = Array(2...limit)
13
- return tempArray.filter {Sieve.onlyDivisorSelf($0)}
13
+ return tempArray.filter { Sieve.onlyDivisorSelf($0) }
14
14
  }
15
15
  }
16
16
 
@@ -26,7 +26,7 @@ struct Sieve {
26
26
  }
27
27
  divisor += 1
28
28
  }
29
- if primes.count == 1 {return true} else {return false}
29
+ if primes.count == 1 { return true } else { return false }
30
30
  }
31
31
 
32
32
  }
@@ -11,15 +11,15 @@ private extension XCTest {
11
11
  class StrainTests: XCTestCase {
12
12
  func testEmptyKeep() {
13
13
 
14
- XCTAssertTrue ([].keep {each -> Bool in each < 10}.isEmpty)
14
+ XCTAssertTrue ([].keep { each -> Bool in each < 10 }.isEmpty)
15
15
  }
16
16
 
17
17
  func testKeepEverything() {
18
- XCTAssertEqual([1, 2, 3], [1, 2, 3].keep {each -> Bool in each < 10})
18
+ XCTAssertEqual([1, 2, 3], [1, 2, 3].keep { each -> Bool in each < 10 })
19
19
  }
20
20
 
21
21
  func testKeepFirstAndLast() {
22
- XCTAssertEqual([1, 3], [1, 2, 3].keep { each -> Bool in (each % 2 != 0)})
22
+ XCTAssertEqual([1, 3], [1, 2, 3].keep { each -> Bool in (each % 2 != 0) })
23
23
  }
24
24
 
25
25
  func testKeepNeitherFirstNorLast() {
@@ -28,7 +28,7 @@ class StrainTests: XCTestCase {
28
28
 
29
29
  func testKeepStrings() {
30
30
  let words = ["apple", "zebra", "banana", "zombies", "cherimoya", "zealot"]
31
- let result = words.keep {each -> Bool in (each as String).hasPrefix("z")}
31
+ let result = words.keep { each -> Bool in (each as String).hasPrefix("z") }
32
32
  XCTAssertEqual(["zebra", "zombies", "zealot"], result)
33
33
  }
34
34
 
@@ -42,29 +42,29 @@ class StrainTests: XCTestCase {
42
42
  [2, 2, 1],
43
43
  [1, 2, 5]
44
44
  ]
45
- let result = rows.keep { each -> Bool in (each as [Int]).contains(5)}
45
+ let result = rows.keep { each -> Bool in (each as [Int]).contains(5) }
46
46
  XCTAssertEqualMultiArray([[5, 5, 5], [5, 1, 2], [1, 5, 2], [1, 2, 5]], result)
47
47
  }
48
48
 
49
49
  func testEmptyDiscard() {
50
- XCTAssertEqual([], [].discard {each -> Bool in each < 10})
50
+ XCTAssertEqual([], [].discard { each -> Bool in each < 10 })
51
51
  }
52
52
 
53
53
  func testDiscardNothing() {
54
- XCTAssertEqual([1, 2, 3], [1, 2, 3].discard {each -> Bool in each > 10})
54
+ XCTAssertEqual([1, 2, 3], [1, 2, 3].discard { each -> Bool in each > 10 })
55
55
  }
56
56
 
57
57
  func testDiscardFirstAndLast() {
58
- XCTAssertEqual([2], [1, 2, 3].discard {each -> Bool in (each % 2 != 0)})
58
+ XCTAssertEqual([2], [1, 2, 3].discard { each -> Bool in (each % 2 != 0) })
59
59
  }
60
60
 
61
61
  func testDiscardNeitherFirstNorLast() {
62
- XCTAssertEqual([1, 3, 5], [1, 2, 3, 4, 5].discard { each -> Bool in (each % 2 == 0)})
62
+ XCTAssertEqual([1, 3, 5], [1, 2, 3, 4, 5].discard { each -> Bool in (each % 2 == 0) })
63
63
  }
64
64
 
65
65
  func testDiscardStrings() {
66
66
  let words = ["apple", "zebra", "banana", "zombies", "cherimoya", "zealot"]
67
- let result = words.discard {each -> Bool in (each as String).hasPrefix("z") }
67
+ let result = words.discard { each -> Bool in (each as String).hasPrefix("z") }
68
68
  XCTAssertEqual(["apple", "banana", "cherimoya"], result)
69
69
  }
70
70
 
@@ -78,7 +78,7 @@ class StrainTests: XCTestCase {
78
78
  [2, 2, 1],
79
79
  [1, 2, 5]
80
80
  ]
81
- let result = rows.discard { each -> Bool in (each as [Int]).contains(5)}
81
+ let result = rows.discard { each -> Bool in (each as [Int]).contains(5) }
82
82
  XCTAssertEqualMultiArray([[1, 2, 3], [2, 1, 2], [2, 2, 1]], result)
83
83
  }
84
84
 
@@ -122,7 +122,7 @@ struct Tournament {
122
122
  let tempVal = teams[each]!
123
123
  sortByValue.append((each, tempVal.score, tempVal.played))
124
124
  }
125
- sortByValue.sort { $0.score == $1.score ? $0.mp > $1.mp : $0.score > $1.score }
125
+ sortByValue.sort { $0.score == $1.score ? $0.mp > $1.mp : $0.score > $1.score }
126
126
  var sortedKeys = [String]()
127
127
  for each in sortByValue {
128
128
  sortedKeys.append(each.0)
@@ -161,7 +161,7 @@ struct Tournament {
161
161
  var outcome: Outcome = Outcome.err
162
162
 
163
163
  // alternative to .componentsSeparatedByString
164
- let textArrayLines = inStream.characters.split {$0 == "\n"}.map { String($0) }
164
+ let textArrayLines = inStream.characters.split { $0 == "\n" }.map { String($0) }
165
165
 
166
166
  for line in textArrayLines {
167
167
  let parts = line.trimWhiteSpace().components(separatedBy: ";")
@@ -1,7 +1,7 @@
1
1
  struct WordCount {
2
2
 
3
3
  func splitStringToArray(_ inString: String) -> [String] {
4
- return inString.characters.split(whereSeparator: { splitAt($0) }).map {String($0)}
4
+ return inString.characters.split(whereSeparator: { splitAt($0) }).map { String($0) }
5
5
  }
6
6
 
7
7
  func splitAt(_ characterToCompare: Character, charToSplitAt: String = " !&$%^&,:") -> Bool {
@@ -53,10 +53,10 @@ struct WordProblem {
53
53
  "divided by": "/"]
54
54
 
55
55
  private let funcs =
56
- ["+": {(a: Int, b: Int) -> Int in return a + b},
57
- "-": {(a: Int, b: Int) -> Int in return a - b},
58
- "*": {(a: Int, b: Int) -> Int in return a * b},
59
- "/": {(a: Int, b: Int) -> Int in return a / b}]
56
+ ["+": { (a: Int, b: Int) -> Int in return a + b },
57
+ "-": { (a: Int, b: Int) -> Int in return a - b },
58
+ "*": { (a: Int, b: Int) -> Int in return a * b },
59
+ "/": { (a: Int, b: Int) -> Int in return a / b }]
60
60
  func answer() throws -> Int {
61
61
  guard let toReturn = calculate(textIn) else {
62
62
  throw CalculateError.error
@@ -111,7 +111,7 @@ struct WordProblem {
111
111
 
112
112
  var newTextIn = Array(textInp.characters)
113
113
  newTextIn = newTextIn.filter(checkCharInSet)
114
- let newTextInString: [String] = newTextIn.map {String($0)}
114
+ let newTextInString: [String] = newTextIn.map { String($0) }
115
115
  return newTextInString.joined(separator: "").trimWhiteSpace()
116
116
 
117
117
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trackler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.8.30
4
+ version: 2.0.8.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katrina Owen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-24 00:00:00.000000000 Z
11
+ date: 2017-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -5935,6 +5935,7 @@ files:
5935
5935
  - tracks/ocaml/tools/test-generator/templates/connect/template.ml
5936
5936
  - tracks/ocaml/tools/test-generator/templates/difference-of-squares/template.ml
5937
5937
  - tracks/ocaml/tools/test-generator/templates/dominoes/template.ml
5938
+ - tracks/ocaml/tools/test-generator/templates/etl/template.ml
5938
5939
  - tracks/ocaml/tools/test-generator/templates/hamming/template.ml
5939
5940
  - tracks/ocaml/tools/test-generator/templates/hello-world/template.ml
5940
5941
  - tracks/ocaml/tools/test-generator/templates/leap/template.ml