trackler 2.2.1.57 → 2.2.1.58

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/custom-set/canonical-data.json +8 -1
  4. data/tracks/c/README.md +2 -44
  5. data/tracks/c/docs/CONTRIBUTING.md +93 -0
  6. data/tracks/c/docs/C_STYLE_GUIDE.md +1 -1
  7. data/tracks/clojure/config.json +27 -0
  8. data/tracks/clojure/exercises/accumulate/project.clj +1 -1
  9. data/tracks/clojure/exercises/acronym/project.clj +1 -1
  10. data/tracks/clojure/exercises/all-your-base/project.clj +1 -1
  11. data/tracks/clojure/exercises/allergies/project.clj +1 -1
  12. data/tracks/clojure/exercises/anagram/project.clj +1 -1
  13. data/tracks/clojure/exercises/atbash-cipher/project.clj +1 -1
  14. data/tracks/clojure/exercises/bank-account/project.clj +1 -1
  15. data/tracks/clojure/exercises/beer-song/project.clj +1 -1
  16. data/tracks/clojure/exercises/binary/project.clj +1 -1
  17. data/tracks/clojure/exercises/binary-search/project.clj +1 -1
  18. data/tracks/clojure/exercises/binary-search-tree/project.clj +1 -1
  19. data/tracks/clojure/exercises/bob/project.clj +1 -1
  20. data/tracks/clojure/exercises/bracket-push/project.clj +1 -1
  21. data/tracks/clojure/exercises/change/project.clj +1 -1
  22. data/tracks/clojure/exercises/clock/project.clj +1 -1
  23. data/tracks/clojure/exercises/collatz-conjecture/project.clj +1 -1
  24. data/tracks/clojure/exercises/complex-numbers/project.clj +1 -1
  25. data/tracks/clojure/exercises/crypto-square/project.clj +1 -1
  26. data/tracks/clojure/exercises/diamond/README.md +51 -0
  27. data/tracks/clojure/exercises/diamond/project.clj +4 -0
  28. data/tracks/clojure/exercises/diamond/src/example.clj +22 -0
  29. data/tracks/clojure/exercises/diamond/test/diamond_test.clj +79 -0
  30. data/tracks/clojure/exercises/difference-of-squares/project.clj +1 -1
  31. data/tracks/clojure/exercises/etl/project.clj +1 -1
  32. data/tracks/clojure/exercises/flatten-array/project.clj +1 -1
  33. data/tracks/clojure/exercises/gigasecond/project.clj +1 -1
  34. data/tracks/clojure/exercises/grade-school/project.clj +1 -1
  35. data/tracks/clojure/exercises/grains/project.clj +1 -1
  36. data/tracks/clojure/exercises/hamming/project.clj +1 -1
  37. data/tracks/clojure/exercises/hello-world/project.clj +1 -1
  38. data/tracks/clojure/exercises/hexadecimal/project.clj +1 -1
  39. data/tracks/clojure/exercises/isogram/project.clj +1 -1
  40. data/tracks/clojure/exercises/kindergarten-garden/project.clj +1 -1
  41. data/tracks/clojure/exercises/largest-series-product/project.clj +1 -1
  42. data/tracks/clojure/exercises/leap/project.clj +1 -1
  43. data/tracks/clojure/exercises/luhn/project.clj +1 -1
  44. data/tracks/clojure/exercises/meetup/project.clj +1 -1
  45. data/tracks/clojure/exercises/minesweeper/project.clj +1 -1
  46. data/tracks/clojure/exercises/nth-prime/project.clj +1 -1
  47. data/tracks/clojure/exercises/nucleotide-count/project.clj +1 -1
  48. data/tracks/clojure/exercises/octal/project.clj +1 -1
  49. data/tracks/clojure/exercises/pascals-triangle/project.clj +1 -1
  50. data/tracks/clojure/exercises/perfect-numbers/project.clj +1 -1
  51. data/tracks/clojure/exercises/phone-number/project.clj +1 -1
  52. data/tracks/clojure/exercises/pig-latin/project.clj +1 -1
  53. data/tracks/clojure/exercises/prime-factors/project.clj +1 -1
  54. data/tracks/clojure/exercises/protein-translation/README.md +40 -0
  55. data/tracks/clojure/exercises/protein-translation/project.clj +4 -0
  56. data/tracks/clojure/exercises/protein-translation/src/example.clj +19 -0
  57. data/tracks/clojure/exercises/protein-translation/test/protein_translation_test.clj +36 -0
  58. data/tracks/clojure/exercises/queen-attack/project.clj +1 -1
  59. data/tracks/clojure/exercises/raindrops/project.clj +1 -1
  60. data/tracks/clojure/exercises/rna-transcription/project.clj +1 -1
  61. data/tracks/clojure/exercises/robot-name/project.clj +1 -1
  62. data/tracks/clojure/exercises/robot-simulator/project.clj +1 -1
  63. data/tracks/clojure/exercises/roman-numerals/project.clj +1 -1
  64. data/tracks/clojure/exercises/rotational-cipher/project.clj +1 -1
  65. data/tracks/clojure/exercises/run-length-encoding/README.md +36 -0
  66. data/tracks/clojure/exercises/run-length-encoding/project.clj +4 -0
  67. data/tracks/clojure/exercises/run-length-encoding/src/example.clj +20 -0
  68. data/tracks/clojure/exercises/run-length-encoding/src/run_length_encoding.clj +11 -0
  69. data/tracks/clojure/exercises/run-length-encoding/test/run_length_encoding_test.clj +57 -0
  70. data/tracks/clojure/exercises/scrabble-score/project.clj +1 -1
  71. data/tracks/clojure/exercises/secret-handshake/project.clj +1 -1
  72. data/tracks/clojure/exercises/series/project.clj +1 -1
  73. data/tracks/clojure/exercises/sieve/project.clj +1 -1
  74. data/tracks/clojure/exercises/space-age/project.clj +1 -1
  75. data/tracks/clojure/exercises/spiral-matrix/project.clj +1 -1
  76. data/tracks/clojure/exercises/strain/project.clj +1 -1
  77. data/tracks/clojure/exercises/sublist/project.clj +1 -1
  78. data/tracks/clojure/exercises/sum-of-multiples/project.clj +1 -1
  79. data/tracks/clojure/exercises/triangle/project.clj +1 -1
  80. data/tracks/clojure/exercises/trinary/project.clj +1 -1
  81. data/tracks/clojure/exercises/word-count/project.clj +1 -1
  82. data/tracks/clojure/exercises/wordy/project.clj +1 -1
  83. data/tracks/clojure/project.clj +2 -2
  84. data/tracks/ecmascript/config.json +10 -15
  85. data/tracks/ecmascript/docs/TESTS.md +15 -0
  86. data/tracks/ecmascript/exercises/complex-numbers/README.md +68 -0
  87. data/tracks/ecmascript/exercises/complex-numbers/complex-numbers.spec.js +216 -0
  88. data/tracks/ecmascript/exercises/complex-numbers/example.js +43 -0
  89. data/tracks/ecmascript/exercises/{transpose → complex-numbers}/package.json +2 -2
  90. data/tracks/elixir/config.json +22 -1
  91. data/tracks/elixir/exercises/isbn-verifier/README.md +80 -0
  92. data/tracks/elixir/exercises/isbn-verifier/example.exs +36 -0
  93. data/tracks/elixir/exercises/isbn-verifier/isbn_verifier.exs +18 -0
  94. data/tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs +75 -0
  95. data/tracks/elixir/exercises/spiral-matrix/README.md +65 -0
  96. data/tracks/elixir/exercises/spiral-matrix/example.exs +27 -0
  97. data/tracks/elixir/exercises/spiral-matrix/spiral.exs +9 -0
  98. data/tracks/elixir/exercises/spiral-matrix/spiral_test.exs +58 -0
  99. data/tracks/erlang/config.json +10 -0
  100. data/tracks/erlang/exercises/complex-numbers/HINTS.md +2 -0
  101. data/tracks/erlang/exercises/complex-numbers/README.md +85 -0
  102. data/tracks/erlang/exercises/complex-numbers/include/exercism.hrl +11 -0
  103. data/tracks/erlang/exercises/complex-numbers/rebar.config +30 -0
  104. data/tracks/erlang/exercises/complex-numbers/src/complex_numbers.app.src +9 -0
  105. data/tracks/erlang/exercises/complex-numbers/src/complex_numbers.erl +29 -0
  106. data/tracks/erlang/exercises/complex-numbers/src/example.erl +44 -0
  107. data/tracks/erlang/exercises/complex-numbers/test/complex_numbers_tests.erl +152 -0
  108. data/tracks/erlang/testgen/src/tgen.erl +1 -1
  109. data/tracks/erlang/testgen/src/tgen_complex-numbers.erl +75 -0
  110. data/tracks/java/config.json +10 -5
  111. data/tracks/javascript/config.json +13 -0
  112. data/tracks/javascript/exercises/isbn-verifier/README.md +66 -0
  113. data/tracks/javascript/exercises/isbn-verifier/example.js +24 -0
  114. data/tracks/javascript/exercises/isbn-verifier/isbn-verifier.spec.js +68 -0
  115. data/tracks/perl6/config/maintainers.json +4 -4
  116. data/tracks/perl6/config.json +21 -21
  117. data/tracks/php/README.md +1 -0
  118. data/tracks/python/config/maintainers.json +3 -3
  119. data/tracks/python/exercises/alphametics/alphametics_test.py +6 -6
  120. data/tracks/python/exercises/queen-attack/queen_attack_test.py +60 -40
  121. data/tracks/sml/config.json +13 -2
  122. data/tracks/sml/exercises/flatten-array/{HINTS.md → .meta/hints.md} +0 -0
  123. data/tracks/sml/exercises/nth-prime/{HINTS.md → .meta/hints.md} +0 -0
  124. data/tracks/sml/exercises/pig-latin/README.md +54 -0
  125. data/tracks/sml/exercises/pig-latin/example.sml +23 -0
  126. data/tracks/sml/exercises/pig-latin/pig-latin.sml +2 -0
  127. data/tracks/sml/exercises/pig-latin/test.sml +90 -0
  128. data/tracks/sml/exercises/pig-latin/testlib.sml +159 -0
  129. data/tracks/typescript/config.json +16 -0
  130. data/tracks/typescript/exercises/ocr-numbers/README.md +110 -0
  131. data/tracks/typescript/exercises/ocr-numbers/ocr-numbers.example.ts +92 -0
  132. data/tracks/typescript/exercises/ocr-numbers/ocr-numbers.test.ts +155 -0
  133. data/tracks/typescript/exercises/ocr-numbers/ocr-numbers.ts +3 -0
  134. data/tracks/typescript/exercises/ocr-numbers/package.json +36 -0
  135. data/tracks/typescript/exercises/ocr-numbers/tsconfig.json +22 -0
  136. data/tracks/typescript/exercises/ocr-numbers/tslint.json +127 -0
  137. data/tracks/typescript/exercises/ocr-numbers/yarn.lock +2624 -0
  138. metadata +55 -8
  139. data/tracks/ecmascript/exercises/transpose/README.md +0 -94
  140. data/tracks/ecmascript/exercises/transpose/example.js +0 -12
  141. data/tracks/ecmascript/exercises/transpose/transpose.spec.js +0 -67
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bf59a091755957ae186e813e2caf4399219caf02
4
- data.tar.gz: 8c62a92e24400de5a47ac799a1df71fb569d9329
3
+ metadata.gz: aa66c91549abb0087fdc23e6f042092222585ec6
4
+ data.tar.gz: '043992d475673db6aad726d94da4b8539323e471'
5
5
  SHA512:
6
- metadata.gz: 45246361a3465ea25273cb746941897588b0f9320af8a414875bb062c2c32195aa78df334d85a265ada89ad43a4ae059eb312e1de62a5f9c0019f932fcaf933c
7
- data.tar.gz: 981e6c1e993964aa5e56beda808a442a99e5ded61a4294c8ae2fa73781a54203363cc1ec7491e562d5a591cf6aa646c533057cb84a0fb3291466cc01e2444bb4
6
+ metadata.gz: 64ca07c7338c0c3167adee155b8956f0fa1aa17f1ad0eb51c1626f3818d4405aeb5e16b7fe7438820de2440ec4bbca0261dc7f2081db9f438885e550d5646f59
7
+ data.tar.gz: 0e932c6b1405d8a573873a75ff4f78bacde1799292f57b23c27fcef8c041460c9a635785b5bd5461a821ee54806ecd18e1ce60992dad14fce79f74e6bb939561
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.2.1.57"
2
+ VERSION = "2.2.1.58"
3
3
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "exercise": "custom-set",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "comments": [
5
5
  "These tests cover the core components of a set data structure: checking",
6
6
  "presence, adding, comparing and basic set operations. Other features",
@@ -179,6 +179,13 @@
179
179
  "set1": [1, 2, 3],
180
180
  "set2": [1, 2, 4],
181
181
  "expected": false
182
+ },
183
+ {
184
+ "description": "set is not equal to larger set with same elements",
185
+ "property": "equal",
186
+ "set1": [1, 2, 3],
187
+ "set2": [1, 2, 3, 4],
188
+ "expected": false
182
189
  }
183
190
  ]
184
191
  },
data/tracks/c/README.md CHANGED
@@ -12,51 +12,9 @@ Issues marked with these labels are a good place to start contributing - you are
12
12
 
13
13
  To get an idea of the general status in relation to the launch of the track, check out [issue #8](https://github.com/exercism/c/issues/8)
14
14
 
15
- ## Contributing Guide
15
+ ## Contributing
16
16
 
17
- Please see the [Exercism contributing guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md) for general contribution tips.
18
-
19
- ## Coding Style
20
-
21
- All test and example code should be written using the [Linux kernel coding style](https://www.kernel.org/doc/html/latest/process/coding-style.html) with 3 space indents and no tabs.
22
-
23
- If GNU `indent` is installed, this can be run on all files by executing `indent.sh`. On a Mac you can install the package `gnu-indent` using [Homebrew](http://brew.sh).
24
-
25
- To manually run it on a single file, you can execute:
26
-
27
- ```shell
28
- indent -linux -i3 -nut $(file)
29
- ```
30
-
31
- If your system does not support the `-linux` option, you can run the long form command instead:
32
-
33
- ```shell
34
- indent -nbad -bap -nbc -bbo -hnl -br -brs -c33 -cd33 -ncdb -ce -ci4 -cli0 -d0 -di1 -nfc1 -i3 -nut -ip0 -l80 -lp -npcs -nprs -npsl -sai -saf -saw -ncs -nsc -sob -nfca -cp33 -ss -il1 $(file)
35
- ```
36
-
37
- See the [GNU `indent` manual](https://www.gnu.org/software/indent/manual/indent.html#SEC4) for more information.
38
-
39
- ## Exercise Anatomy
40
-
41
- Each exercise should be contained in a directory ```c/exercises/<my exercise>``` with ```<my exercise>``` referring to the name of the exercise. The structure of the directory is as follows:
42
-
43
- ```
44
- +-- <my exercise>
45
- +-- makefile
46
- +-- src
47
- |   +-- example.c
48
- |   +-- example.h | <my exercise>.h
49
- +-- test
50
- +-- test_<my exercise>.c
51
- +-- vendor
52
- +-- unity.c
53
- +-- unity.h
54
- +-- unity_internals.h
55
- ```
56
-
57
- * `test` - contains the test file ```test_<my exercise>.c``` and a ```vendor``` directory containing the test harness [Unity](http://www.throwtheswitch.org/unity/) from [ThrowTheSwitch](http://www.throwtheswitch.org/#intro-1-section). ThrowTheSwitch has a decent guide on [getting started with Unity](http://www.throwtheswitch.org/getting-started-with-unity/) should you desire a tutorial.
58
-
59
- * `src` - contains the example files ```example.c``` and ```example.h```. These are both skipped by the ```exercism``` cli when downloading to the client, so it is imperative that you do not reference the names of the files in your code. If you need to provide a header file example that is necessary to run your tests it should be named ```<my exercise>.h``` instead. Please also use [```include```](http://faculty.cs.niu.edu/~mcmahon/CS241/c241man/node90.html) guards in your header files. The tests can be run using the [```bin/run-tests```](https://github.com/exercism/c/blob/master/bin/run-tests) script which will rename the ```example.{c|h}``` files accordingly.
17
+ Contributions are very welcome! Please see the [contributing guide](https://github.com/exercism/c/blob/master/docs/CONTRIBUTING.md) to get started. The guide contains general contribution tips, information on the code style, information on the continuous integration used and the anatomy of an exercise on this language track.
60
18
 
61
19
  ## License
62
20
 
@@ -0,0 +1,93 @@
1
+ # Contributing to the C Track
2
+
3
+ Thank you for interest in contributing to the Exercism C language track!
4
+ All contributions are welcome, be it a new exercise, a change to the tooling or documentation, a raised issue or even just a commment on an existing issue or PR.
5
+ This file provides information to help you get started.
6
+
7
+ Firstly, have a read of the Exercism [docs repository](https://github.com/exercism/docs), specifically the information on [contributing to a language track](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md), as these documents cover a lot of the basic information.
8
+
9
+ Subsequently note that there are a few things specific to this repository that are explained below.
10
+
11
+ ## Coding Style
12
+
13
+ The code style expected for code change contributions is explained in the [style guide](https://github.com/exercism/c/blob/master/docs/C_STYLE_GUIDE.md#indentation-and-format).
14
+ In short, they equate to the [Linux kernel coding style](https://www.kernel.org/doc/html/latest/process/coding-style.html) with 3 space indents and no tabs, and snake cased names.
15
+
16
+ The exercise code is checked during CI for conformance to the spacing and indentation style rules. The check uses the GNU `indent` CLI tool.
17
+ When adding or making a change to an exercise, you can check that your change conforms to these rules by running the tool locally before commiting.
18
+
19
+ On linux `indent` should be available for install via your distribution's package manager.
20
+ On a Mac you can install the package `gnu-indent` using [Homebrew](https://brew.sh).
21
+
22
+ Indent can be run on all files by executing `indent.sh`.
23
+ To manually run it on a single file, you can execute:
24
+
25
+ ```bash
26
+ indent -linux -i3 -nut $(file)
27
+ ```
28
+
29
+ If your system does not support the `-linux` option, you can run the long-form command instead:
30
+
31
+ ```bash
32
+ indent -nbad -bap -nbc -bbo -hnl -br -brs -c33 -cd33 -ncdb -ce -ci4 -cli0 -d0 -di1 -nfc1 -i3 -nut -ip0 -l80 -lp -npcs -nprs -npsl -sai -saf -saw -ncs -nsc -sob -nfca -cp33 -ss -il1 $(file)
33
+ ```
34
+
35
+ ## Continuous Integration
36
+
37
+ The repository uses Travis CI to run some scripts on each commit to a pull request.
38
+ The simplest way to run these scripts on your own contribution is to open a PR on this repository with your changes, mark the title as [WIP] so that maintainers know that it isn't quite ready to be merged just yet and then allow this repository's CI setup to take care of things for you automatically.
39
+
40
+ ### Run CI on Your Own Fork
41
+
42
+ If you would like, it is also possible to run Travis on your own fork.
43
+ The good folks at fish-shell have [some great information](https://github.com/fish-shell/fish-shell/blob/master/CONTRIBUTING.md#travis-ci-build-and-test) to help you get started with setting up Travis on your own fork.
44
+
45
+ ### Run CI Scripts Locally
46
+ You can also run individual scripts on your own machine before commiting.
47
+ Firstly make sure you have the necessary tools installed (such as `indent`, `git`, `sed`, `make`, `valgrind` and a C compiler), and then run the required script from the repoistory root. For example:
48
+
49
+ ```bash
50
+ ~/git/c$ ./bin/run-tests
51
+ ```
52
+
53
+ ### What Are the CI Scripts?
54
+ You can see from the [.travis.yml](https://github.com/exercism/c/blob/master/.travis.yml) file that Travis is instructed to run scripts from the [`./bin`](https://github.com/exercism/c/tree/master/bin) directory.
55
+ The work these scripts perform is descibed as folows:
56
+
57
+ - `fetch-configlet` just fetches the `configlet` tool from its [repository](https://github.com/exercism/configlet).
58
+
59
+ - `configlet` is a tool, specific to Exercism, that performs some repository management tasks.
60
+ The command for `configlet` used by Travis is [`lint`](https://github.com/exercism/configlet/blob/master/README.md#lint). If `configlet` finds any issues Travis will output the details and report a failure on the related PR.
61
+
62
+ - `verify-indent` runs `indent` and verifies that it did not result in any file changes.
63
+ If the check does result in file changes, Travis will output the details and report a failure on the related PR.
64
+
65
+ - `run-tests` loops through each exercise, prepares the exercise for building and then builds it using `make` and runs `valgrind`.
66
+ If there are build errors, any test fails or there is a memory leak, Travis will output the details and report a failure on the related PR.
67
+
68
+ ## Exercise anatomy
69
+
70
+ Each exercise should be contained in a directory `c/exercises/<my exercise>` with `<my exercise>` referring to the name of the exercise.
71
+ The structure of the directory is as follows:
72
+
73
+ ```
74
+ +-- <my exercise>
75
+ +-- makefile
76
+ +-- src
77
+ | +-- example.c
78
+ | +-- example.h | <my exercise>.h
79
+ +-- test
80
+ +-- test_<my exercise>.c
81
+ +-- vendor
82
+ +-- unity.c
83
+ +-- unity.h
84
+ +-- unity_internals.h
85
+ ```
86
+
87
+ * `test` - contains the test file `test_<my exercise>.c` and a `vendor` directory containing the test harness [Unity](http://www.throwtheswitch.org/unity/) from [ThrowTheSwitch](http://www.throwtheswitch.org/#intro-1-section).
88
+ ThrowTheSwitch has a decent guide on [getting started with Unity](http://www.throwtheswitch.org/getting-started-with-unity/) should you desire a tutorial. The layout of the test file is described in the [style guide](https://github.com/exercism/c/blob/master/docs/C_STYLE_GUIDE.md#test-file-layout).
89
+
90
+ * `src` - contains the example files `example.c` and `example.h`. These are both skipped by the `exercism` CLI when downloading to the client, so it is imperative that you do not reference the names of the files in your code.
91
+ If you need to provide a header file example that is necessary to run your tests it should be named `<my exercise>.h` instead.
92
+ Please also use [`include`](http://faculty.cs.niu.edu/~mcmahon/CS241/c241man/node90.html) guards in your header files.
93
+ The tests can be run using the [`bin/run-tests`](https://github.com/exercism/c/blob/master/bin/run-tests) script which will rename the `example.{c|h}` files accordingly.
@@ -51,7 +51,7 @@ The correct prototype, providing that all other declarations and the definition
51
51
 
52
52
  ## Indentation and Format
53
53
 
54
- The repository uses GNU `indent`, as outlined in the [README](https://github.com/exercism/c/blob/master/README.md).
54
+ The repository uses the `indent` tool, as outlined in the [contributing guide](https://github.com/exercism/c/blob/master/docs/CONTRIBUTING.md).
55
55
 
56
56
  The options described for use with indent there are `-linux -i3 -nut`. The `-linux` option is a shortcut that is equivelent to a secific fixed group of options. The combined equivalent options are `-nbad -bap -nbc -bbo -hnl -br -brs -c33 -cd33 -ncdb -ce -ci4 -cli0 -d0 -di1 -nfc1 -i3 -nut -ip0 -l80 -lp -npcs -nprs -npsl -sai -saf -saw -ncs -nsc -sob -nfca -cp33 -ss -il1`.
57
57
 
@@ -25,6 +25,14 @@
25
25
  "unlocked_by": null,
26
26
  "uuid": "c2100dff-4d18-4fcb-9035-6c57eddd6d37"
27
27
  },
28
+ {
29
+ "core": false,
30
+ "difficulty": 1,
31
+ "slug": "run-length-encoding",
32
+ "topics": null,
33
+ "unlocked_by": null,
34
+ "uuid": "04a6c1d6-6cce-4c87-a34b-23fdd9baf70d"
35
+ },
28
36
  {
29
37
  "core": false,
30
38
  "difficulty": 1,
@@ -514,6 +522,25 @@
514
522
  "topics": null,
515
523
  "unlocked_by": null,
516
524
  "uuid": "622823dc-ee47-42a0-acc6-190de4541625"
525
+ },
526
+ {
527
+ "core": false,
528
+ "difficulty": 1,
529
+ "slug": "diamond",
530
+ "topics": null,
531
+ "unlocked_by": null,
532
+ "uuid": "f3971f71-08c9-4e36-a69e-5bd7fe070b07"
533
+ },
534
+ {
535
+ "core": false,
536
+ "difficulty": 1,
537
+ "slug": "protein-translation",
538
+ "unlocked_by": null,
539
+ "topics": [
540
+ "strings",
541
+ "pattern matching"
542
+ ],
543
+ "uuid": "c4b7120c-a7c5-4a39-a08e-8d4fb9861a27"
517
544
  }
518
545
  ],
519
546
  "foregone": [],
@@ -1,4 +1,4 @@
1
1
  (defproject accumulate "0.1.0-SNAPSHOT"
2
2
  :description "accumulate exercise."
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/accumulate"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/accumulate"
4
4
  :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -1,4 +1,4 @@
1
1
  (defproject acronym "0.1.0-SNAPSHOT"
2
2
  :description "acronym exercise."
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/acronym"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/acronym"
4
4
  :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -1,4 +1,4 @@
1
1
  (defproject all-your-base "0.1.0-SNAPSHOT"
2
2
  :description "all-your-base exercise."
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/all-your-base"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/all-your-base"
4
4
  :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -1,4 +1,4 @@
1
1
  (defproject allergies "0.1.0-SNAPSHOT"
2
2
  :description "allergies exercise."
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/allergies"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/allergies"
4
4
  :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -1,4 +1,4 @@
1
1
  (defproject anagram "0.1.0-SNAPSHOT"
2
2
  :description "anagram exercise."
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/anagram"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/anagram"
4
4
  :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -1,4 +1,4 @@
1
1
  (defproject atbash-cipher "0.1.0-SNAPSHOT"
2
2
  :description "atbash-cipher exercise."
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/atbash-cipher"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/atbash-cipher"
4
4
  :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -1,4 +1,4 @@
1
1
  (defproject bank-account "0.1.0-SNAPSHOT"
2
2
  :description "bank-account exercise."
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/bank-account"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/bank-account"
4
4
  :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -1,4 +1,4 @@
1
1
  (defproject beer-song "0.1.0-SNAPSHOT"
2
2
  :description "beer-song exercise."
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/beer-song"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/beer-song"
4
4
  :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -1,4 +1,4 @@
1
1
  (defproject binary "0.1.0-SNAPSHOT"
2
2
  :description "binary exercise."
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/binary"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/binary"
4
4
  :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -1,4 +1,4 @@
1
1
  (defproject binary-search "0.1.0-SNAPSHOT"
2
2
  :description "binary-search exercise."
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/binary-search"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/binary-search"
4
4
  :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -1,4 +1,4 @@
1
1
  (defproject binary-search-tree "0.1.0-SNAPSHOT"
2
2
  :description "binary-search-tree exercise."
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/binary-search-tree"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/binary-search-tree"
4
4
  :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -1,4 +1,4 @@
1
1
  (defproject bob "0.1.0-SNAPSHOT"
2
2
  :description "bob exercise."
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/bob"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/bob"
4
4
  :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -1,4 +1,4 @@
1
1
  (defproject bracket-push "0.1.0-SNAPSHOT"
2
2
  :description "bracket-push exercise."
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/bracket-push"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/bracket-push"
4
4
  :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -1,6 +1,6 @@
1
1
  (defproject change "0.1.0-SNAPSHOT"
2
2
  :description "[change] exercise"
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/change"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/change"
4
4
  :license {:name "Eclipse Public License"
5
5
  :url "http://www.eclipse.org/legal/epl-v10.html"}
6
6
  :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -1,4 +1,4 @@
1
1
  (defproject clock "0.1.0-SNAPSHOT"
2
2
  :description "clock exercise."
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/clock"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/clock"
4
4
  :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -1,4 +1,4 @@
1
1
  (defproject collatz-conjecture "0.1.0-SNAPSHOT"
2
2
  :description "collatz-conjecture exercise"
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/collatz-conjecture"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/collatz-conjecture"
4
4
  :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -1,4 +1,4 @@
1
1
  (defproject complex-numbers "0.1.0-SNAPSHOT"
2
2
  :description "complex-numbers exercise"
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/complex-numbers"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/complex-numbers"
4
4
  :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -1,4 +1,4 @@
1
1
  (defproject crypto-square "0.1.0-SNAPSHOT"
2
2
  :description "crypto-square exercise."
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/crypto-square"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/crypto-square"
4
4
  :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -0,0 +1,51 @@
1
+ The diamond kata takes as its input a letter, and outputs it in a diamond
2
+ shape. Given a letter, it prints a diamond starting with 'A', with the
3
+ supplied letter at the widest point.
4
+
5
+ ## Requirements
6
+
7
+ * The first row contains one 'A'.
8
+ * The last row contains one 'A'.
9
+ * All rows, except the first and last, have exactly two identical letters.
10
+ * All rows have as many trailing spaces as leading spaces. (This might be 0).
11
+ * The diamond is horizontally symmetric.
12
+ * The diamond is vertically symmetric.
13
+ * The diamond has a square shape (width equals height).
14
+ * The letters form a diamond shape.
15
+ * The top half has the letters in ascending order.
16
+ * The bottom half has the letters in descending order.
17
+ * The four corners (containing the spaces) are triangles.
18
+
19
+ ## Examples
20
+
21
+ In the following examples, spaces are indicated by `·` characters.
22
+
23
+ Diamond for letter 'A':
24
+
25
+ ```text
26
+ A
27
+ ```
28
+
29
+ Diamond for letter 'C':
30
+
31
+ ```text
32
+ ··A··
33
+ ·B·B·
34
+ C···C
35
+ ·B·B·
36
+ ··A··
37
+ ```
38
+
39
+ Diamond for letter 'E':
40
+
41
+ ```text
42
+ ····A····
43
+ ···B·B···
44
+ ··C···C··
45
+ ·D·····D·
46
+ E·······E
47
+ ·D·····D·
48
+ ··C···C··
49
+ ···B·B···
50
+ ····A····
51
+ ```
@@ -0,0 +1,4 @@
1
+ (defproject diamond "0.1.0-SNAPSHOT"
2
+ :description "diamond exercise."
3
+ :url "https://github.com/exercism/xclojure/tree/master/exercises/diamond"
4
+ :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -0,0 +1,22 @@
1
+ (ns diamond)
2
+
3
+ (def alphabet (map char (range (int \A) (inc (int \Z)))))
4
+
5
+ (defn- pad [x]
6
+ (apply str (repeat x " ")))
7
+
8
+ (defn- one-row [letter [inner-padding outer-padding]]
9
+ (if (= inner-padding 0)
10
+ (str (pad outer-padding) letter (pad outer-padding))
11
+ (str (pad outer-padding) letter (pad inner-padding) letter (pad outer-padding))))
12
+
13
+ (defn- row-paddings [num-letters]
14
+ (let [inner-padding (conj (iterate (partial + 2) 1) 0)
15
+ outer-padding (iterate dec (dec num-letters))]
16
+ (take num-letters (map vector inner-padding outer-padding))))
17
+
18
+ (defn diamond [c]
19
+ (let [num-letters (- (int c) (dec (int \A)))
20
+ top-half (map one-row alphabet (row-paddings num-letters))]
21
+ (concat top-half (rest (reverse top-half)))))
22
+
@@ -0,0 +1,79 @@
1
+ (ns diamond-test
2
+ (:require [clojure.test :refer [deftest is are]]
3
+ [diamond :refer [diamond]]))
4
+
5
+ (deftest single-a-row
6
+ (is (= (diamond \A) ["A"])))
7
+
8
+ (deftest b-diamond
9
+ (is (= (diamond \B) [" A "
10
+ "B B"
11
+ " A "])))
12
+ (deftest c-diamond
13
+ (is (= (diamond \C) [" A "
14
+ " B B "
15
+ "C C"
16
+ " B B "
17
+ " A "])))
18
+
19
+ (deftest d-diamond
20
+ (is (= (diamond \D) [" A "
21
+ " B B "
22
+ " C C "
23
+ "D D"
24
+ " C C "
25
+ " B B "
26
+ " A "])))
27
+
28
+ (deftest full-z-diamond
29
+ (is (= (diamond \Z) [" A "
30
+ " B B "
31
+ " C C "
32
+ " D D "
33
+ " E E "
34
+ " F F "
35
+ " G G "
36
+ " H H "
37
+ " I I "
38
+ " J J "
39
+ " K K "
40
+ " L L "
41
+ " M M "
42
+ " N N "
43
+ " O O "
44
+ " P P "
45
+ " Q Q "
46
+ " R R "
47
+ " S S "
48
+ " T T "
49
+ " U U "
50
+ " V V "
51
+ " W W "
52
+ " X X "
53
+ " Y Y "
54
+ "Z Z"
55
+ " Y Y "
56
+ " X X "
57
+ " W W "
58
+ " V V "
59
+ " U U "
60
+ " T T "
61
+ " S S "
62
+ " R R "
63
+ " Q Q "
64
+ " P P "
65
+ " O O "
66
+ " N N "
67
+ " M M "
68
+ " L L "
69
+ " K K "
70
+ " J J "
71
+ " I I "
72
+ " H H "
73
+ " G G "
74
+ " F F "
75
+ " E E "
76
+ " D D "
77
+ " C C "
78
+ " B B "
79
+ " A "])))
@@ -1,4 +1,4 @@
1
1
  (defproject difference-of-squares "0.1.0-SNAPSHOT"
2
2
  :description "difference-of-squares exercise."
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/difference-of-squares"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/difference-of-squares"
4
4
  :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -1,4 +1,4 @@
1
1
  (defproject etl "0.1.0-SNAPSHOT"
2
2
  :description "etl exercise."
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/etl"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/etl"
4
4
  :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -1,4 +1,4 @@
1
1
  (defproject flatten-array "0.1.0-SNAPSHOT"
2
2
  :description "flatten-array exercise."
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/flatten-array"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/flatten-array"
4
4
  :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -1,4 +1,4 @@
1
1
  (defproject gigasecond "0.1.0-SNAPSHOT"
2
2
  :description "gigasecond exercise."
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/gigasecond"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/gigasecond"
4
4
  :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -1,4 +1,4 @@
1
1
  (defproject grade-school "0.1.0-SNAPSHOT"
2
2
  :description "grade-school exercise."
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/grade-school"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/grade-school"
4
4
  :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -1,4 +1,4 @@
1
1
  (defproject grains "0.1.0-SNAPSHOT"
2
2
  :description "grains exercise."
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/grains"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/grains"
4
4
  :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -1,4 +1,4 @@
1
1
  (defproject hamming "0.1.0-SNAPSHOT"
2
2
  :description "hamming exercise."
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/hamming"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/hamming"
4
4
  :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -1,4 +1,4 @@
1
1
  (defproject hello-world "0.1.0-SNAPSHOT"
2
2
  :description "hello-world exercise."
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/hello-world"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/hello-world"
4
4
  :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -1,4 +1,4 @@
1
1
  (defproject hexadecimal "0.1.0-SNAPSHOT"
2
2
  :description "hexadecimal exercise."
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/hexadecimal"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/hexadecimal"
4
4
  :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -1,4 +1,4 @@
1
1
  (defproject isogram "0.1.0-SNAPSHOT"
2
2
  :description "isogram exercise."
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/isogram"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/isogram"
4
4
  :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -1,4 +1,4 @@
1
1
  (defproject kindergarten-garden "0.1.0-SNAPSHOT"
2
2
  :description "kindergarten-garden exercise."
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/kindergarten-garden"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/kindergarten-garden"
4
4
  :dependencies [[org.clojure/clojure "1.8.0"]])
@@ -1,4 +1,4 @@
1
1
  (defproject largest-series-product "0.1.0-SNAPSHOT"
2
2
  :description "largest-series-product exercise."
3
- :url "https://github.com/exercism/xclojure/tree/master/exercises/largest-series-product"
3
+ :url "https://github.com/exercism/clojure/tree/master/exercises/largest-series-product"
4
4
  :dependencies [[org.clojure/clojure "1.8.0"]])