trackler 2.2.1.94 → 2.2.1.95
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/anagram/canonical-data.json +1 -37
- data/tracks/crystal/exercises/hello-world/{HINTS.md → .meta/hints.md} +0 -0
- data/tracks/java/exercises/prime-factors/.meta/hints.md +58 -0
- data/tracks/java/exercises/prime-factors/README.md +62 -0
- data/tracks/java/exercises/robot-name/.meta/hints.md +58 -0
- data/tracks/java/exercises/robot-name/README.md +62 -0
- data/tracks/java/exercises/robot-simulator/src/test/java/RobotTest.java +9 -5
- data/tracks/java/exercises/run-length-encoding/.meta/hints.md +58 -0
- data/tracks/java/exercises/run-length-encoding/README.md +62 -0
- data/tracks/javascript/config/exercise_readme.go.tmpl +26 -4
- data/tracks/javascript/exercises/accumulate/README.md +16 -16
- data/tracks/javascript/exercises/acronym/README.md +15 -13
- data/tracks/javascript/exercises/all-your-base/README.md +16 -14
- data/tracks/javascript/exercises/allergies/README.md +15 -13
- data/tracks/javascript/exercises/alphametics/README.md +17 -15
- data/tracks/javascript/exercises/anagram/README.md +15 -12
- data/tracks/javascript/exercises/atbash-cipher/README.md +17 -13
- data/tracks/javascript/exercises/beer-song/README.md +17 -14
- data/tracks/javascript/exercises/binary/README.md +17 -12
- data/tracks/javascript/exercises/binary-search/README.md +15 -12
- data/tracks/javascript/exercises/binary-search-tree/README.md +15 -12
- data/tracks/javascript/exercises/bob/README.md +17 -12
- data/tracks/javascript/exercises/bowling/README.md +38 -21
- data/tracks/javascript/exercises/bracket-push/README.md +15 -12
- data/tracks/javascript/exercises/change/README.md +31 -17
- data/tracks/javascript/exercises/circular-buffer/README.md +28 -18
- data/tracks/javascript/exercises/clock/README.md +15 -12
- data/tracks/javascript/exercises/collatz-conjecture/README.md +15 -12
- data/tracks/javascript/exercises/connect/README.md +17 -16
- data/tracks/javascript/exercises/crypto-square/README.md +25 -20
- data/tracks/javascript/exercises/custom-set/README.md +15 -13
- data/tracks/javascript/exercises/diamond/README.md +21 -18
- data/tracks/javascript/exercises/difference-of-squares/README.md +16 -13
- data/tracks/javascript/exercises/diffie-hellman/README.md +15 -17
- data/tracks/javascript/exercises/etl/README.md +18 -13
- data/tracks/javascript/exercises/flatten-array/README.md +16 -14
- data/tracks/javascript/exercises/food-chain/README.md +16 -13
- data/tracks/javascript/exercises/forth/README.md +17 -18
- data/tracks/javascript/exercises/gigasecond/README.md +15 -12
- data/tracks/javascript/exercises/grade-school/README.md +15 -13
- data/tracks/javascript/exercises/grains/README.md +15 -13
- data/tracks/javascript/exercises/hamming/README.md +15 -12
- data/tracks/javascript/exercises/hello-world/README.md +15 -12
- data/tracks/javascript/exercises/hexadecimal/README.md +15 -12
- data/tracks/javascript/exercises/isbn-verifier/README.md +44 -36
- data/tracks/javascript/exercises/isogram/README.md +17 -13
- data/tracks/javascript/exercises/kindergarten-garden/README.md +28 -25
- data/tracks/javascript/exercises/largest-series-product/README.md +15 -12
- data/tracks/javascript/exercises/leap/README.md +16 -13
- data/tracks/javascript/exercises/linked-list/README.md +25 -22
- data/tracks/javascript/exercises/list-ops/README.md +15 -13
- data/tracks/javascript/exercises/luhn/README.md +22 -19
- data/tracks/javascript/exercises/matrix/README.md +21 -16
- data/tracks/javascript/exercises/meetup/README.md +31 -25
- data/tracks/javascript/exercises/minesweeper/README.md +15 -13
- data/tracks/javascript/exercises/nth-prime/README.md +15 -12
- data/tracks/javascript/exercises/nucleotide-count/README.md +23 -34
- data/tracks/javascript/exercises/ocr-numbers/README.md +21 -18
- data/tracks/javascript/exercises/octal/README.md +21 -14
- data/tracks/javascript/exercises/palindrome-products/README.md +29 -27
- data/tracks/javascript/exercises/pangram/README.md +16 -13
- data/tracks/javascript/exercises/pascals-triangle/README.md +17 -14
- data/tracks/javascript/exercises/perfect-numbers/README.md +17 -14
- data/tracks/javascript/exercises/phone-number/README.md +19 -15
- data/tracks/javascript/exercises/pig-latin/README.md +15 -12
- data/tracks/javascript/exercises/point-mutations/README.md +15 -12
- data/tracks/javascript/exercises/prime-factors/README.md +15 -12
- data/tracks/javascript/exercises/protein-translation/README.md +19 -17
- data/tracks/javascript/exercises/proverb/README.md +29 -21
- data/tracks/javascript/exercises/pythagorean-triplet/README.md +18 -15
- data/tracks/javascript/exercises/queen-attack/README.md +16 -13
- data/tracks/javascript/exercises/raindrops/README.md +15 -12
- data/tracks/javascript/exercises/reverse-string/README.md +19 -15
- data/tracks/javascript/exercises/rna-transcription/README.md +16 -13
- data/tracks/javascript/exercises/robot-name/README.md +15 -12
- data/tracks/javascript/exercises/robot-simulator/README.md +15 -12
- data/tracks/javascript/exercises/roman-numerals/README.md +16 -13
- data/tracks/javascript/exercises/run-length-encoding/README.md +19 -16
- data/tracks/javascript/exercises/saddle-points/README.md +16 -13
- data/tracks/javascript/exercises/say/README.md +15 -12
- data/tracks/javascript/exercises/scrabble-score/README.md +18 -13
- data/tracks/javascript/exercises/secret-handshake/README.md +16 -13
- data/tracks/javascript/exercises/series/README.md +15 -12
- data/tracks/javascript/exercises/sieve/README.md +15 -12
- data/tracks/javascript/exercises/simple-cipher/README.md +19 -18
- data/tracks/javascript/exercises/simple-linked-list/README.md +15 -12
- data/tracks/javascript/exercises/space-age/README.md +16 -13
- data/tracks/javascript/exercises/strain/README.md +15 -12
- data/tracks/javascript/exercises/sublist/README.md +14 -17
- data/tracks/javascript/exercises/sum-of-multiples/README.md +19 -19
- data/tracks/javascript/exercises/transpose/README.md +15 -12
- data/tracks/javascript/exercises/triangle/README.md +24 -18
- data/tracks/javascript/exercises/trinary/README.md +16 -13
- data/tracks/javascript/exercises/twelve-days/README.md +17 -16
- data/tracks/javascript/exercises/two-bucket/README.md +25 -22
- data/tracks/javascript/exercises/two-fer/README.md +19 -14
- data/tracks/javascript/exercises/word-count/README.md +16 -14
- data/tracks/javascript/exercises/wordy/README.md +15 -17
- data/tracks/javascript/exercises/zipper/README.md +20 -18
- data/tracks/perl6/docs/ABOUT.md +12 -21
- metadata +6 -4
- data/tracks/javascript/docs/EXERCISE_README_INSERT.md +0 -22
@@ -3,36 +3,38 @@
|
|
3
3
|
Take a nested list and return a single flattened list with all values except nil/null.
|
4
4
|
|
5
5
|
The challenge is to write a function that accepts an arbitrarily-deep nested list-like structure and returns a flattened structure without any nil/null values.
|
6
|
-
|
6
|
+
|
7
7
|
For Example
|
8
8
|
|
9
9
|
input: [1,[2,3,null,4],[null],5]
|
10
10
|
|
11
11
|
output: [1,2,3,4,5]
|
12
12
|
|
13
|
-
|
14
13
|
## Setup
|
15
14
|
|
16
|
-
Go through the setup instructions for JavaScript to
|
17
|
-
|
15
|
+
Go through the setup instructions for JavaScript to install the
|
16
|
+
necessary dependencies:
|
18
17
|
|
19
18
|
http://exercism.io/languages/javascript/installation
|
20
19
|
|
21
|
-
##
|
22
|
-
|
23
|
-
Execute the tests with:
|
20
|
+
## Running the test suite
|
24
21
|
|
25
|
-
|
22
|
+
The provided test suite uses [Jasmine](https://jasmine.github.io/).
|
23
|
+
You can install it by opening a terminal window and running the
|
24
|
+
following command:
|
26
25
|
|
27
|
-
|
28
|
-
|
26
|
+
```sh
|
27
|
+
npm install -g jasmine
|
28
|
+
```
|
29
29
|
|
30
|
-
|
30
|
+
Run the test suite from the exercise directory with:
|
31
31
|
|
32
|
-
|
32
|
+
```sh
|
33
|
+
jasmine flatten-array.spec.js
|
34
|
+
```
|
33
35
|
|
34
|
-
|
35
|
-
changing `xit` to `it`.
|
36
|
+
In many test suites all but the first test have been marked "pending".
|
37
|
+
Once you get a test passing, activate the next one by changing `xit` to `it`.
|
36
38
|
|
37
39
|
## Source
|
38
40
|
|
@@ -10,7 +10,7 @@ This is a [cumulative song](http://en.wikipedia.org/wiki/Cumulative_song) of unk
|
|
10
10
|
|
11
11
|
This is one of many common variants.
|
12
12
|
|
13
|
-
```
|
13
|
+
```text
|
14
14
|
I know an old lady who swallowed a fly.
|
15
15
|
I don't know why she swallowed the fly. Perhaps she'll die.
|
16
16
|
|
@@ -65,26 +65,29 @@ She's dead, of course!
|
|
65
65
|
|
66
66
|
## Setup
|
67
67
|
|
68
|
-
Go through the setup instructions for JavaScript to
|
69
|
-
|
68
|
+
Go through the setup instructions for JavaScript to install the
|
69
|
+
necessary dependencies:
|
70
70
|
|
71
71
|
http://exercism.io/languages/javascript/installation
|
72
72
|
|
73
|
-
##
|
73
|
+
## Running the test suite
|
74
74
|
|
75
|
-
|
75
|
+
The provided test suite uses [Jasmine](https://jasmine.github.io/).
|
76
|
+
You can install it by opening a terminal window and running the
|
77
|
+
following command:
|
76
78
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
test the Hello World exercise:
|
79
|
+
```sh
|
80
|
+
npm install -g jasmine
|
81
|
+
```
|
81
82
|
|
82
|
-
|
83
|
+
Run the test suite from the exercise directory with:
|
83
84
|
|
84
|
-
|
85
|
+
```sh
|
86
|
+
jasmine food-chain.spec.js
|
87
|
+
```
|
85
88
|
|
86
|
-
|
87
|
-
changing `xit` to `it`.
|
89
|
+
In many test suites all but the first test have been marked "pending".
|
90
|
+
Once you get a test passing, activate the next one by changing `xit` to `it`.
|
88
91
|
|
89
92
|
## Source
|
90
93
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# Forth
|
2
|
+
|
1
3
|
Implement an evaluator for a very simple subset of Forth.
|
2
4
|
|
3
5
|
[Forth](https://en.wikipedia.org/wiki/Forth_%28programming_language%29)
|
@@ -25,32 +27,29 @@ Words are case-insensitive.
|
|
25
27
|
|
26
28
|
## Setup
|
27
29
|
|
28
|
-
Go through the setup instructions for JavaScript to
|
29
|
-
|
30
|
+
Go through the setup instructions for JavaScript to install the
|
31
|
+
necessary dependencies:
|
30
32
|
|
31
33
|
http://exercism.io/languages/javascript/installation
|
32
34
|
|
33
|
-
##
|
34
|
-
|
35
|
-
Execute the tests with:
|
36
|
-
|
37
|
-
jasmine <exercise-name>.spec.js
|
38
|
-
|
39
|
-
Replace `<exercise-name>` with the name of the current exercise. E.g., to
|
40
|
-
test the Hello World exercise:
|
35
|
+
## Running the test suite
|
41
36
|
|
42
|
-
|
37
|
+
The provided test suite uses [Jasmine](https://jasmine.github.io/).
|
38
|
+
You can install it by opening a terminal window and running the
|
39
|
+
following command:
|
43
40
|
|
44
|
-
|
41
|
+
```sh
|
42
|
+
npm install -g jasmine
|
43
|
+
```
|
45
44
|
|
46
|
-
|
47
|
-
changing `xit` to `it`.
|
45
|
+
Run the test suite from the exercise directory with:
|
48
46
|
|
49
|
-
|
47
|
+
```sh
|
48
|
+
jasmine forth.spec.js
|
49
|
+
```
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
[Forth programming language](https://en.wikipedia.org/wiki/Forth_(programming_language))
|
51
|
+
In many test suites all but the first test have been marked "pending".
|
52
|
+
Once you get a test passing, activate the next one by changing `xit` to `it`.
|
54
53
|
|
55
54
|
## Submitting Incomplete Solutions
|
56
55
|
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -6,26 +6,29 @@ A gigasecond is 10^9 (1,000,000,000) seconds.
|
|
6
6
|
|
7
7
|
## Setup
|
8
8
|
|
9
|
-
Go through the setup instructions for JavaScript to
|
10
|
-
|
9
|
+
Go through the setup instructions for JavaScript to install the
|
10
|
+
necessary dependencies:
|
11
11
|
|
12
12
|
http://exercism.io/languages/javascript/installation
|
13
13
|
|
14
|
-
##
|
14
|
+
## Running the test suite
|
15
15
|
|
16
|
-
|
16
|
+
The provided test suite uses [Jasmine](https://jasmine.github.io/).
|
17
|
+
You can install it by opening a terminal window and running the
|
18
|
+
following command:
|
17
19
|
|
18
|
-
|
20
|
+
```sh
|
21
|
+
npm install -g jasmine
|
22
|
+
```
|
19
23
|
|
20
|
-
|
21
|
-
test the Hello World exercise:
|
24
|
+
Run the test suite from the exercise directory with:
|
22
25
|
|
23
|
-
|
26
|
+
```sh
|
27
|
+
jasmine gigasecond.spec.js
|
28
|
+
```
|
24
29
|
|
25
|
-
In many test suites all but the first test have been
|
26
|
-
|
27
|
-
Once you get a test passing, you can unskip the next one by
|
28
|
-
changing `xit` to `it`.
|
30
|
+
In many test suites all but the first test have been marked "pending".
|
31
|
+
Once you get a test passing, activate the next one by changing `xit` to `it`.
|
29
32
|
|
30
33
|
## Source
|
31
34
|
|
@@ -21,7 +21,6 @@ In the end, you should be able to:
|
|
21
21
|
Note that all our students only have one name. (It's a small town, what
|
22
22
|
do you want?)
|
23
23
|
|
24
|
-
|
25
24
|
## For bonus points
|
26
25
|
|
27
26
|
Did you get the tests passing and the code clean? If you want to, these
|
@@ -37,26 +36,29 @@ experiment make the code better? Worse? Did you learn anything from it?
|
|
37
36
|
|
38
37
|
## Setup
|
39
38
|
|
40
|
-
Go through the setup instructions for JavaScript to
|
41
|
-
|
39
|
+
Go through the setup instructions for JavaScript to install the
|
40
|
+
necessary dependencies:
|
42
41
|
|
43
42
|
http://exercism.io/languages/javascript/installation
|
44
43
|
|
45
|
-
##
|
46
|
-
|
47
|
-
Execute the tests with:
|
44
|
+
## Running the test suite
|
48
45
|
|
49
|
-
|
46
|
+
The provided test suite uses [Jasmine](https://jasmine.github.io/).
|
47
|
+
You can install it by opening a terminal window and running the
|
48
|
+
following command:
|
50
49
|
|
51
|
-
|
52
|
-
|
50
|
+
```sh
|
51
|
+
npm install -g jasmine
|
52
|
+
```
|
53
53
|
|
54
|
-
|
54
|
+
Run the test suite from the exercise directory with:
|
55
55
|
|
56
|
-
|
56
|
+
```sh
|
57
|
+
jasmine grade-school.spec.js
|
58
|
+
```
|
57
59
|
|
58
|
-
|
59
|
-
changing `xit` to `it`.
|
60
|
+
In many test suites all but the first test have been marked "pending".
|
61
|
+
Once you get a test passing, activate the next one by changing `xit` to `it`.
|
60
62
|
|
61
63
|
## Source
|
62
64
|
|
@@ -15,7 +15,6 @@ Write code that shows:
|
|
15
15
|
- how many grains were on each square, and
|
16
16
|
- the total number of grains
|
17
17
|
|
18
|
-
|
19
18
|
## For bonus points
|
20
19
|
|
21
20
|
Did you get the tests passing and the code clean? If you want to, these
|
@@ -29,26 +28,29 @@ experiment make the code better? Worse? Did you learn anything from it?
|
|
29
28
|
|
30
29
|
## Setup
|
31
30
|
|
32
|
-
Go through the setup instructions for JavaScript to
|
33
|
-
|
31
|
+
Go through the setup instructions for JavaScript to install the
|
32
|
+
necessary dependencies:
|
34
33
|
|
35
34
|
http://exercism.io/languages/javascript/installation
|
36
35
|
|
37
|
-
##
|
38
|
-
|
39
|
-
Execute the tests with:
|
36
|
+
## Running the test suite
|
40
37
|
|
41
|
-
|
38
|
+
The provided test suite uses [Jasmine](https://jasmine.github.io/).
|
39
|
+
You can install it by opening a terminal window and running the
|
40
|
+
following command:
|
42
41
|
|
43
|
-
|
44
|
-
|
42
|
+
```sh
|
43
|
+
npm install -g jasmine
|
44
|
+
```
|
45
45
|
|
46
|
-
|
46
|
+
Run the test suite from the exercise directory with:
|
47
47
|
|
48
|
-
|
48
|
+
```sh
|
49
|
+
jasmine grains.spec.js
|
50
|
+
```
|
49
51
|
|
50
|
-
|
51
|
-
changing `xit` to `it`.
|
52
|
+
In many test suites all but the first test have been marked "pending".
|
53
|
+
Once you get a test passing, activate the next one by changing `xit` to `it`.
|
52
54
|
|
53
55
|
## Source
|
54
56
|
|
@@ -37,26 +37,29 @@ of equal length differently.
|
|
37
37
|
|
38
38
|
## Setup
|
39
39
|
|
40
|
-
Go through the setup instructions for JavaScript to
|
41
|
-
|
40
|
+
Go through the setup instructions for JavaScript to install the
|
41
|
+
necessary dependencies:
|
42
42
|
|
43
43
|
http://exercism.io/languages/javascript/installation
|
44
44
|
|
45
|
-
##
|
45
|
+
## Running the test suite
|
46
46
|
|
47
|
-
|
47
|
+
The provided test suite uses [Jasmine](https://jasmine.github.io/).
|
48
|
+
You can install it by opening a terminal window and running the
|
49
|
+
following command:
|
48
50
|
|
49
|
-
|
51
|
+
```sh
|
52
|
+
npm install -g jasmine
|
53
|
+
```
|
50
54
|
|
51
|
-
|
52
|
-
test the Hello World exercise:
|
55
|
+
Run the test suite from the exercise directory with:
|
53
56
|
|
54
|
-
|
57
|
+
```sh
|
58
|
+
jasmine hamming.spec.js
|
59
|
+
```
|
55
60
|
|
56
|
-
In many test suites all but the first test have been
|
57
|
-
|
58
|
-
Once you get a test passing, you can unskip the next one by
|
59
|
-
changing `xit` to `it`.
|
61
|
+
In many test suites all but the first test have been marked "pending".
|
62
|
+
Once you get a test passing, activate the next one by changing `xit` to `it`.
|
60
63
|
|
61
64
|
## Source
|
62
65
|
|
@@ -103,26 +103,29 @@ When you are done, submit your solution to exercism:
|
|
103
103
|
|
104
104
|
## Setup
|
105
105
|
|
106
|
-
Go through the setup instructions for JavaScript to
|
107
|
-
|
106
|
+
Go through the setup instructions for JavaScript to install the
|
107
|
+
necessary dependencies:
|
108
108
|
|
109
109
|
http://exercism.io/languages/javascript/installation
|
110
110
|
|
111
|
-
##
|
111
|
+
## Running the test suite
|
112
112
|
|
113
|
-
|
113
|
+
The provided test suite uses [Jasmine](https://jasmine.github.io/).
|
114
|
+
You can install it by opening a terminal window and running the
|
115
|
+
following command:
|
114
116
|
|
115
|
-
|
117
|
+
```sh
|
118
|
+
npm install -g jasmine
|
119
|
+
```
|
116
120
|
|
117
|
-
|
118
|
-
test the Hello World exercise:
|
121
|
+
Run the test suite from the exercise directory with:
|
119
122
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
+
```sh
|
124
|
+
jasmine hello-world.spec.js
|
125
|
+
```
|
123
126
|
|
124
|
-
|
125
|
-
changing `xit` to `it`.
|
127
|
+
In many test suites all but the first test have been marked "pending".
|
128
|
+
Once you get a test passing, activate the next one by changing `xit` to `it`.
|
126
129
|
|
127
130
|
## Source
|
128
131
|
|
@@ -9,26 +9,29 @@ The program should handle invalid hexadecimal strings.
|
|
9
9
|
|
10
10
|
## Setup
|
11
11
|
|
12
|
-
Go through the setup instructions for JavaScript to
|
13
|
-
|
12
|
+
Go through the setup instructions for JavaScript to install the
|
13
|
+
necessary dependencies:
|
14
14
|
|
15
15
|
http://exercism.io/languages/javascript/installation
|
16
16
|
|
17
|
-
##
|
17
|
+
## Running the test suite
|
18
18
|
|
19
|
-
|
19
|
+
The provided test suite uses [Jasmine](https://jasmine.github.io/).
|
20
|
+
You can install it by opening a terminal window and running the
|
21
|
+
following command:
|
20
22
|
|
21
|
-
|
23
|
+
```sh
|
24
|
+
npm install -g jasmine
|
25
|
+
```
|
22
26
|
|
23
|
-
|
24
|
-
test the Hello World exercise:
|
27
|
+
Run the test suite from the exercise directory with:
|
25
28
|
|
26
|
-
|
29
|
+
```sh
|
30
|
+
jasmine hexadecimal.spec.js
|
31
|
+
```
|
27
32
|
|
28
|
-
In many test suites all but the first test have been
|
29
|
-
|
30
|
-
Once you get a test passing, you can unskip the next one by
|
31
|
-
changing `xit` to `it`.
|
33
|
+
In many test suites all but the first test have been marked "pending".
|
34
|
+
Once you get a test passing, activate the next one by changing `xit` to `it`.
|
32
35
|
|
33
36
|
## Source
|
34
37
|
|
@@ -1,66 +1,74 @@
|
|
1
|
-
#
|
1
|
+
# Isbn Verifier
|
2
2
|
|
3
|
-
|
3
|
+
The [ISBN-10 verification process](https://en.wikipedia.org/wiki/International_Standard_Book_Number) is used to validate book identification
|
4
|
+
numbers. These normally contain dashes and look like: `3-598-21508-8`
|
4
5
|
|
5
|
-
##
|
6
|
+
## ISBN
|
6
7
|
|
7
|
-
|
8
|
-
Putting this into place requires some thinking about preprocessing/parsing of the string prior to calculating the check digit for the ISBN.
|
8
|
+
The ISBN-10 format is 9 digits (0 to 9) plus one check character (either a digit or an X only). In the case the check character is an X, this represents the value '10'. These may be communicated with or without hyphens, and can be checked for their validity by the following formula:
|
9
9
|
|
10
|
-
|
10
|
+
```
|
11
|
+
(x1 * 10 + x2 * 9 + x3 * 8 + x4 * 7 + x5 * 6 + x6 * 5 + x7 * 4 + x8 * 3 + x9 * 2 + x10 * 1) mod 11 == 0
|
12
|
+
```
|
11
13
|
|
12
|
-
|
14
|
+
If the result is 0, then it is a valid ISBN-10, otherwise it is invalid.
|
13
15
|
|
14
|
-
|
15
|
-
The first digit block indicates the group where the ISBN belongs. Groups can consist of shared languages, geographic regions or countries. The leading '3' signals this ISBN is from a german speaking country.
|
16
|
-
The following number block is to identify the publisher. Since this is a three digit publisher number there is a 5 digit title number for this book.
|
17
|
-
The last digit in the ISBN is the check digit which is used to detect read errors.
|
16
|
+
## Example
|
18
17
|
|
19
|
-
|
20
|
-
|
18
|
+
Let's take the ISBN-10 `3-598-21508-8`. We plug it in to the formula, and get:
|
19
|
+
```
|
20
|
+
(3 * 10 + 5 * 9 + 9 * 8 + 8 * 7 + 2 * 6 + 1 * 5 + 5 * 4 + 0 * 3 + 8 * 2 + 8 * 1) mod 11 == 0
|
21
|
+
```
|
21
22
|
|
22
|
-
|
23
|
-
So for our example ISBN this means:
|
24
|
-
(3 * 10 + 5 * 9 + 9 * 8 + 8 * 7 + 2 * 6 + 1 * 5 + 5 * 4 + 0 * 3 + 8 * 2 + 8 * 1) mod 11 = 0
|
23
|
+
Since the result is 0, this proves that our ISBN is valid.
|
25
24
|
|
26
|
-
|
25
|
+
## Task
|
27
26
|
|
28
|
-
|
27
|
+
Given a string the program should check if the provided string is a valid ISBN-10.
|
28
|
+
Putting this into place requires some thinking about preprocessing/parsing of the string prior to calculating the check digit for the ISBN.
|
29
|
+
|
30
|
+
The program should be able to verify ISBN-10 both with and without separating dashes.
|
29
31
|
|
30
|
-
Go through the setup instructions for JavaScript to
|
31
|
-
install the necessary dependencies:
|
32
32
|
|
33
|
-
|
33
|
+
## Caveats
|
34
34
|
|
35
|
-
|
35
|
+
Converting from strings to numbers can be tricky in certain languages.
|
36
|
+
Now, it's even trickier since the check digit of an ISBN-10 may be 'X' (representing '10'). For instance `3-598-21507-X` is a valid ISBN-10.
|
36
37
|
|
37
|
-
|
38
|
+
## Bonus tasks
|
38
39
|
|
39
|
-
|
40
|
+
* Generate a valid ISBN-13 from the input ISBN-10 (and maybe verify it again with a derived verifier).
|
40
41
|
|
41
|
-
|
42
|
-
|
42
|
+
* Generate valid ISBN, maybe even from a given starting ISBN.
|
43
|
+
## Setup
|
43
44
|
|
44
|
-
|
45
|
+
Go through the setup instructions for JavaScript to install the
|
46
|
+
necessary dependencies:
|
45
47
|
|
46
|
-
|
48
|
+
http://exercism.io/languages/javascript/installation
|
47
49
|
|
48
|
-
|
49
|
-
changing `xit` to `it`.
|
50
|
+
## Running the test suite
|
50
51
|
|
51
|
-
|
52
|
+
The provided test suite uses [Jasmine](https://jasmine.github.io/).
|
53
|
+
You can install it by opening a terminal window and running the
|
54
|
+
following command:
|
52
55
|
|
53
|
-
|
56
|
+
```sh
|
57
|
+
npm install -g jasmine
|
58
|
+
```
|
54
59
|
|
55
|
-
|
60
|
+
Run the test suite from the exercise directory with:
|
56
61
|
|
62
|
+
```sh
|
63
|
+
jasmine isbn-verifier.spec.js
|
64
|
+
```
|
57
65
|
|
58
|
-
|
59
|
-
|
66
|
+
In many test suites all but the first test have been marked "pending".
|
67
|
+
Once you get a test passing, activate the next one by changing `xit` to `it`.
|
60
68
|
|
61
69
|
## Source
|
62
70
|
|
63
|
-
Converting a string into a number and some basic processing utilizing a relatable real world example. [https://en.wikipedia.org/wiki/International_Standard_Book_Number#ISBN-10_check_digit_calculation](https://en.wikipedia.org/wiki/International_Standard_Book_Number)
|
71
|
+
Converting a string into a number and some basic processing utilizing a relatable real world example. [https://en.wikipedia.org/wiki/International_Standard_Book_Number#ISBN-10_check_digit_calculation](https://en.wikipedia.org/wiki/International_Standard_Book_Number#ISBN-10_check_digit_calculation)
|
64
72
|
|
65
73
|
## Submitting Incomplete Solutions
|
66
74
|
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -2,38 +2,42 @@
|
|
2
2
|
|
3
3
|
Determine if a word or phrase is an isogram.
|
4
4
|
|
5
|
-
An isogram (also known as a "nonpattern word") is a word or phrase without a repeating letter.
|
5
|
+
An isogram (also known as a "nonpattern word") is a word or phrase without a repeating letter, however spaces and hyphens are allowed to appear multiple times.
|
6
6
|
|
7
7
|
Examples of isograms:
|
8
8
|
|
9
9
|
- lumberjacks
|
10
10
|
- background
|
11
11
|
- downstream
|
12
|
+
- six-year-old
|
12
13
|
|
13
14
|
The word *isograms*, however, is not an isogram, because the s repeats.
|
14
15
|
|
15
16
|
## Setup
|
16
17
|
|
17
|
-
Go through the setup instructions for JavaScript to
|
18
|
-
|
18
|
+
Go through the setup instructions for JavaScript to install the
|
19
|
+
necessary dependencies:
|
19
20
|
|
20
21
|
http://exercism.io/languages/javascript/installation
|
21
22
|
|
22
|
-
##
|
23
|
+
## Running the test suite
|
23
24
|
|
24
|
-
|
25
|
+
The provided test suite uses [Jasmine](https://jasmine.github.io/).
|
26
|
+
You can install it by opening a terminal window and running the
|
27
|
+
following command:
|
25
28
|
|
26
|
-
|
29
|
+
```sh
|
30
|
+
npm install -g jasmine
|
31
|
+
```
|
27
32
|
|
28
|
-
|
29
|
-
test the Hello World exercise:
|
33
|
+
Run the test suite from the exercise directory with:
|
30
34
|
|
31
|
-
|
35
|
+
```sh
|
36
|
+
jasmine isogram.spec.js
|
37
|
+
```
|
32
38
|
|
33
|
-
In many test suites all but the first test have been
|
34
|
-
|
35
|
-
Once you get a test passing, you can unskip the next one by
|
36
|
-
changing `xit` to `it`.
|
39
|
+
In many test suites all but the first test have been marked "pending".
|
40
|
+
Once you get a test passing, activate the next one by changing `xit` to `it`.
|
37
41
|
|
38
42
|
## Source
|
39
43
|
|