trackler 2.0.8.20 → 2.0.8.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/tracks/csharp/.travis.yml +1 -4
  4. data/tracks/csharp/exercises/accumulate/HINTS.md +3 -0
  5. data/tracks/csharp/exercises/allergies/HINTS.md +3 -0
  6. data/tracks/csharp/exercises/alphametics/HINTS.md +5 -0
  7. data/tracks/csharp/exercises/bank-account/HINTS.md +3 -0
  8. data/tracks/csharp/exercises/beer-song/HINTS.md +2 -0
  9. data/tracks/csharp/exercises/clock/HINTS.md +4 -0
  10. data/tracks/csharp/exercises/custom-set/HINTS.md +4 -0
  11. data/tracks/csharp/exercises/difference-of-squares/HINTS.md +4 -0
  12. data/tracks/csharp/exercises/diffie-hellman/HINTS.md +3 -0
  13. data/tracks/csharp/exercises/food-chain/HINTS.md +2 -0
  14. data/tracks/csharp/exercises/forth/HINTS.md +2 -0
  15. data/tracks/csharp/exercises/hangman/HINTS.md +3 -0
  16. data/tracks/csharp/exercises/leap/Example.cs +2 -2
  17. data/tracks/csharp/exercises/leap/Leap.cs +2 -2
  18. data/tracks/csharp/exercises/leap/LeapTest.cs +4 -4
  19. data/tracks/csharp/exercises/sgf-parsing/HINTS.md +2 -0
  20. data/tracks/csharp/exercises/simple-linked-list/HINTS.md +3 -0
  21. data/tracks/csharp/exercises/sublist/HINTS.md +3 -0
  22. data/tracks/csharp/exercises/twelve-days/HINTS.md +2 -0
  23. data/tracks/csharp/exercises/variable-length-quantity/HINTS.md +3 -0
  24. data/tracks/csharp/exercises/wordy/HINTS.md +2 -0
  25. data/tracks/csharp/generators/BooleanTestMethod.cs +36 -0
  26. data/tracks/csharp/generators/Exercises/Exercise.cs +13 -2
  27. data/tracks/csharp/generators/Exercises/LeapExercise.cs +3 -26
  28. data/tracks/csharp/generators/Program.cs +7 -8
  29. data/tracks/csharp/generators/TestClassNameTransformer.cs +9 -0
  30. data/tracks/csharp/generators/TestClassRenderer.cs +1 -1
  31. data/tracks/csharp/generators/TestedClassNameTransformer.cs +11 -0
  32. data/tracks/csharp/generators/TestedMethodNameTransformer.cs +9 -0
  33. data/tracks/csharp/generators/To.cs +3 -0
  34. data/tracks/elixir/config.json +8 -0
  35. data/tracks/elixir/exercises/ocr-numbers/example.exs +47 -0
  36. data/tracks/elixir/exercises/ocr-numbers/ocr_numbers.exs +10 -0
  37. data/tracks/elixir/exercises/ocr-numbers/ocr_numbers_test.exs +254 -0
  38. data/tracks/go/exercises/say/example.go +2 -0
  39. data/tracks/go/exercises/say/say_test.go +8 -0
  40. data/tracks/go/exercises/scrabble-score/scrabble_score_test.go +6 -4
  41. data/tracks/go/exercises/secret-handshake/secret_handshake_test.go +4 -1
  42. data/tracks/go/exercises/sieve/example.go +2 -0
  43. data/tracks/go/exercises/sieve/sieve_test.go +8 -0
  44. data/tracks/go/exercises/simple-cipher/example.go +3 -1
  45. data/tracks/go/exercises/simple-cipher/simple_cipher_test.go +8 -0
  46. data/tracks/go/exercises/sum-of-multiples/example.go +2 -0
  47. data/tracks/go/exercises/sum-of-multiples/sum_of_multiples_test.go +8 -0
  48. data/tracks/go/exercises/tournament/tournament_test.go +3 -1
  49. data/tracks/go/exercises/transpose/example.go +2 -0
  50. data/tracks/go/exercises/transpose/transpose_test.go +8 -0
  51. data/tracks/go/exercises/tree-building/tree_test.go +6 -6
  52. data/tracks/go/exercises/triangle/triangle_test.go +6 -6
  53. data/tracks/haskell/exercises/atbash-cipher/src/Atbash.hs +2 -2
  54. data/tracks/haskell/exercises/largest-series-product/src/Series.hs +1 -1
  55. data/tracks/haskell/exercises/linked-list/src/Deque.hs +4 -4
  56. data/tracks/haskell/exercises/list-ops/src/ListOps.hs +7 -7
  57. data/tracks/haskell/exercises/luhn/src/Luhn.hs +10 -5
  58. data/tracks/haskell/exercises/matrix/src/Matrix.hs +10 -10
  59. data/tracks/haskell/exercises/minesweeper/src/Minesweeper.hs +1 -1
  60. data/tracks/haskell/exercises/nth-prime/src/Prime.hs +2 -1
  61. data/tracks/haskell/exercises/nucleotide-count/src/DNA.hs +1 -1
  62. data/tracks/haskell/exercises/ocr-numbers/src/OCR.hs +1 -1
  63. data/tracks/haskell/exercises/pascals-triangle/src/Triangle.hs +1 -1
  64. data/tracks/haskell/exercises/phone-number/src/Phone.hs +1 -1
  65. data/tracks/haskell/exercises/pig-latin/src/PigLatin.hs +1 -1
  66. data/tracks/haskell/exercises/prime-factors/src/PrimeFactors.hs +1 -1
  67. data/tracks/kotlin/exercises/_template/build.gradle +1 -1
  68. data/tracks/kotlin/exercises/accumulate/build.gradle +1 -1
  69. data/tracks/kotlin/exercises/acronym/build.gradle +1 -1
  70. data/tracks/kotlin/exercises/allergies/build.gradle +1 -1
  71. data/tracks/kotlin/exercises/anagram/build.gradle +1 -1
  72. data/tracks/kotlin/exercises/atbash-cipher/build.gradle +1 -1
  73. data/tracks/kotlin/exercises/beer-song/build.gradle +1 -1
  74. data/tracks/kotlin/exercises/binary/build.gradle +1 -1
  75. data/tracks/kotlin/exercises/binary-search/build.gradle +1 -1
  76. data/tracks/kotlin/exercises/bob/build.gradle +1 -1
  77. data/tracks/kotlin/exercises/bracket-push/build.gradle +1 -1
  78. data/tracks/kotlin/exercises/change/build.gradle +1 -1
  79. data/tracks/kotlin/exercises/difference-of-squares/build.gradle +1 -1
  80. data/tracks/kotlin/exercises/etl/build.gradle +1 -1
  81. data/tracks/kotlin/exercises/flatten-array/build.gradle +1 -1
  82. data/tracks/kotlin/exercises/gigasecond/build.gradle +1 -1
  83. data/tracks/kotlin/exercises/grade-school/build.gradle +1 -1
  84. data/tracks/kotlin/exercises/hamming/build.gradle +1 -1
  85. data/tracks/kotlin/exercises/hello-world/build.gradle +1 -1
  86. data/tracks/kotlin/exercises/hexadecimal/build.gradle +1 -1
  87. data/tracks/kotlin/exercises/isogram/build.gradle +1 -1
  88. data/tracks/kotlin/exercises/largest-series-product/build.gradle +1 -1
  89. data/tracks/kotlin/exercises/leap/build.gradle +1 -1
  90. data/tracks/kotlin/exercises/linked-list/build.gradle +1 -1
  91. data/tracks/kotlin/exercises/luhn/build.gradle +1 -1
  92. data/tracks/kotlin/exercises/nth-prime/build.gradle +1 -1
  93. data/tracks/kotlin/exercises/nucleotide-count/build.gradle +1 -1
  94. data/tracks/kotlin/exercises/pangram/build.gradle +1 -1
  95. data/tracks/kotlin/exercises/pascals-triangle/build.gradle +1 -1
  96. data/tracks/kotlin/exercises/perfect-numbers/build.gradle +1 -1
  97. data/tracks/kotlin/exercises/phone-number/build.gradle +1 -1
  98. data/tracks/kotlin/exercises/pig-latin/build.gradle +1 -1
  99. data/tracks/kotlin/exercises/raindrops/build.gradle +1 -1
  100. data/tracks/kotlin/exercises/react/build.gradle +1 -1
  101. data/tracks/kotlin/exercises/react/src/test/kotlin/ReactTest.kt +9 -9
  102. data/tracks/kotlin/exercises/rna-transcription/build.gradle +1 -1
  103. data/tracks/kotlin/exercises/robot-name/build.gradle +1 -1
  104. data/tracks/kotlin/exercises/roman-numerals/build.gradle +1 -1
  105. data/tracks/kotlin/exercises/scrabble-score/build.gradle +1 -1
  106. data/tracks/kotlin/exercises/series/build.gradle +1 -1
  107. data/tracks/kotlin/exercises/sieve/build.gradle +1 -1
  108. data/tracks/kotlin/exercises/simple-cipher/build.gradle +1 -1
  109. data/tracks/kotlin/exercises/space-age/build.gradle +1 -1
  110. data/tracks/kotlin/exercises/strain/build.gradle +1 -1
  111. data/tracks/kotlin/exercises/triangle/build.gradle +1 -1
  112. data/tracks/kotlin/exercises/word-count/build.gradle +1 -1
  113. data/tracks/perl6/.gitmodules +3 -0
  114. data/tracks/perl6/.travis.yml +1 -0
  115. data/tracks/perl6/config.json +8 -11
  116. data/tracks/perl6/exercises/accumulate/Accumulate.pm6 +1 -0
  117. data/tracks/perl6/exercises/accumulate/Example.pm +8 -8
  118. data/tracks/perl6/exercises/accumulate/accumulate.t +27 -12
  119. data/tracks/perl6/exercises/all-your-base/AllYourBase.pm6 +1 -0
  120. data/tracks/perl6/exercises/all-your-base/Example.pm +46 -0
  121. data/tracks/perl6/exercises/all-your-base/all-your-base.t +163 -0
  122. data/tracks/perl6/exercises/bob/Bob.pm6 +13 -0
  123. data/tracks/perl6/exercises/bob/Example.pm +9 -9
  124. data/tracks/perl6/exercises/bob/bob.t +201 -34
  125. data/tracks/perl6/exercises/grade-school/Example.pm +13 -12
  126. data/tracks/perl6/exercises/grade-school/GradeSchool.pm6 +4 -0
  127. data/tracks/perl6/exercises/grade-school/grade-school.t +38 -19
  128. data/tracks/perl6/exercises/hello-world/Example.pm +3 -3
  129. data/tracks/perl6/exercises/hello-world/HelloWorld.pm6 +2 -2
  130. data/tracks/perl6/exercises/hello-world/hello-world.t +41 -10
  131. data/tracks/perl6/exercises/linked-list/Example.pm6 +33 -34
  132. data/tracks/perl6/exercises/linked-list/LinkedList.pm6 +1 -0
  133. data/tracks/perl6/exercises/linked-list/linked-list.t +32 -22
  134. data/tracks/perl6/exercises/robot-name/Example.pm +8 -15
  135. data/tracks/perl6/exercises/robot-name/Robot.pm6 +1 -0
  136. data/tracks/perl6/exercises/robot-name/robot-name.t +39 -14
  137. data/tracks/php/config.json +5 -0
  138. data/tracks/php/exercises/luhn/example.php +26 -0
  139. data/tracks/php/exercises/luhn/luhn_test.php +95 -0
  140. data/tracks/purescript/README.md +67 -4
  141. data/tracks/python/docs/LEARNING.md +1 -0
  142. data/tracks/python/exercises/acronym/acronym_test.py +5 -1
  143. data/tracks/python/exercises/atbash-cipher/atbash_cipher_test.py +8 -0
  144. data/tracks/python/exercises/hello-world/hello_world_test.py +4 -38
  145. data/tracks/python/exercises/run-length-encoding/run_length_encoding_test.py +30 -15
  146. metadata +38 -2
@@ -1,4 +1,4 @@
1
1
  module Phone (number) where
2
2
 
3
3
  number :: String -> Maybe String
4
- number = error "You need to implement this function."
4
+ number xs = error "You need to implement this function."
@@ -1,4 +1,4 @@
1
1
  module PigLatin (translate) where
2
2
 
3
3
  translate :: String -> String
4
- translate = error "You need to implement this function."
4
+ translate xs = error "You need to implement this function."
@@ -1,4 +1,4 @@
1
1
  module PrimeFactors (primeFactors) where
2
2
 
3
3
  primeFactors :: Integer -> [Integer]
4
- primeFactors = error "You need to implement this function."
4
+ primeFactors n = error "You need to implement this function."
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -36,7 +36,7 @@ class ReactTest {
36
36
  val reactor = Reactor<Int>()
37
37
  val one = reactor.InputCell(1)
38
38
  val two = reactor.InputCell(2)
39
- val output = reactor.ComputeCell(one, two) { it[0] + it[1] * 10 }
39
+ val output = reactor.ComputeCell(one, two) { (x, y) -> x + y * 10 }
40
40
  assertEquals(21, output.value)
41
41
  }
42
42
 
@@ -57,7 +57,7 @@ class ReactTest {
57
57
  val input = reactor.InputCell(1)
58
58
  val timesTwo = reactor.ComputeCell(input) { it[0] * 2 }
59
59
  val timesThirty = reactor.ComputeCell(input) { it[0] * 30 }
60
- val output = reactor.ComputeCell(timesTwo, timesThirty) { it[0] + it[1] }
60
+ val output = reactor.ComputeCell(timesTwo, timesThirty) { (x, y) -> x + y }
61
61
 
62
62
  assertEquals(32, output.value)
63
63
  input.value = 3
@@ -149,7 +149,7 @@ class ReactTest {
149
149
  val plusOne = reactor.ComputeCell(input) { it[0] + 1 }
150
150
  val minusOne1 = reactor.ComputeCell(input) { it[0] - 1 }
151
151
  val minusOne2 = reactor.ComputeCell(minusOne1) { it[0] - 1 }
152
- val output = reactor.ComputeCell(plusOne, minusOne2) { it[0] * it[1] }
152
+ val output = reactor.ComputeCell(plusOne, minusOne2) { (x, y) -> x * y }
153
153
 
154
154
  val vals = mutableListOf<Int>()
155
155
  output.addCallback { vals.add(it) }
@@ -165,7 +165,7 @@ class ReactTest {
165
165
  val input = reactor.InputCell(1)
166
166
  val plusOne = reactor.ComputeCell(input) { it[0] + 1 }
167
167
  val minusOne = reactor.ComputeCell(input) { it[0] - 1 }
168
- val alwaysTwo = reactor.ComputeCell(plusOne, minusOne) { it[0] - it[1] }
168
+ val alwaysTwo = reactor.ComputeCell(plusOne, minusOne) { (x, y) -> x - y }
169
169
 
170
170
  val vals = mutableListOf<Int>()
171
171
  alwaysTwo.addCallback { vals.add(it) }
@@ -209,12 +209,12 @@ class ReactAdderTest(val input: Input, val expected: Expected) {
209
209
  val b = reactor.InputCell(input.b)
210
210
  val carryIn = reactor.InputCell(input.carryIn)
211
211
 
212
- val aXorB = reactor.ComputeCell(a, b) { it[0].xor(it[1]) }
213
- val sum = reactor.ComputeCell(aXorB, carryIn) { it[0].xor(it[1]) }
212
+ val aXorB = reactor.ComputeCell(a, b) { (x, y) -> x.xor(y) }
213
+ val sum = reactor.ComputeCell(aXorB, carryIn) { (x, y) -> x.xor(y) }
214
214
 
215
- val aXorBAndCin = reactor.ComputeCell(aXorB, carryIn) { it[0] && it[1] }
216
- val aAndB = reactor.ComputeCell(a, b) { it[0] && it[1] }
217
- val carryOut = reactor.ComputeCell(aXorBAndCin, aAndB) { it[0] || it[1] }
215
+ val aXorBAndCin = reactor.ComputeCell(aXorB, carryIn) { (x, y) -> x && y }
216
+ val aAndB = reactor.ComputeCell(a, b) { (x, y) -> x && y }
217
+ val carryOut = reactor.ComputeCell(aXorBAndCin, aAndB) { (x, y) -> x || y }
218
218
 
219
219
  assertEquals(expected, Expected(sum=sum.value, carryOut=carryOut.value))
220
220
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -1,5 +1,5 @@
1
1
  buildscript {
2
- ext.kotlin_version = '1.0.6'
2
+ ext.kotlin_version = '1.1.1'
3
3
  repositories {
4
4
  mavenCentral()
5
5
  }
@@ -0,0 +1,3 @@
1
+ [submodule "x-common"]
2
+ path = x-common
3
+ url = https://github.com/exercism/x-common.git
@@ -5,6 +5,7 @@ install:
5
5
  - rakudobrew build zef
6
6
  - zef install JSON::Tiny
7
7
  before_script:
8
+ - git submodule update --recursive --remote
8
9
  - bin/fetch-configlet
9
10
  script:
10
11
  - bin/configlet .
@@ -6,10 +6,12 @@
6
6
  "active": false,
7
7
  "test_pattern": ".*\\.t$",
8
8
  "deprecated": [
9
-
9
+ "binary",
10
+ "trinary"
10
11
  ],
11
12
  "ignored": [
12
13
  "docs",
14
+ "x-common",
13
15
  "img"
14
16
  ],
15
17
  "foregone": [
@@ -51,6 +53,11 @@
51
53
  "slug": "scrabble-score",
52
54
  "topics": []
53
55
  },
56
+ {
57
+ "difficulty": 1,
58
+ "slug": "all-your-base",
59
+ "topics": []
60
+ },
54
61
  {
55
62
  "difficulty": 1,
56
63
  "slug": "word-count",
@@ -86,21 +93,11 @@
86
93
  "slug": "rna-transcription",
87
94
  "topics": []
88
95
  },
89
- {
90
- "difficulty": 1,
91
- "slug": "binary",
92
- "topics": []
93
- },
94
96
  {
95
97
  "difficulty": 1,
96
98
  "slug": "wordy",
97
99
  "topics": []
98
100
  },
99
- {
100
- "difficulty": 1,
101
- "slug": "trinary",
102
- "topics": []
103
- },
104
101
  {
105
102
  "difficulty" : 1,
106
103
  "slug" : "allergies",
@@ -0,0 +1 @@
1
+ unit module Accumulate:ver<1>;
@@ -1,9 +1,9 @@
1
- class Accumulate is export {
2
- method accumulate (@list, $function){
3
- my @accumulated;
4
- for @list -> $element {
5
- @accumulated.push: $function($element);
6
- }
7
- return @accumulated;
8
- }
1
+ unit module Accumulate:ver<1>;
2
+
3
+ sub accumulate (@list, $function) is export {
4
+ my @accumulated;
5
+ for @list -> $element {
6
+ @accumulated.push: $function($element);
7
+ }
8
+ return @accumulated;
9
9
  }
@@ -1,35 +1,50 @@
1
1
  #!/usr/bin/env perl6
2
2
  use v6;
3
3
  use Test;
4
- use lib IO::Path.new($?FILE).parent.path;
4
+ use lib $?FILE.IO.dirname;
5
5
 
6
+ my $exercise = 'Accumulate';
7
+ my $version = v1;
8
+ my $module = %*ENV<EXERCISM> ?? 'Example' !! $exercise;
6
9
  plan 8;
7
- my $module = %*ENV<EXERCISM> ?? 'Example' !! 'Accumulate';
8
- use-ok $module;
9
- require ::($module) <Accumulate>;
10
10
 
11
- ok Accumulate.can('accumulate'), 'Accumulate class has accumulate() method';
12
-
13
- is-deeply Accumulate.accumulate([ ], sub {}),
11
+ use-ok $module or bail-out;
12
+ require ::($module);
13
+ if ::($exercise).^ver !~~ $version {
14
+ warn "\nExercise version mismatch. Further tests may fail!"
15
+ ~ "\n$exercise is $(::($exercise).^ver.gist). "
16
+ ~ "Test is $($version.gist).\n";
17
+ bail-out 'Example version must match test version.' if %*ENV<EXERCISM>;
18
+ }
19
+
20
+ my @subs;
21
+ BEGIN { @subs = <&accumulate> };
22
+ subtest 'Subroutine(s)', {
23
+ plan 1;
24
+ eval-lives-ok "use $module; ::('$_').defined or die '$_ is not defined.'", $_ for @subs;
25
+ } or bail-out 'All subroutines must be defined and exported.';
26
+ require ::($module) @subs.eager;
27
+
28
+ is-deeply accumulate([ ], sub {}),
14
29
  [ ],
15
30
  'test empty';
16
31
 
17
- is-deeply Accumulate.accumulate([1, 2, 3, 4, 5], sub { @_[0] * @_[0] }),
32
+ is-deeply accumulate([1, 2, 3, 4, 5], sub { @_[0] * @_[0] }),
18
33
  [1, 4, 9, 16, 25],
19
34
  'raise to 2';
20
35
 
21
- is-deeply Accumulate.accumulate([10, 17, 23], sub { [ (@_[0] / 7).truncate, (@_[0] % 7).truncate ] }),
36
+ is-deeply accumulate([10, 17, 23], sub { [ (@_[0] / 7).truncate, (@_[0] % 7).truncate ] }),
22
37
  [[1, 3], [2, 3], [3, 2] ],
23
38
  'divmod';
24
39
 
25
- is-deeply Accumulate.accumulate(['hello', 'exercism'], sub { @_[0].uc }),
40
+ is-deeply accumulate(['hello', 'exercism'], sub { @_[0].uc }),
26
41
  ['HELLO', 'EXERCISM'],
27
42
  'capitalize';
28
43
 
29
- is-deeply Accumulate.accumulate(['a', 'b', 'c' ], sub ($inp) { [ Accumulate.accumulate( [1, 2, 3], sub ($inp2) { $inp ~ $inp2 } )]}),
44
+ is-deeply accumulate(['a', 'b', 'c' ], sub ($inp) { [ accumulate( [1, 2, 3], sub ($inp2) { $inp ~ $inp2 } )]}),
30
45
  [['a1', 'a2', 'a3'], ['b1', 'b2', 'b3'], ['c1', 'c2', 'c3']],
31
46
  'recursive';
32
47
 
33
- is-deeply Accumulate.accumulate(['the', 'quick', 'brown', 'fox'], sub { @_[0].flip }),
48
+ is-deeply accumulate(['the', 'quick', 'brown', 'fox'], sub { @_[0].flip }),
34
49
  ['eht', 'kciuq', 'nworb', 'xof'],
35
50
  'reverse strings';
@@ -0,0 +1 @@
1
+ unit module AllYourBase:ver<1>;
@@ -0,0 +1,46 @@
1
+ unit module AllYourBase:ver<1>;
2
+
3
+ class X::AllYourBase::InvalidBase is Exception {
4
+ has $.payload;
5
+ method message {"$!payload is not a valid base."}
6
+ }
7
+
8
+ class X::AllYourBase::InvalidDigit is Exception {
9
+ has %.payload;
10
+ method message {"%!payload<digit> is not a valid digit for base %!payload<base>."}
11
+ }
12
+
13
+ sub convert-base (Int:D $input-base, @input-digits, Int:D $output-base --> Array:D) is export {
14
+ for $input-base, $output-base {
15
+ X::AllYourBase::InvalidBase.new(payload => $_).throw if $_ < 2;
16
+ }
17
+ from-decimal($output-base, (to-decimal $input-base, @input-digits));
18
+ }
19
+
20
+ sub to-decimal ($input-base, @input-digits) {
21
+ return [] if !@input-digits;
22
+ my $elems = @input-digits.elems;
23
+ for @input-digits {
24
+ if $_ == 0 { $elems-- }
25
+ else { last }
26
+ }
27
+ my $dec = 0;
28
+ loop (my $i = 0; $i < $elems; $i++) {
29
+ if @input-digits.reverse[$i] < 0 || @input-digits.reverse[$i] >= $input-base {
30
+ X::AllYourBase::InvalidDigit.new( :payload(base => $input-base, digit => @input-digits.reverse[$i]) ).throw;
31
+ }
32
+ $dec += @input-digits.reverse[$i] * $input-base ** $i;
33
+ }
34
+ return $dec;
35
+ }
36
+
37
+ sub from-decimal ($output-base, $dec) {
38
+ my @output-digits;
39
+ my $num = $dec;
40
+ while $num >= $output-base {
41
+ unshift @output-digits, $num % $output-base;
42
+ $num div= $output-base;
43
+ }
44
+ unshift @output-digits, $num;
45
+ return @output-digits;
46
+ }