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.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/custom-set/canonical-data.json +8 -1
- data/tracks/c/README.md +2 -44
- data/tracks/c/docs/CONTRIBUTING.md +93 -0
- data/tracks/c/docs/C_STYLE_GUIDE.md +1 -1
- data/tracks/clojure/config.json +27 -0
- data/tracks/clojure/exercises/accumulate/project.clj +1 -1
- data/tracks/clojure/exercises/acronym/project.clj +1 -1
- data/tracks/clojure/exercises/all-your-base/project.clj +1 -1
- data/tracks/clojure/exercises/allergies/project.clj +1 -1
- data/tracks/clojure/exercises/anagram/project.clj +1 -1
- data/tracks/clojure/exercises/atbash-cipher/project.clj +1 -1
- data/tracks/clojure/exercises/bank-account/project.clj +1 -1
- data/tracks/clojure/exercises/beer-song/project.clj +1 -1
- data/tracks/clojure/exercises/binary/project.clj +1 -1
- data/tracks/clojure/exercises/binary-search/project.clj +1 -1
- data/tracks/clojure/exercises/binary-search-tree/project.clj +1 -1
- data/tracks/clojure/exercises/bob/project.clj +1 -1
- data/tracks/clojure/exercises/bracket-push/project.clj +1 -1
- data/tracks/clojure/exercises/change/project.clj +1 -1
- data/tracks/clojure/exercises/clock/project.clj +1 -1
- data/tracks/clojure/exercises/collatz-conjecture/project.clj +1 -1
- data/tracks/clojure/exercises/complex-numbers/project.clj +1 -1
- data/tracks/clojure/exercises/crypto-square/project.clj +1 -1
- data/tracks/clojure/exercises/diamond/README.md +51 -0
- data/tracks/clojure/exercises/diamond/project.clj +4 -0
- data/tracks/clojure/exercises/diamond/src/example.clj +22 -0
- data/tracks/clojure/exercises/diamond/test/diamond_test.clj +79 -0
- data/tracks/clojure/exercises/difference-of-squares/project.clj +1 -1
- data/tracks/clojure/exercises/etl/project.clj +1 -1
- data/tracks/clojure/exercises/flatten-array/project.clj +1 -1
- data/tracks/clojure/exercises/gigasecond/project.clj +1 -1
- data/tracks/clojure/exercises/grade-school/project.clj +1 -1
- data/tracks/clojure/exercises/grains/project.clj +1 -1
- data/tracks/clojure/exercises/hamming/project.clj +1 -1
- data/tracks/clojure/exercises/hello-world/project.clj +1 -1
- data/tracks/clojure/exercises/hexadecimal/project.clj +1 -1
- data/tracks/clojure/exercises/isogram/project.clj +1 -1
- data/tracks/clojure/exercises/kindergarten-garden/project.clj +1 -1
- data/tracks/clojure/exercises/largest-series-product/project.clj +1 -1
- data/tracks/clojure/exercises/leap/project.clj +1 -1
- data/tracks/clojure/exercises/luhn/project.clj +1 -1
- data/tracks/clojure/exercises/meetup/project.clj +1 -1
- data/tracks/clojure/exercises/minesweeper/project.clj +1 -1
- data/tracks/clojure/exercises/nth-prime/project.clj +1 -1
- data/tracks/clojure/exercises/nucleotide-count/project.clj +1 -1
- data/tracks/clojure/exercises/octal/project.clj +1 -1
- data/tracks/clojure/exercises/pascals-triangle/project.clj +1 -1
- data/tracks/clojure/exercises/perfect-numbers/project.clj +1 -1
- data/tracks/clojure/exercises/phone-number/project.clj +1 -1
- data/tracks/clojure/exercises/pig-latin/project.clj +1 -1
- data/tracks/clojure/exercises/prime-factors/project.clj +1 -1
- data/tracks/clojure/exercises/protein-translation/README.md +40 -0
- data/tracks/clojure/exercises/protein-translation/project.clj +4 -0
- data/tracks/clojure/exercises/protein-translation/src/example.clj +19 -0
- data/tracks/clojure/exercises/protein-translation/test/protein_translation_test.clj +36 -0
- data/tracks/clojure/exercises/queen-attack/project.clj +1 -1
- data/tracks/clojure/exercises/raindrops/project.clj +1 -1
- data/tracks/clojure/exercises/rna-transcription/project.clj +1 -1
- data/tracks/clojure/exercises/robot-name/project.clj +1 -1
- data/tracks/clojure/exercises/robot-simulator/project.clj +1 -1
- data/tracks/clojure/exercises/roman-numerals/project.clj +1 -1
- data/tracks/clojure/exercises/rotational-cipher/project.clj +1 -1
- data/tracks/clojure/exercises/run-length-encoding/README.md +36 -0
- data/tracks/clojure/exercises/run-length-encoding/project.clj +4 -0
- data/tracks/clojure/exercises/run-length-encoding/src/example.clj +20 -0
- data/tracks/clojure/exercises/run-length-encoding/src/run_length_encoding.clj +11 -0
- data/tracks/clojure/exercises/run-length-encoding/test/run_length_encoding_test.clj +57 -0
- data/tracks/clojure/exercises/scrabble-score/project.clj +1 -1
- data/tracks/clojure/exercises/secret-handshake/project.clj +1 -1
- data/tracks/clojure/exercises/series/project.clj +1 -1
- data/tracks/clojure/exercises/sieve/project.clj +1 -1
- data/tracks/clojure/exercises/space-age/project.clj +1 -1
- data/tracks/clojure/exercises/spiral-matrix/project.clj +1 -1
- data/tracks/clojure/exercises/strain/project.clj +1 -1
- data/tracks/clojure/exercises/sublist/project.clj +1 -1
- data/tracks/clojure/exercises/sum-of-multiples/project.clj +1 -1
- data/tracks/clojure/exercises/triangle/project.clj +1 -1
- data/tracks/clojure/exercises/trinary/project.clj +1 -1
- data/tracks/clojure/exercises/word-count/project.clj +1 -1
- data/tracks/clojure/exercises/wordy/project.clj +1 -1
- data/tracks/clojure/project.clj +2 -2
- data/tracks/ecmascript/config.json +10 -15
- data/tracks/ecmascript/docs/TESTS.md +15 -0
- data/tracks/ecmascript/exercises/complex-numbers/README.md +68 -0
- data/tracks/ecmascript/exercises/complex-numbers/complex-numbers.spec.js +216 -0
- data/tracks/ecmascript/exercises/complex-numbers/example.js +43 -0
- data/tracks/ecmascript/exercises/{transpose → complex-numbers}/package.json +2 -2
- data/tracks/elixir/config.json +22 -1
- data/tracks/elixir/exercises/isbn-verifier/README.md +80 -0
- data/tracks/elixir/exercises/isbn-verifier/example.exs +36 -0
- data/tracks/elixir/exercises/isbn-verifier/isbn_verifier.exs +18 -0
- data/tracks/elixir/exercises/isbn-verifier/isbn_verifier_test.exs +75 -0
- data/tracks/elixir/exercises/spiral-matrix/README.md +65 -0
- data/tracks/elixir/exercises/spiral-matrix/example.exs +27 -0
- data/tracks/elixir/exercises/spiral-matrix/spiral.exs +9 -0
- data/tracks/elixir/exercises/spiral-matrix/spiral_test.exs +58 -0
- data/tracks/erlang/config.json +10 -0
- data/tracks/erlang/exercises/complex-numbers/HINTS.md +2 -0
- data/tracks/erlang/exercises/complex-numbers/README.md +85 -0
- data/tracks/erlang/exercises/complex-numbers/include/exercism.hrl +11 -0
- data/tracks/erlang/exercises/complex-numbers/rebar.config +30 -0
- data/tracks/erlang/exercises/complex-numbers/src/complex_numbers.app.src +9 -0
- data/tracks/erlang/exercises/complex-numbers/src/complex_numbers.erl +29 -0
- data/tracks/erlang/exercises/complex-numbers/src/example.erl +44 -0
- data/tracks/erlang/exercises/complex-numbers/test/complex_numbers_tests.erl +152 -0
- data/tracks/erlang/testgen/src/tgen.erl +1 -1
- data/tracks/erlang/testgen/src/tgen_complex-numbers.erl +75 -0
- data/tracks/java/config.json +10 -5
- data/tracks/javascript/config.json +13 -0
- data/tracks/javascript/exercises/isbn-verifier/README.md +66 -0
- data/tracks/javascript/exercises/isbn-verifier/example.js +24 -0
- data/tracks/javascript/exercises/isbn-verifier/isbn-verifier.spec.js +68 -0
- data/tracks/perl6/config/maintainers.json +4 -4
- data/tracks/perl6/config.json +21 -21
- data/tracks/php/README.md +1 -0
- data/tracks/python/config/maintainers.json +3 -3
- data/tracks/python/exercises/alphametics/alphametics_test.py +6 -6
- data/tracks/python/exercises/queen-attack/queen_attack_test.py +60 -40
- data/tracks/sml/config.json +13 -2
- data/tracks/sml/exercises/flatten-array/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/sml/exercises/nth-prime/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/sml/exercises/pig-latin/README.md +54 -0
- data/tracks/sml/exercises/pig-latin/example.sml +23 -0
- data/tracks/sml/exercises/pig-latin/pig-latin.sml +2 -0
- data/tracks/sml/exercises/pig-latin/test.sml +90 -0
- data/tracks/sml/exercises/pig-latin/testlib.sml +159 -0
- data/tracks/typescript/config.json +16 -0
- data/tracks/typescript/exercises/ocr-numbers/README.md +110 -0
- data/tracks/typescript/exercises/ocr-numbers/ocr-numbers.example.ts +92 -0
- data/tracks/typescript/exercises/ocr-numbers/ocr-numbers.test.ts +155 -0
- data/tracks/typescript/exercises/ocr-numbers/ocr-numbers.ts +3 -0
- data/tracks/typescript/exercises/ocr-numbers/package.json +36 -0
- data/tracks/typescript/exercises/ocr-numbers/tsconfig.json +22 -0
- data/tracks/typescript/exercises/ocr-numbers/tslint.json +127 -0
- data/tracks/typescript/exercises/ocr-numbers/yarn.lock +2624 -0
- metadata +55 -8
- data/tracks/ecmascript/exercises/transpose/README.md +0 -94
- data/tracks/ecmascript/exercises/transpose/example.js +0 -12
- 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa66c91549abb0087fdc23e6f042092222585ec6
|
4
|
+
data.tar.gz: '043992d475673db6aad726d94da4b8539323e471'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64ca07c7338c0c3167adee155b8956f0fa1aa17f1ad0eb51c1626f3818d4405aeb5e16b7fe7438820de2440ec4bbca0261dc7f2081db9f438885e550d5646f59
|
7
|
+
data.tar.gz: 0e932c6b1405d8a573873a75ff4f78bacde1799292f57b23c27fcef8c041460c9a635785b5bd5461a821ee54806ecd18e1ce60992dad14fce79f74e6bb939561
|
data/lib/trackler/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"exercise": "custom-set",
|
3
|
-
"version": "1.0
|
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
|
15
|
+
## Contributing
|
16
16
|
|
17
|
-
Please see the [
|
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
|
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
|
|
data/tracks/clojure/config.json
CHANGED
@@ -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/
|
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 all-your-base "0.1.0-SNAPSHOT"
|
2
2
|
:description "all-your-base exercise."
|
3
|
-
:url "https://github.com/exercism/
|
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/
|
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 atbash-cipher "0.1.0-SNAPSHOT"
|
2
2
|
:description "atbash-cipher exercise."
|
3
|
-
:url "https://github.com/exercism/
|
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/
|
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/
|
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-search "0.1.0-SNAPSHOT"
|
2
2
|
:description "binary-search exercise."
|
3
|
-
:url "https://github.com/exercism/
|
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/
|
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 bracket-push "0.1.0-SNAPSHOT"
|
2
2
|
:description "bracket-push exercise."
|
3
|
-
:url "https://github.com/exercism/
|
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/
|
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 collatz-conjecture "0.1.0-SNAPSHOT"
|
2
2
|
:description "collatz-conjecture exercise"
|
3
|
-
:url "https://github.com/exercism/
|
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/
|
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/
|
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,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/
|
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 flatten-array "0.1.0-SNAPSHOT"
|
2
2
|
:description "flatten-array exercise."
|
3
|
-
:url "https://github.com/exercism/
|
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/
|
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/
|
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 hello-world "0.1.0-SNAPSHOT"
|
2
2
|
:description "hello-world exercise."
|
3
|
-
:url "https://github.com/exercism/
|
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/
|
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 kindergarten-garden "0.1.0-SNAPSHOT"
|
2
2
|
:description "kindergarten-garden exercise."
|
3
|
-
:url "https://github.com/exercism/
|
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/
|
3
|
+
:url "https://github.com/exercism/clojure/tree/master/exercises/largest-series-product"
|
4
4
|
:dependencies [[org.clojure/clojure "1.8.0"]])
|