trackler 2.2.1.74 → 2.2.1.75

Sign up to get free protection for your applications and to get access to all the features.
Files changed (227) hide show
  1. checksums.yaml +4 -4
  2. data/fixtures/tracks/fruit/docs/something.md +0 -0
  3. data/lib/trackler/version.rb +1 -1
  4. data/problem-specifications/README.md +8 -4
  5. data/problem-specifications/exercises/acronym/canonical-data.json +19 -7
  6. data/problem-specifications/exercises/all-your-base/canonical-data.json +106 -64
  7. data/problem-specifications/exercises/allergies/canonical-data.json +37 -13
  8. data/tracks/c/config.json +176 -176
  9. data/tracks/clojure/config.json +17 -1
  10. data/tracks/clojure/exercises/isbn-verifier/README.md +43 -0
  11. data/tracks/clojure/exercises/isbn-verifier/project.clj +4 -0
  12. data/tracks/clojure/exercises/isbn-verifier/src/example.clj +17 -0
  13. data/tracks/clojure/exercises/isbn-verifier/src/isbn_verifier.clj +3 -0
  14. data/tracks/clojure/exercises/isbn-verifier/test/isbn_verifier_test.clj +42 -0
  15. data/tracks/clojure/exercises/proverb/README.md +15 -0
  16. data/tracks/clojure/exercises/proverb/project.clj +4 -0
  17. data/tracks/clojure/exercises/proverb/src/example.clj +15 -0
  18. data/tracks/clojure/exercises/proverb/src/proverb.clj +3 -0
  19. data/tracks/clojure/exercises/proverb/test/proverb_test.clj +14 -0
  20. data/tracks/common-lisp/docs/LEARNING.md +4 -3
  21. data/tracks/common-lisp/docs/RESOURCES.md +11 -0
  22. data/tracks/delphi/.gitignore +1 -0
  23. data/tracks/delphi/config.json +24 -0
  24. data/tracks/delphi/docs/INSTALLATION.md +1 -1
  25. data/tracks/delphi/exercises/isbn-verifier/ISBNVerifier.dpr +60 -0
  26. data/tracks/delphi/exercises/isbn-verifier/README.md +68 -0
  27. data/tracks/delphi/exercises/isbn-verifier/uISBNVerifierExample.pas +46 -0
  28. data/tracks/delphi/exercises/isbn-verifier/uTestISBNVerifier.pas +136 -0
  29. data/tracks/delphi/exercises/secret-handshake/README.md +56 -0
  30. data/tracks/delphi/exercises/secret-handshake/SecretHandshake.dpr +60 -0
  31. data/tracks/delphi/exercises/secret-handshake/uSecretHandshakeExample.pas +56 -0
  32. data/tracks/delphi/exercises/secret-handshake/uTestSecretHandshake.pas +215 -0
  33. data/tracks/ecmascript/docs/ABOUT.md +13 -9
  34. data/tracks/factor/exercises/two-fer/README.md +1 -1
  35. data/tracks/fsharp/docs/RESOURCES.md +1 -1
  36. data/tracks/fsharp/generators/{Input.fs → CanonicalData.fs} +5 -10
  37. data/tracks/fsharp/generators/Exercise.fs +11 -10
  38. data/tracks/fsharp/generators/{Output.fs → Formatting.fs} +2 -56
  39. data/tracks/fsharp/generators/Generators.fs +93 -93
  40. data/tracks/fsharp/generators/Generators.fsproj +9 -4
  41. data/tracks/fsharp/generators/Options.fs +1 -1
  42. data/tracks/fsharp/generators/Program.fs +3 -3
  43. data/tracks/fsharp/generators/Rendering.fs +57 -0
  44. data/tracks/go/exercises/all-your-base/.meta/gen.go +80 -0
  45. data/tracks/go/exercises/all-your-base/.meta/hints.md +13 -0
  46. data/tracks/go/exercises/all-your-base/README.md +16 -1
  47. data/tracks/go/exercises/all-your-base/all_your_base_test.go +12 -163
  48. data/tracks/go/exercises/all-your-base/cases_test.go +183 -0
  49. data/tracks/go/exercises/all-your-base/example.go +25 -29
  50. data/tracks/java/CONTRIBUTING.md +1 -1
  51. data/tracks/java/POLICIES.md +15 -1
  52. data/tracks/java/exercises/flatten-array/.meta/hints.md +58 -0
  53. data/tracks/java/exercises/flatten-array/README.md +62 -0
  54. data/tracks/java/exercises/hamming/src/main/java/Hamming.java +1 -1
  55. data/tracks/java/exercises/matrix/.meta/src/reference/java/Matrix.java +6 -6
  56. data/tracks/java/exercises/meetup/.meta/src/reference/java/Meetup.java +2 -2
  57. data/tracks/java/exercises/meetup/.meta/src/reference/java/MeetupSchedule.java +1 -1
  58. data/tracks/java/exercises/meetup/src/main/java/MeetupSchedule.java +1 -1
  59. data/tracks/java/exercises/pig-latin/.meta/hints.md +58 -0
  60. data/tracks/java/exercises/pig-latin/README.md +61 -0
  61. data/tracks/java/exercises/reverse-string/src/main/java/ReverseString.java +2 -2
  62. data/tracks/java/exercises/secret-handshake/README.md +1 -1
  63. data/tracks/javascript/.eslintignore +0 -3
  64. data/tracks/javascript/exercises/food-chain/example.js +50 -37
  65. data/tracks/javascript/exercises/octal/example.js +1 -1
  66. data/tracks/javascript/exercises/robot-name/robot-name.spec.js +7 -7
  67. data/tracks/javascript/package-lock.json +1846 -0
  68. data/tracks/python/docs/EXERCISE_README_INSERT.md +15 -0
  69. data/tracks/python/exercises/accumulate/README.md +15 -0
  70. data/tracks/python/exercises/acronym/README.md +15 -0
  71. data/tracks/python/exercises/all-your-base/README.md +15 -0
  72. data/tracks/python/exercises/all-your-base/all_your_base_test.py +19 -9
  73. data/tracks/python/exercises/allergies/README.md +15 -0
  74. data/tracks/python/exercises/alphametics/README.md +15 -0
  75. data/tracks/python/exercises/anagram/README.md +15 -0
  76. data/tracks/python/exercises/atbash-cipher/README.md +15 -0
  77. data/tracks/python/exercises/beer-song/README.md +16 -1
  78. data/tracks/python/exercises/binary-search-tree/README.md +16 -2
  79. data/tracks/python/exercises/binary-search/README.md +15 -0
  80. data/tracks/python/exercises/binary-search/binary_search_test.py +14 -4
  81. data/tracks/python/exercises/binary/README.md +15 -0
  82. data/tracks/python/exercises/binary/binary_test.py +14 -4
  83. data/tracks/python/exercises/bob/README.md +15 -0
  84. data/tracks/python/exercises/book-store/README.md +15 -0
  85. data/tracks/python/exercises/bracket-push/README.md +15 -0
  86. data/tracks/python/exercises/change/README.md +15 -0
  87. data/tracks/python/exercises/circular-buffer/README.md +15 -0
  88. data/tracks/python/exercises/circular-buffer/circular_buffer_test.py +15 -5
  89. data/tracks/python/exercises/circular-buffer/example.py +2 -2
  90. data/tracks/python/exercises/clock/README.md +15 -0
  91. data/tracks/python/exercises/collatz-conjecture/.meta/hints.md +1 -1
  92. data/tracks/python/exercises/collatz-conjecture/README.md +15 -0
  93. data/tracks/python/exercises/complex-numbers/README.md +15 -0
  94. data/tracks/python/exercises/connect/README.md +18 -3
  95. data/tracks/python/exercises/crypto-square/README.md +15 -0
  96. data/tracks/python/exercises/diamond/README.md +15 -0
  97. data/tracks/python/exercises/difference-of-squares/README.md +15 -0
  98. data/tracks/python/exercises/diffie-hellman/README.md +14 -0
  99. data/tracks/python/exercises/dominoes/README.md +16 -1
  100. data/tracks/python/exercises/error-handling/README.md +17 -0
  101. data/tracks/python/exercises/error-handling/error_handling_test.py +13 -3
  102. data/tracks/python/exercises/error-handling/example.py +1 -1
  103. data/tracks/python/exercises/etl/README.md +16 -1
  104. data/tracks/python/exercises/flatten-array/README.md +15 -0
  105. data/tracks/python/exercises/food-chain/README.md +15 -0
  106. data/tracks/python/exercises/forth/README.md +15 -0
  107. data/tracks/python/exercises/forth/example.py +7 -9
  108. data/tracks/python/exercises/forth/forth_test.py +107 -17
  109. data/tracks/python/exercises/gigasecond/README.md +15 -0
  110. data/tracks/python/exercises/go-counting/README.md +21 -3
  111. data/tracks/python/exercises/grade-school/README.md +15 -0
  112. data/tracks/python/exercises/grains/README.md +15 -0
  113. data/tracks/python/exercises/grains/grains_test.py +16 -6
  114. data/tracks/python/exercises/grep/README.md +15 -0
  115. data/tracks/python/exercises/hamming/README.md +15 -0
  116. data/tracks/python/exercises/hamming/hamming_test.py +12 -2
  117. data/tracks/python/exercises/hello-world/README.md +15 -0
  118. data/tracks/python/exercises/hexadecimal/README.md +15 -0
  119. data/tracks/python/exercises/hexadecimal/hexadecimal_test.py +11 -1
  120. data/tracks/python/exercises/house/README.md +16 -1
  121. data/tracks/python/exercises/isogram/README.md +15 -0
  122. data/tracks/python/exercises/kindergarten-garden/README.md +18 -3
  123. data/tracks/python/exercises/largest-series-product/README.md +15 -0
  124. data/tracks/python/exercises/largest-series-product/largest_series_product_test.py +14 -4
  125. data/tracks/python/exercises/leap/README.md +15 -0
  126. data/tracks/python/exercises/linked-list/README.md +15 -0
  127. data/tracks/python/exercises/list-ops/README.md +15 -0
  128. data/tracks/python/exercises/luhn/README.md +15 -0
  129. data/tracks/python/exercises/markdown/README.md +18 -0
  130. data/tracks/python/exercises/matrix/README.md +15 -0
  131. data/tracks/python/exercises/meetup/README.md +31 -12
  132. data/tracks/python/exercises/meetup/meetup_test.py +11 -1
  133. data/tracks/python/exercises/minesweeper/README.md +15 -0
  134. data/tracks/python/exercises/minesweeper/minesweeper_test.py +12 -2
  135. data/tracks/python/exercises/nth-prime/README.md +15 -0
  136. data/tracks/python/exercises/nth-prime/nth_prime_test.py +11 -1
  137. data/tracks/python/exercises/nucleotide-count/README.md +17 -2
  138. data/tracks/python/exercises/nucleotide-count/nucleotide_count_test.py +11 -1
  139. data/tracks/python/exercises/ocr-numbers/README.md +16 -1
  140. data/tracks/python/exercises/ocr-numbers/ocr_numbers_test.py +12 -2
  141. data/tracks/python/exercises/octal/README.md +15 -0
  142. data/tracks/python/exercises/octal/octal_test.py +16 -3
  143. data/tracks/python/exercises/palindrome-products/README.md +16 -1
  144. data/tracks/python/exercises/pangram/README.md +15 -0
  145. data/tracks/python/exercises/pascals-triangle/README.md +16 -1
  146. data/tracks/python/exercises/perfect-numbers/README.md +15 -0
  147. data/tracks/python/exercises/perfect-numbers/perfect_numbers_test.py +13 -3
  148. data/tracks/python/exercises/phone-number/README.md +16 -2
  149. data/tracks/python/exercises/phone-number/example.py +1 -1
  150. data/tracks/python/exercises/phone-number/phone_number_test.py +17 -7
  151. data/tracks/python/exercises/pig-latin/README.md +15 -0
  152. data/tracks/python/exercises/point-mutations/README.md +15 -0
  153. data/tracks/python/exercises/poker/README.md +15 -0
  154. data/tracks/python/exercises/pov/README.md +20 -2
  155. data/tracks/python/exercises/pov/example.py +2 -2
  156. data/tracks/python/exercises/pov/pov_test.py +15 -5
  157. data/tracks/python/exercises/prime-factors/README.md +15 -0
  158. data/tracks/python/exercises/protein-translation/README.md +15 -0
  159. data/tracks/python/exercises/protein-translation/protein_translation_test.py +10 -0
  160. data/tracks/python/exercises/proverb/README.md +14 -0
  161. data/tracks/python/exercises/pythagorean-triplet/README.md +15 -0
  162. data/tracks/python/exercises/pythagorean-triplet/pythagorean_triplet_test.py +11 -1
  163. data/tracks/python/exercises/queen-attack/README.md +15 -0
  164. data/tracks/python/exercises/queen-attack/queen_attack_test.py +17 -7
  165. data/tracks/python/exercises/rail-fence-cipher/README.md +15 -0
  166. data/tracks/python/exercises/raindrops/README.md +15 -0
  167. data/tracks/python/exercises/react/README.md +15 -1
  168. data/tracks/python/exercises/rectangles/README.md +24 -9
  169. data/tracks/python/exercises/rna-transcription/.meta/hints.md +1 -0
  170. data/tracks/python/exercises/rna-transcription/README.md +18 -5
  171. data/tracks/python/exercises/rna-transcription/rna_transcription_test.py +13 -3
  172. data/tracks/python/exercises/robot-name/README.md +15 -0
  173. data/tracks/python/exercises/robot-simulator/README.md +15 -0
  174. data/tracks/python/exercises/roman-numerals/README.md +15 -0
  175. data/tracks/python/exercises/rotational-cipher/README.md +15 -0
  176. data/tracks/python/exercises/run-length-encoding/README.md +15 -0
  177. data/tracks/python/exercises/saddle-points/README.md +15 -0
  178. data/tracks/python/exercises/saddle-points/saddle_points_test.py +11 -1
  179. data/tracks/python/exercises/say/README.md +15 -0
  180. data/tracks/python/exercises/say/say_test.py +12 -2
  181. data/tracks/python/exercises/scale-generator/README.md +15 -0
  182. data/tracks/python/exercises/scale-generator/example.py +3 -3
  183. data/tracks/python/exercises/scale-generator/scale_generator_test.py +11 -1
  184. data/tracks/python/exercises/scrabble-score/README.md +15 -0
  185. data/tracks/python/exercises/secret-handshake/README.md +16 -1
  186. data/tracks/python/exercises/series/README.md +15 -0
  187. data/tracks/python/exercises/series/series_test.py +12 -2
  188. data/tracks/python/exercises/sieve/README.md +15 -0
  189. data/tracks/python/exercises/simple-cipher/.meta/hints.md +6 -6
  190. data/tracks/python/exercises/simple-cipher/README.md +17 -1
  191. data/tracks/python/exercises/simple-cipher/simple_cipher_test.py +12 -2
  192. data/tracks/python/exercises/simple-linked-list/{hints.md → .meta/hints.md} +10 -10
  193. data/tracks/python/exercises/simple-linked-list/README.md +16 -0
  194. data/tracks/python/exercises/simple-linked-list/example.py +2 -2
  195. data/tracks/python/exercises/simple-linked-list/simple_linked_list_test.py +13 -3
  196. data/tracks/python/exercises/space-age/README.md +15 -0
  197. data/tracks/python/exercises/strain/README.md +16 -3
  198. data/tracks/python/exercises/sublist/README.md +15 -0
  199. data/tracks/python/exercises/sum-of-multiples/README.md +18 -3
  200. data/tracks/python/exercises/tournament/README.md +15 -0
  201. data/tracks/python/exercises/transpose/README.md +15 -0
  202. data/tracks/python/exercises/tree-building/README.md +30 -0
  203. data/tracks/python/exercises/tree-building/example.py +3 -5
  204. data/tracks/python/exercises/tree-building/tree_building_test.py +16 -6
  205. data/tracks/python/exercises/triangle/README.md +15 -0
  206. data/tracks/python/exercises/triangle/example.py +1 -1
  207. data/tracks/python/exercises/triangle/triangle_test.py +15 -5
  208. data/tracks/python/exercises/trinary/README.md +15 -0
  209. data/tracks/python/exercises/twelve-days/README.md +15 -0
  210. data/tracks/python/exercises/two-bucket/README.md +22 -7
  211. data/tracks/python/exercises/two-fer/README.md +16 -0
  212. data/tracks/python/exercises/variable-length-quantity/README.md +15 -0
  213. data/tracks/python/exercises/variable-length-quantity/variable_length_quantity_test.py +12 -2
  214. data/tracks/python/exercises/word-count/README.md +15 -0
  215. data/tracks/python/exercises/word-search/README.md +15 -0
  216. data/tracks/python/exercises/wordy/README.md +15 -0
  217. data/tracks/python/exercises/wordy/wordy_test.py +14 -4
  218. data/tracks/python/exercises/zebra-puzzle/README.md +15 -0
  219. data/tracks/python/exercises/zipper/README.md +16 -3
  220. data/tracks/rust/config.json +11 -0
  221. data/tracks/rust/exercises/saddle-points/.gitignore +8 -0
  222. data/tracks/rust/exercises/saddle-points/Cargo.toml +5 -0
  223. data/tracks/rust/exercises/saddle-points/README.md +66 -0
  224. data/tracks/rust/exercises/saddle-points/example.rs +24 -0
  225. data/tracks/rust/exercises/saddle-points/src/lib.rs +3 -0
  226. data/tracks/rust/exercises/saddle-points/tests/saddle-points.rs +60 -0
  227. metadata +38 -5
@@ -31,6 +31,21 @@ Here are examples of integers as 32-bit values, and the variable length quantiti
31
31
  0FFFFFFF FF FF FF 7F
32
32
  ```
33
33
 
34
+ ## Exception messages
35
+
36
+ Sometimes it is necessary to raise an exception. When you do this, you should include a meaningful error message to
37
+ indicate what the source of the error is. This makes your code more readable and helps significantly with debugging. Not
38
+ every exercise will require you to raise an exception, but for those that do, the tests will only pass if you include
39
+ a message.
40
+
41
+ To raise a message with an exception, just write it as an argument to the exception type. For example, instead of
42
+ `raise Exception`, you shold write:
43
+
44
+ ```python
45
+ raise Exception("Meaningful message indicating the source of the error")
46
+ ```
47
+
48
+
34
49
  ## Submitting Exercises
35
50
 
36
51
  Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
@@ -81,11 +81,11 @@ class TestVLQ(unittest.TestCase):
81
81
  self.assertEqual(decode([0x8f, 0xff, 0xff, 0xff, 0x7f]), [0xffffffff])
82
82
 
83
83
  def test_incomplete_sequence_causes_error(self):
84
- with self.assertRaises(ValueError):
84
+ with self.assertRaisesWithMessage(ValueError):
85
85
  decode([0xff])
86
86
 
87
87
  def test_incomplete_sequence_causes_error_even_if_value_is_zero(self):
88
- with self.assertRaises(ValueError):
88
+ with self.assertRaisesWithMessage(ValueError):
89
89
  decode([0x80])
90
90
 
91
91
  def test_multiple_values(self):
@@ -95,6 +95,16 @@ class TestVLQ(unittest.TestCase):
95
95
  [0x2000, 0x123456, 0xfffffff, 0x0, 0x3fff, 0x4000]
96
96
  )
97
97
 
98
+ # Utility functions
99
+ def setUp(self):
100
+ try:
101
+ self.assertRaisesRegex = self.assertRaisesRegexp
102
+ except AttributeError:
103
+ pass
104
+
105
+ def assertRaisesWithMessage(self, exception):
106
+ return self.assertRaisesRegex(exception, r".+")
107
+
98
108
 
99
109
  if __name__ == '__main__':
100
110
  unittest.main()
@@ -11,6 +11,21 @@ come: 1
11
11
  free: 1
12
12
  ```
13
13
 
14
+ ## Exception messages
15
+
16
+ Sometimes it is necessary to raise an exception. When you do this, you should include a meaningful error message to
17
+ indicate what the source of the error is. This makes your code more readable and helps significantly with debugging. Not
18
+ every exercise will require you to raise an exception, but for those that do, the tests will only pass if you include
19
+ a message.
20
+
21
+ To raise a message with an exception, just write it as an argument to the exception type. For example, instead of
22
+ `raise Exception`, you shold write:
23
+
24
+ ```python
25
+ raise Exception("Meaningful message indicating the source of the error")
26
+ ```
27
+
28
+
14
29
  ## Submitting Exercises
15
30
 
16
31
  Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
@@ -26,6 +26,21 @@ vertical and diagonal.
26
26
  Given a puzzle and a list of words return the location of the first and last
27
27
  letter of each word.
28
28
 
29
+ ## Exception messages
30
+
31
+ Sometimes it is necessary to raise an exception. When you do this, you should include a meaningful error message to
32
+ indicate what the source of the error is. This makes your code more readable and helps significantly with debugging. Not
33
+ every exercise will require you to raise an exception, but for those that do, the tests will only pass if you include
34
+ a message.
35
+
36
+ To raise a message with an exception, just write it as an argument to the exception type. For example, instead of
37
+ `raise Exception`, you shold write:
38
+
39
+ ```python
40
+ raise Exception("Meaningful message indicating the source of the error")
41
+ ```
42
+
43
+
29
44
  ## Submitting Exercises
30
45
 
31
46
  Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
@@ -51,6 +51,21 @@ If you'd like, handle exponentials.
51
51
 
52
52
  32
53
53
 
54
+ ## Exception messages
55
+
56
+ Sometimes it is necessary to raise an exception. When you do this, you should include a meaningful error message to
57
+ indicate what the source of the error is. This makes your code more readable and helps significantly with debugging. Not
58
+ every exercise will require you to raise an exception, but for those that do, the tests will only pass if you include
59
+ a message.
60
+
61
+ To raise a message with an exception, just write it as an argument to the exception type. For example, instead of
62
+ `raise Exception`, you shold write:
63
+
64
+ ```python
65
+ raise Exception("Meaningful message indicating the source of the error")
66
+ ```
67
+
68
+
54
69
  ## Submitting Exercises
55
70
 
56
71
  Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
@@ -51,23 +51,33 @@ class WordyTest(unittest.TestCase):
51
51
  calculate("What is -12 divided by 2 divided by -3?"), 2)
52
52
 
53
53
  def test_unknown_operation(self):
54
- with self.assertRaises(ValueError):
54
+ with self.assertRaisesWithMessage(ValueError):
55
55
  calculate("What is 52 cubed?")
56
56
 
57
57
  def test_non_math_question(self):
58
- with self.assertRaises(ValueError):
58
+ with self.assertRaisesWithMessage(ValueError):
59
59
  calculate("Who is the President of the United States?")
60
60
 
61
61
  # Additional tests for this track
62
62
 
63
63
  def test_missing_operation(self):
64
- with self.assertRaises(ValueError):
64
+ with self.assertRaisesWithMessage(ValueError):
65
65
  calculate("What is 2 2 minus 3?")
66
66
 
67
67
  def test_missing_number(self):
68
- with self.assertRaises(ValueError):
68
+ with self.assertRaisesWithMessage(ValueError):
69
69
  calculate("What is 7 plus multiplied by -2?")
70
70
 
71
+ # Utility functions
72
+ def setUp(self):
73
+ try:
74
+ self.assertRaisesRegex = self.assertRaisesRegexp
75
+ except AttributeError:
76
+ pass
77
+
78
+ def assertRaisesWithMessage(self, exception):
79
+ return self.assertRaisesRegex(exception, r".+")
80
+
71
81
 
72
82
  if __name__ == '__main__':
73
83
  unittest.main()
@@ -25,6 +25,21 @@ drink different beverages and smoke different brands of cigarettes.
25
25
  Which of the residents drinks water?
26
26
  Who owns the zebra?
27
27
 
28
+ ## Exception messages
29
+
30
+ Sometimes it is necessary to raise an exception. When you do this, you should include a meaningful error message to
31
+ indicate what the source of the error is. This makes your code more readable and helps significantly with debugging. Not
32
+ every exercise will require you to raise an exception, but for those that do, the tests will only pass if you include
33
+ a message.
34
+
35
+ To raise a message with an exception, just write it as an argument to the exception type. For example, instead of
36
+ `raise Exception`, you shold write:
37
+
38
+ ```python
39
+ raise Exception("Meaningful message indicating the source of the error")
40
+ ```
41
+
42
+
28
43
  ## Submitting Exercises
29
44
 
30
45
  Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
@@ -27,17 +27,30 @@ list of child nodes) a zipper might support these operations:
27
27
  `next` node if possible otherwise to the `prev` node if possible,
28
28
  otherwise to the parent node, returns a new zipper)
29
29
 
30
- ### Submitting Exercises
30
+ ## Exception messages
31
+
32
+ Sometimes it is necessary to raise an exception. When you do this, you should include a meaningful error message to
33
+ indicate what the source of the error is. This makes your code more readable and helps significantly with debugging. Not
34
+ every exercise will require you to raise an exception, but for those that do, the tests will only pass if you include
35
+ a message.
36
+
37
+ To raise a message with an exception, just write it as an argument to the exception type. For example, instead of
38
+ `raise Exception`, you shold write:
39
+
40
+ ```python
41
+ raise Exception("Meaningful message indicating the source of the error")
42
+ ```
43
+
44
+
45
+ ## Submitting Exercises
31
46
 
32
47
  Note that, when trying to submit an exercise, make sure the solution is in the `exercism/python/<exerciseName>` directory.
33
48
 
34
49
  For example, if you're submitting `bob.py` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/python/bob/bob.py`.
35
50
 
36
-
37
51
  For more detailed information about running tests, code style and linting,
38
52
  please see the [help page](http://exercism.io/languages/python).
39
53
 
40
54
 
41
55
  ## Submitting Incomplete Solutions
42
-
43
56
  It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -185,6 +185,17 @@
185
185
  "mathematics"
186
186
  ]
187
187
  },
188
+ {
189
+ "uuid": "ccebfa12-d224-11e7-8941-cec278b6b50a",
190
+ "slug": "saddle-points",
191
+ "core": false,
192
+ "unlocked_by": null,
193
+ "difficulty": 3,
194
+ "topics": [
195
+ "vectors",
196
+ "iterators"
197
+ ]
198
+ },
188
199
  {
189
200
  "uuid": "79613fd8-b7da-11e7-abc4-cec278b6b50a",
190
201
  "slug": "isogram",
@@ -0,0 +1,8 @@
1
+ # Generated by Cargo
2
+ # will have compiled files and executables
3
+ /target/
4
+ **/*.rs.bk
5
+
6
+ # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
7
+ # More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock
8
+ Cargo.lock
@@ -0,0 +1,5 @@
1
+ [package]
2
+ name = "saddle-points"
3
+ version = "1.0.0"
4
+
5
+ [dependencies]
@@ -0,0 +1,66 @@
1
+ # Saddle Points
2
+
3
+ Detect saddle points in a matrix.
4
+
5
+ So say you have a matrix like so:
6
+
7
+ ```text
8
+ 0 1 2
9
+ |---------
10
+ 0 | 9 8 7
11
+ 1 | 5 3 2 <--- saddle point at (1,0)
12
+ 2 | 6 6 7
13
+ ```
14
+
15
+ It has a saddle point at (1, 0).
16
+
17
+ It's called a "saddle point" because it is greater than or equal to
18
+ every element in its row and less than or equal to every element in
19
+ its column.
20
+
21
+ A matrix may have zero or more saddle points.
22
+
23
+ Your code should be able to provide the (possibly empty) list of all the
24
+ saddle points for any given matrix.
25
+
26
+ Note that you may find other definitions of matrix saddle points online,
27
+ but the tests for this exercise follow the above unambiguous definition.
28
+
29
+ ## Rust Installation
30
+
31
+ Refer to the [exercism help page][help-page] for Rust installation and learning
32
+ resources.
33
+
34
+ ## Writing the Code
35
+
36
+ Execute the tests with:
37
+
38
+ ```bash
39
+ $ cargo test
40
+ ```
41
+
42
+ All but the first test have been ignored. After you get the first test to
43
+ pass, remove the ignore flag (`#[ignore]`) from the next test and get the tests
44
+ to pass again. The test file is located in the `tests` directory. You can
45
+ also remove the ignore flag from all the tests to get them to run all at once
46
+ if you wish.
47
+
48
+ Make sure to read the [Modules](https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html) chapter if you
49
+ haven't already, it will help you with organizing your files.
50
+
51
+ ## Feedback, Issues, Pull Requests
52
+
53
+ The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the [rust track team](https://github.com/orgs/exercism/teams/rust) are happy to help!
54
+
55
+ If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
56
+
57
+ [help-page]: http://exercism.io/languages/rust
58
+ [modules]: https://doc.rust-lang.org/book/second-edition/ch07-00-modules.html
59
+ [cargo]: https://doc.rust-lang.org/book/second-edition/ch14-00-more-about-cargo.html
60
+
61
+ ## Source
62
+
63
+ J Dalbey's Programming Practice problems [http://users.csc.calpoly.edu/~jdalbey/103/Projects/ProgrammingPractice.html](http://users.csc.calpoly.edu/~jdalbey/103/Projects/ProgrammingPractice.html)
64
+
65
+ ## Submitting Incomplete Solutions
66
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,24 @@
1
+ pub fn find_saddle_points(input: &[Vec<u64>]) -> Vec<(usize, usize)> {
2
+ let mut saddle_points = Vec::new();
3
+
4
+ let width = input.len();
5
+ let height = input[0].len();
6
+
7
+ for i in 0..width {
8
+ for j in 0..height {
9
+
10
+ let column = input.iter().map(|x| x[j]).collect::<Vec<u64>>();
11
+ let row = &input[i];
12
+
13
+ let max = row.iter().max().unwrap();
14
+ let min = column.iter().min().unwrap();
15
+
16
+ let value = input[i][j];
17
+
18
+ if value >= *max && value <= *min {
19
+ saddle_points.push((i, j));
20
+ }
21
+ }
22
+ }
23
+ saddle_points
24
+ }
@@ -0,0 +1,3 @@
1
+ pub fn find_saddle_points(input: &[Vec<u64>]) -> Vec<(usize, usize)> {
2
+ unimplemented!()
3
+ }
@@ -0,0 +1,60 @@
1
+ extern crate saddle_points;
2
+
3
+ use saddle_points::*;
4
+
5
+ #[test]
6
+ fn test_identify_single_saddle_point() {
7
+ let input = vec![vec![9, 8, 7], vec![5, 3, 2], vec![6, 6, 7]];
8
+ assert_eq!(vec![(1, 0)], find_saddle_points(&input));
9
+ }
10
+
11
+ #[test]
12
+ #[ignore]
13
+ fn test_identify_empty_matrix() {
14
+ let input = vec![vec![], vec![], vec![]];
15
+ let expected: Vec<(usize, usize)> = Vec::new();
16
+ assert_eq!(expected, find_saddle_points(&input));
17
+ }
18
+
19
+ #[test]
20
+ #[ignore]
21
+ fn test_identify_lack_of_saddle_point() {
22
+ let input = vec![vec![1, 2, 3], vec![3, 1, 2], vec![2, 3, 1]];
23
+ let expected: Vec<(usize, usize)> = Vec::new();
24
+ assert_eq!(expected, find_saddle_points(&input));
25
+ }
26
+
27
+ #[test]
28
+ #[ignore]
29
+ fn test_multiple_saddle_point() {
30
+ let input = vec![vec![4, 5, 4], vec![3, 5, 5], vec![1, 5, 4]];
31
+ assert_eq!(vec![(0, 1), (1, 1), (2, 1)], find_saddle_points(&input));
32
+ }
33
+
34
+ #[test]
35
+ #[ignore]
36
+ fn test_identify_bottom_right_saddle_point() {
37
+ let input = vec![vec![8, 7, 9], vec![6, 7, 6], vec![3, 2, 5]];
38
+ assert_eq!(vec![(2, 2)], find_saddle_points(&input));
39
+ }
40
+
41
+ #[test]
42
+ #[ignore]
43
+ fn test_non_square_matrix_high() {
44
+ let input = vec![vec![1, 5], vec![3, 6], vec![2, 7], vec![3, 8]];
45
+ assert_eq!(vec![(0, 1)], find_saddle_points(&input));
46
+ }
47
+
48
+ #[test]
49
+ #[ignore]
50
+ fn test_non_square_matrix_wide() {
51
+ let input = vec![vec![8, 7, 10, 7, 9], vec![8, 7, 13, 7, 9]];
52
+ assert_eq!(vec![(0, 2)], find_saddle_points(&input));
53
+ }
54
+
55
+ #[test]
56
+ #[ignore]
57
+ fn test_vector_matrix() {
58
+ let input = vec![vec![1], vec![3], vec![2], vec![3]];
59
+ assert_eq!(vec![(0, 0)], find_saddle_points(&input));
60
+ }
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.2.1.74
4
+ version: 2.2.1.75
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-12-10 00:00:00.000000000 Z
11
+ date: 2017-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -188,6 +188,7 @@ files:
188
188
  - fixtures/tracks/fruit/config.json
189
189
  - fixtures/tracks/fruit/docs/ABOUT.md
190
190
  - fixtures/tracks/fruit/docs/RESOURCES.nope
191
+ - fixtures/tracks/fruit/docs/something.md
191
192
  - fixtures/tracks/fruit/exercises/apple/apple.ext
192
193
  - fixtures/tracks/fruit/exercises/apple/apple.tst
193
194
  - fixtures/tracks/fruit/exercises/apple/example.ext
@@ -1497,6 +1498,11 @@ files:
1497
1498
  - tracks/clojure/exercises/hexadecimal/project.clj
1498
1499
  - tracks/clojure/exercises/hexadecimal/src/example.clj
1499
1500
  - tracks/clojure/exercises/hexadecimal/test/hexadecimal_test.clj
1501
+ - tracks/clojure/exercises/isbn-verifier/README.md
1502
+ - tracks/clojure/exercises/isbn-verifier/project.clj
1503
+ - tracks/clojure/exercises/isbn-verifier/src/example.clj
1504
+ - tracks/clojure/exercises/isbn-verifier/src/isbn_verifier.clj
1505
+ - tracks/clojure/exercises/isbn-verifier/test/isbn_verifier_test.clj
1500
1506
  - tracks/clojure/exercises/isogram/README.md
1501
1507
  - tracks/clojure/exercises/isogram/project.clj
1502
1508
  - tracks/clojure/exercises/isogram/src/example.clj
@@ -1571,6 +1577,11 @@ files:
1571
1577
  - tracks/clojure/exercises/protein-translation/project.clj
1572
1578
  - tracks/clojure/exercises/protein-translation/src/example.clj
1573
1579
  - tracks/clojure/exercises/protein-translation/test/protein_translation_test.clj
1580
+ - tracks/clojure/exercises/proverb/README.md
1581
+ - tracks/clojure/exercises/proverb/project.clj
1582
+ - tracks/clojure/exercises/proverb/src/example.clj
1583
+ - tracks/clojure/exercises/proverb/src/proverb.clj
1584
+ - tracks/clojure/exercises/proverb/test/proverb_test.clj
1574
1585
  - tracks/clojure/exercises/queen-attack/README.md
1575
1586
  - tracks/clojure/exercises/queen-attack/project.clj
1576
1587
  - tracks/clojure/exercises/queen-attack/src/example.clj
@@ -3298,6 +3309,10 @@ files:
3298
3309
  - tracks/delphi/exercises/hello-world/README.md
3299
3310
  - tracks/delphi/exercises/hello-world/uHelloWorldExample.pas
3300
3311
  - tracks/delphi/exercises/hello-world/uTestHelloWorld.pas
3312
+ - tracks/delphi/exercises/isbn-verifier/ISBNVerifier.dpr
3313
+ - tracks/delphi/exercises/isbn-verifier/README.md
3314
+ - tracks/delphi/exercises/isbn-verifier/uISBNVerifierExample.pas
3315
+ - tracks/delphi/exercises/isbn-verifier/uTestISBNVerifier.pas
3301
3316
  - tracks/delphi/exercises/leap/Leap.dpr
3302
3317
  - tracks/delphi/exercises/leap/README.md
3303
3318
  - tracks/delphi/exercises/leap/uLeapExample.pas
@@ -3346,6 +3361,10 @@ files:
3346
3361
  - tracks/delphi/exercises/saddle-points/SaddlePoints.dpr
3347
3362
  - tracks/delphi/exercises/saddle-points/uSaddlePointsExample.pas
3348
3363
  - tracks/delphi/exercises/saddle-points/uSaddlePointsTests.pas
3364
+ - tracks/delphi/exercises/secret-handshake/README.md
3365
+ - tracks/delphi/exercises/secret-handshake/SecretHandshake.dpr
3366
+ - tracks/delphi/exercises/secret-handshake/uSecretHandshakeExample.pas
3367
+ - tracks/delphi/exercises/secret-handshake/uTestSecretHandshake.pas
3349
3368
  - tracks/delphi/exercises/triangle/README.md
3350
3369
  - tracks/delphi/exercises/triangle/Triangle.dpr
3351
3370
  - tracks/delphi/exercises/triangle/uTestTriangle.pas
@@ -5612,16 +5631,17 @@ files:
5612
5631
  - tracks/fsharp/exercises/zipper/Zipper.fs
5613
5632
  - tracks/fsharp/exercises/zipper/Zipper.fsproj
5614
5633
  - tracks/fsharp/exercises/zipper/ZipperTest.fs
5634
+ - tracks/fsharp/generators/CanonicalData.fs
5615
5635
  - tracks/fsharp/generators/Common.fs
5616
5636
  - tracks/fsharp/generators/Exercise.fs
5637
+ - tracks/fsharp/generators/Formatting.fs
5617
5638
  - tracks/fsharp/generators/Generators.fs
5618
5639
  - tracks/fsharp/generators/Generators.fsproj
5619
5640
  - tracks/fsharp/generators/Generators.sln
5620
- - tracks/fsharp/generators/Input.fs
5621
5641
  - tracks/fsharp/generators/Options.fs
5622
- - tracks/fsharp/generators/Output.fs
5623
5642
  - tracks/fsharp/generators/Program.fs
5624
5643
  - tracks/fsharp/generators/Properties/launchSettings.json
5644
+ - tracks/fsharp/generators/Rendering.fs
5625
5645
  - tracks/fsharp/generators/Templates/_AssertEmpty.liquid
5626
5646
  - tracks/fsharp/generators/Templates/_AssertEqual.liquid
5627
5647
  - tracks/fsharp/generators/Templates/_AssertThrows.liquid
@@ -5701,8 +5721,11 @@ files:
5701
5721
  - tracks/go/exercises/acronym/acronym_test.go
5702
5722
  - tracks/go/exercises/acronym/cases_test.go
5703
5723
  - tracks/go/exercises/acronym/example.go
5724
+ - tracks/go/exercises/all-your-base/.meta/gen.go
5725
+ - tracks/go/exercises/all-your-base/.meta/hints.md
5704
5726
  - tracks/go/exercises/all-your-base/README.md
5705
5727
  - tracks/go/exercises/all-your-base/all_your_base_test.go
5728
+ - tracks/go/exercises/all-your-base/cases_test.go
5706
5729
  - tracks/go/exercises/all-your-base/example.go
5707
5730
  - tracks/go/exercises/allergies/.meta/gen.go
5708
5731
  - tracks/go/exercises/allergies/README.md
@@ -7191,6 +7214,7 @@ files:
7191
7214
  - tracks/java/exercises/etl/build.gradle
7192
7215
  - tracks/java/exercises/etl/src/main/java/Etl.java
7193
7216
  - tracks/java/exercises/etl/src/test/java/EtlTest.java
7217
+ - tracks/java/exercises/flatten-array/.meta/hints.md
7194
7218
  - tracks/java/exercises/flatten-array/.meta/src/reference/java/Flattener.java
7195
7219
  - tracks/java/exercises/flatten-array/.meta/version
7196
7220
  - tracks/java/exercises/flatten-array/README.md
@@ -7361,6 +7385,7 @@ files:
7361
7385
  - tracks/java/exercises/phone-number/build.gradle
7362
7386
  - tracks/java/exercises/phone-number/src/main/java/.keep
7363
7387
  - tracks/java/exercises/phone-number/src/test/java/PhoneNumberTest.java
7388
+ - tracks/java/exercises/pig-latin/.meta/hints.md
7364
7389
  - tracks/java/exercises/pig-latin/.meta/src/reference/java/PigLatinTranslator.java
7365
7390
  - tracks/java/exercises/pig-latin/README.md
7366
7391
  - tracks/java/exercises/pig-latin/build.gradle
@@ -7882,6 +7907,7 @@ files:
7882
7907
  - tracks/javascript/exercises/zipper/example.js
7883
7908
  - tracks/javascript/exercises/zipper/zipper.spec.js
7884
7909
  - tracks/javascript/img/icon.png
7910
+ - tracks/javascript/package-lock.json
7885
7911
  - tracks/javascript/package.json
7886
7912
  - tracks/julia/.git
7887
7913
  - tracks/julia/.gitignore
@@ -10962,6 +10988,7 @@ files:
10962
10988
  - tracks/python/exercises/rectangles/example.py
10963
10989
  - tracks/python/exercises/rectangles/rectangles.py
10964
10990
  - tracks/python/exercises/rectangles/rectangles_test.py
10991
+ - tracks/python/exercises/rna-transcription/.meta/hints.md
10965
10992
  - tracks/python/exercises/rna-transcription/README.md
10966
10993
  - tracks/python/exercises/rna-transcription/example.py
10967
10994
  - tracks/python/exercises/rna-transcription/rna_transcription.py
@@ -11019,9 +11046,9 @@ files:
11019
11046
  - tracks/python/exercises/simple-cipher/example.py
11020
11047
  - tracks/python/exercises/simple-cipher/simple_cipher.py
11021
11048
  - tracks/python/exercises/simple-cipher/simple_cipher_test.py
11049
+ - tracks/python/exercises/simple-linked-list/.meta/hints.md
11022
11050
  - tracks/python/exercises/simple-linked-list/README.md
11023
11051
  - tracks/python/exercises/simple-linked-list/example.py
11024
- - tracks/python/exercises/simple-linked-list/hints.md
11025
11052
  - tracks/python/exercises/simple-linked-list/simple_linked_list.py
11026
11053
  - tracks/python/exercises/simple-linked-list/simple_linked_list_test.py
11027
11054
  - tracks/python/exercises/space-age/README.md
@@ -12322,6 +12349,12 @@ files:
12322
12349
  - tracks/rust/exercises/run-length-encoding/example.rs
12323
12350
  - tracks/rust/exercises/run-length-encoding/src/lib.rs
12324
12351
  - tracks/rust/exercises/run-length-encoding/tests/run-length-encoding.rs
12352
+ - tracks/rust/exercises/saddle-points/.gitignore
12353
+ - tracks/rust/exercises/saddle-points/Cargo.toml
12354
+ - tracks/rust/exercises/saddle-points/README.md
12355
+ - tracks/rust/exercises/saddle-points/example.rs
12356
+ - tracks/rust/exercises/saddle-points/src/lib.rs
12357
+ - tracks/rust/exercises/saddle-points/tests/saddle-points.rs
12325
12358
  - tracks/rust/exercises/say/.gitignore
12326
12359
  - tracks/rust/exercises/say/.meta/hints.md
12327
12360
  - tracks/rust/exercises/say/Cargo.lock