trackler 2.2.1.76 → 2.2.1.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/beer-song/canonical-data.json +33 -17
- data/problem-specifications/exercises/binary-search/canonical-data.json +41 -21
- data/problem-specifications/exercises/book-store/canonical-data.json +58 -30
- data/problem-specifications/exercises/two-fer/metadata.yml +1 -1
- data/tracks/bash/config.json +35 -13
- data/tracks/bash/exercises/acronym/README.md +27 -0
- data/tracks/bash/exercises/acronym/acronym.sh +18 -0
- data/tracks/bash/exercises/acronym/acronym_tests.sh +43 -0
- data/tracks/bash/exercises/acronym/example.sh +18 -0
- data/tracks/bash/exercises/armstrong-numbers/README.md +20 -0
- data/tracks/bash/exercises/armstrong-numbers/armstrong_numbers_test.sh +58 -0
- data/tracks/bash/exercises/armstrong-numbers/example.sh +19 -0
- data/tracks/clojure/config.json +8 -0
- data/tracks/clojure/exercises/two-fer/README.md +19 -0
- data/tracks/clojure/exercises/two-fer/project.clj +4 -0
- data/tracks/clojure/exercises/two-fer/src/example.clj +5 -0
- data/tracks/clojure/exercises/two-fer/src/two_fer.clj +5 -0
- data/tracks/clojure/exercises/two-fer/test/two_fer_test.clj +12 -0
- data/tracks/common-lisp/docs/INSTALLATION.md +26 -0
- data/tracks/go/exercises/kindergarten-garden/kindergarten_garden_test.go +1 -1
- data/tracks/go/exercises/reverse-string/reverse_string_test.go +8 -0
- data/tracks/java/config.json +34 -11
- data/tracks/java/exercises/armstrong-numbers/.meta/src/reference/java/ArmstrongNumbers.java +20 -0
- data/tracks/java/exercises/armstrong-numbers/.meta/version +1 -0
- data/tracks/java/exercises/armstrong-numbers/README.md +30 -0
- data/tracks/java/exercises/armstrong-numbers/build.gradle +18 -0
- data/tracks/java/exercises/armstrong-numbers/src/main/java/ArmstrongNumbers.java +9 -0
- data/tracks/java/exercises/armstrong-numbers/src/test/java/ArmstrongNumbersTest.java +80 -0
- data/tracks/java/exercises/proverb/.meta/src/reference/java/Proverb.java +19 -0
- data/tracks/java/exercises/proverb/README.md +29 -0
- data/tracks/java/exercises/proverb/build.gradle +18 -0
- data/tracks/java/exercises/proverb/src/main/java/Proverb.java +11 -0
- data/tracks/java/exercises/proverb/src/test/java/ProverbTest.java +80 -0
- data/tracks/java/exercises/settings.gradle +2 -0
- data/tracks/perl6/config.json +1 -1
- data/tracks/python/exercises/alphametics/example.py +168 -90
- data/tracks/swift/config.json +16 -0
- data/tracks/swift/exercises/list-ops/Package.swift +5 -0
- data/tracks/swift/exercises/list-ops/README.md +16 -0
- data/tracks/swift/exercises/list-ops/Sources/ListOps.swift +1 -0
- data/tracks/swift/exercises/list-ops/Sources/ListOpsExample.swift +81 -0
- data/tracks/swift/exercises/list-ops/Tests/LinuxMain.swift +6 -0
- data/tracks/swift/exercises/list-ops/Tests/ListOpsTests/ListOpsTests.swift +110 -0
- metadata +31 -2
@@ -0,0 +1,27 @@
|
|
1
|
+
# Acronym
|
2
|
+
|
3
|
+
Convert a phrase to its acronym.
|
4
|
+
|
5
|
+
Techies love their TLA (Three Letter Acronyms)!
|
6
|
+
|
7
|
+
Help generate some jargon by writing a program that converts a long name like Portable Network Graphics to its acronym (PNG).
|
8
|
+
|
9
|
+
Run the tests with:
|
10
|
+
|
11
|
+
bats whatever_test.sh
|
12
|
+
|
13
|
+
## Submitting Exercises
|
14
|
+
|
15
|
+
Note that, when trying to submit an exercise, make sure the solution is in the `exercism/bash/<exerciseName>` directory.
|
16
|
+
|
17
|
+
For example, if you're submitting `bob.sh` for the Bob exercise, the submit command would be something like `exercism submit <path_to_exercism_dir>/bash/bob/bob.sh`.
|
18
|
+
|
19
|
+
For more detailed information about running tests, code style and linting, please see the [help page](http://exercism.io/languages/bash).
|
20
|
+
|
21
|
+
## Source
|
22
|
+
|
23
|
+
Greg Horie [https://github.com/netserf](https://github.com/netserf)
|
24
|
+
|
25
|
+
## Submitting Incomplete Solutions
|
26
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
27
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
if [ "$#" -ne 1 ]; then
|
4
|
+
echo 'Usage: $0 "<phrase1>"' >&2
|
5
|
+
exit 1
|
6
|
+
fi
|
7
|
+
|
8
|
+
phrase=`echo $1 | tr '-' ' '`
|
9
|
+
set -f -- junk $phrase
|
10
|
+
shift
|
11
|
+
for word; do
|
12
|
+
initial="$(echo $word | head -c 1 | tr '[:lower:]' '[:upper:]')"
|
13
|
+
acronym+=$initial
|
14
|
+
#echo "[$word] [$initial] [$acronym]"
|
15
|
+
done
|
16
|
+
echo $acronym
|
17
|
+
|
18
|
+
exit 0
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#!/usr/bin/env bats
|
2
|
+
|
3
|
+
@test "basic" {
|
4
|
+
# skip
|
5
|
+
run bash acronym.sh "Portable Network Graphics"
|
6
|
+
[ "$status" -eq 0 ]
|
7
|
+
[ "$output" = "PNG" ]
|
8
|
+
}
|
9
|
+
|
10
|
+
@test "lowercase words" {
|
11
|
+
skip
|
12
|
+
run bash acronym.sh "Ruby on Rails"
|
13
|
+
[ "$status" -eq 0 ]
|
14
|
+
[ "$output" = "ROR" ]
|
15
|
+
}
|
16
|
+
|
17
|
+
@test "punctuation" {
|
18
|
+
skip
|
19
|
+
run bash acronym.sh "First In, First Out"
|
20
|
+
[ "$status" -eq 0 ]
|
21
|
+
[ "$output" = "FIFO" ]
|
22
|
+
}
|
23
|
+
|
24
|
+
@test "all caps words" {
|
25
|
+
skip
|
26
|
+
run bash acronym.sh "PHP: Hypertext Preprocessor"
|
27
|
+
[ "$status" -eq 0 ]
|
28
|
+
[ "$output" = "PHP" ]
|
29
|
+
}
|
30
|
+
|
31
|
+
@test "non-acronym all caps word" {
|
32
|
+
skip
|
33
|
+
run bash acronym.sh "GNU Image Manipulation Program"
|
34
|
+
[ "$status" -eq 0 ]
|
35
|
+
[ "$output" = "GIMP" ]
|
36
|
+
}
|
37
|
+
|
38
|
+
@test "hyphenated" {
|
39
|
+
skip
|
40
|
+
run bash acronym.sh "Complementary metal-oxide semiconductor"
|
41
|
+
[ "$status" -eq 0 ]
|
42
|
+
[ "$output" = "CMOS" ]
|
43
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
if [ "$#" -ne 1 ]; then
|
4
|
+
echo 'Usage: $0 "<phrase1>"' >&2
|
5
|
+
exit 1
|
6
|
+
fi
|
7
|
+
|
8
|
+
phrase=`echo $1 | tr '-' ' '`
|
9
|
+
set -f -- junk $phrase
|
10
|
+
shift
|
11
|
+
for word; do
|
12
|
+
initial="$(echo $word | head -c 1 | tr '[:lower:]' '[:upper:]')"
|
13
|
+
acronym+=$initial
|
14
|
+
#echo "[$word] [$initial] [$acronym]"
|
15
|
+
done
|
16
|
+
echo $acronym
|
17
|
+
|
18
|
+
exit 0
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Armstrong Numbers
|
2
|
+
|
3
|
+
An [Armstrong number](https://en.wikipedia.org/wiki/Narcissistic_number) is a number that is the sum of its own digits each raised to the power of the number of digits.
|
4
|
+
|
5
|
+
For example:
|
6
|
+
|
7
|
+
- 9 is an Armstrong number, because `9 = 9^1 = 9`
|
8
|
+
- 10 is *not* an Armstrong number, because `10 != 1^2 + 0^2 = 2`
|
9
|
+
- 153 is an Armstrong number, because: `153 = 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153`
|
10
|
+
- 154 is *not* an Armstrong number, because: `154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190`
|
11
|
+
|
12
|
+
Write some code to determine whether a number is an Armstrong number.
|
13
|
+
|
14
|
+
## Source
|
15
|
+
|
16
|
+
[Wikipedia](https://en.wikipedia.org/wiki/Narcissistic_number)
|
17
|
+
|
18
|
+
## Submitting Incomplete Solutions
|
19
|
+
|
20
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,58 @@
|
|
1
|
+
#!/usr/bin/env bats
|
2
|
+
|
3
|
+
@test 'Single digits are armstrong numbers' {
|
4
|
+
#skip
|
5
|
+
run ./armstrong_numbers.sh isarmstrong 5
|
6
|
+
|
7
|
+
[ "$status" -eq 0 ]
|
8
|
+
}
|
9
|
+
|
10
|
+
@test 'There are no two digit armstrong numbers' {
|
11
|
+
skip
|
12
|
+
run ./armstrong_numbers.sh isarmstrong 10
|
13
|
+
|
14
|
+
[ "$status" -eq 1 ]
|
15
|
+
}
|
16
|
+
|
17
|
+
@test 'A three digit number that is an armstrong number' {
|
18
|
+
skip
|
19
|
+
run ./armstrong_numbers.sh isarmstrong 153
|
20
|
+
|
21
|
+
[ "$status" -eq 0 ]
|
22
|
+
}
|
23
|
+
|
24
|
+
@test 'A three digit number that is not an armstrong number' {
|
25
|
+
skip
|
26
|
+
run ./armstrong_numbers.sh isarmstrong 100
|
27
|
+
|
28
|
+
[ "$status" -eq 1 ]
|
29
|
+
}
|
30
|
+
|
31
|
+
@test 'A four digit number that is an armstrong number' {
|
32
|
+
skip
|
33
|
+
run ./armstrong_numbers.sh isarmstrong 9475
|
34
|
+
|
35
|
+
[ "$status" -eq 0 ]
|
36
|
+
}
|
37
|
+
|
38
|
+
@test 'A four digit number that is not an armstrong number' {
|
39
|
+
skip
|
40
|
+
run ./armstrong_numbers.sh isarmstrong 9475
|
41
|
+
|
42
|
+
[ "$status" -eq 1 ]
|
43
|
+
}
|
44
|
+
|
45
|
+
@test 'A seven digit number that is an armstrong number' {
|
46
|
+
skip
|
47
|
+
run ./armstrong_numbers.sh isarmstrong 9926315
|
48
|
+
|
49
|
+
[ "$status" -eq 0 ]
|
50
|
+
}
|
51
|
+
|
52
|
+
@test 'A seven digit number that is not an armstrong number' {
|
53
|
+
skip
|
54
|
+
run ./armstrong_numbers.sh isarmstrong 9926314
|
55
|
+
|
56
|
+
[ "$status" -eq 1 ]
|
57
|
+
}
|
58
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
isarmstrong() {
|
4
|
+
sum=0
|
5
|
+
item=$1
|
6
|
+
while [ $item -ne 0 ]
|
7
|
+
do
|
8
|
+
rem=`expr $item % 10`
|
9
|
+
cube=`expr $rem \* $rem \* $rem`
|
10
|
+
sum=`expr $sum + $cube`
|
11
|
+
item=`expr $item / 10`
|
12
|
+
done
|
13
|
+
if [ $sum -eq $num ]
|
14
|
+
then
|
15
|
+
return 0
|
16
|
+
else
|
17
|
+
return 1
|
18
|
+
fi
|
19
|
+
}
|
data/tracks/clojure/config.json
CHANGED
@@ -9,6 +9,14 @@
|
|
9
9
|
"unlocked_by": null,
|
10
10
|
"uuid": "1378910d-9bec-4217-bd40-07a8967fa3ad"
|
11
11
|
},
|
12
|
+
{
|
13
|
+
"core": false,
|
14
|
+
"difficulty": 1,
|
15
|
+
"slug": "two-fer",
|
16
|
+
"topics": null,
|
17
|
+
"unlocked_by": null,
|
18
|
+
"uuid": "91a1f32c-0dac-4c65-8a13-49da90d21520"
|
19
|
+
},
|
12
20
|
{
|
13
21
|
"core": false,
|
14
22
|
"difficulty": 1,
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Two-fer
|
2
|
+
|
3
|
+
`Two-fer` or `2-fer` is short for two for one. One for you and one for me.
|
4
|
+
|
5
|
+
```text
|
6
|
+
"One for X, one for me."
|
7
|
+
```
|
8
|
+
|
9
|
+
When X is a name or "you".
|
10
|
+
|
11
|
+
If the given name is "Alice", the result should be "One for Alice, one for me."
|
12
|
+
If no name is given, the result should be "One for you, one for me."
|
13
|
+
|
14
|
+
## Source
|
15
|
+
|
16
|
+
This is an exercise to introduce users to basic programming constructs, just after hello World. [http://en.wikipedia.org/wiki/Two-fer](http://en.wikipedia.org/wiki/Two-fer)
|
17
|
+
|
18
|
+
## Submitting Incomplete Solutions
|
19
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,12 @@
|
|
1
|
+
(ns two-fer-test
|
2
|
+
(:require [clojure.test :refer [deftest is]]
|
3
|
+
two-fer))
|
4
|
+
|
5
|
+
(deftest two-fer-test
|
6
|
+
(is (= "One for you, one for me." (two-fer/two-fer))))
|
7
|
+
|
8
|
+
(deftest name-alice-test
|
9
|
+
(is (= "One for Alice, one for me." (two-fer/two-fer "Alice"))))
|
10
|
+
|
11
|
+
(deftest name-bob-test
|
12
|
+
(is (= "One for Bob, one for me." (two-fer/two-fer "Bob"))))
|
@@ -1,3 +1,29 @@
|
|
1
|
+
*What's needed*
|
2
|
+
|
3
|
+
The basic items needed for developing in Common Lisp are:
|
4
|
+
|
5
|
+
- A Lisp "Implementation", which will allow you to compile and execute code, as well as supply a REPL.
|
6
|
+
- A Text editor with facilities for Lisp code.
|
7
|
+
- (Nice to have) The often-used reference for the Common Lisp language, the "Common Lisp Hyperspec", available online [here](http://www.lispworks.com/documentation/HyperSpec/Front/Contents.htm)
|
8
|
+
|
9
|
+
*Fast Start*
|
10
|
+
|
11
|
+
Newbies to CL, particularly ones with previous experience with Emacs, can get an easy & quick start by installing Portacle, the Portable Common Lisp Environment. Free and full featured, it works in all common platforms and comes pre-configured "out of the box". This will supply:
|
12
|
+
|
13
|
+
- A Lisp implementation: SBCL, including Quicklisp and ASDF.
|
14
|
+
- A Text editor: Emacs
|
15
|
+
... with lots of add-ons for writing with Lisp code:
|
16
|
+
- SLIME, the "Superior Lisp Interaction Mode for Emacs" turns Emacs into a Common Lisp IDE
|
17
|
+
- ParEdit, which makes working with parentheses easy.
|
18
|
+
|
19
|
+
Everything comes already configured out of the box. Install Portacle by downloading from the [front page](https://portacle.github.io/)
|
20
|
+
|
21
|
+
Note: Emacs (text editor) can be disorienting at first, if you're not accustomed to it. Fortunately there are many primers on Emacs and SLIME available online.
|
22
|
+
|
23
|
+
*Traditional Start*
|
24
|
+
|
25
|
+
If you prefer installing components separately, besides installing your favorite editor for Lisp code, these would be the steps:
|
26
|
+
|
1
27
|
Install a lisp implementation such as [SBCL](http://www.sbcl.org/)
|
2
28
|
or [CLisp](http://clisp.org/). Both can be installed via Homebrew on
|
3
29
|
Mac OS X.
|
@@ -181,7 +181,7 @@ RVGCCGCV`
|
|
181
181
|
tf := func(g *Garden, n int, child string, expPlants []string) {
|
182
182
|
switch plants, ok := g.Plants(child); {
|
183
183
|
case !ok:
|
184
|
-
t.
|
184
|
+
t.Skipf("Garden %d lookup %s returned ok = false, want true.",
|
185
185
|
n, child)
|
186
186
|
case !reflect.DeepEqual(plants, expPlants):
|
187
187
|
t.Fatalf("Garden %d lookup %s = %q, want %q.",
|
data/tracks/java/config.json
CHANGED
@@ -25,25 +25,24 @@
|
|
25
25
|
},
|
26
26
|
{
|
27
27
|
"core": false,
|
28
|
-
"difficulty":
|
29
|
-
"slug": "
|
28
|
+
"difficulty": 1,
|
29
|
+
"slug": "reverse-string",
|
30
30
|
"topics": [
|
31
|
-
"concurrency",
|
32
|
-
"maps",
|
33
31
|
"strings"
|
34
32
|
],
|
35
|
-
"unlocked_by": "
|
36
|
-
"uuid": "
|
33
|
+
"unlocked_by": "two-fer",
|
34
|
+
"uuid": "2c8afeed-480e-41f3-ad58-590fa8f88029"
|
37
35
|
},
|
38
36
|
{
|
39
37
|
"core": false,
|
40
|
-
"difficulty":
|
41
|
-
"slug": "
|
38
|
+
"difficulty": 2,
|
39
|
+
"slug": "armstrong-numbers",
|
42
40
|
"topics": [
|
43
|
-
"
|
41
|
+
"integers",
|
42
|
+
"mathematics"
|
44
43
|
],
|
45
|
-
"unlocked_by":
|
46
|
-
"uuid": "
|
44
|
+
"unlocked_by": null,
|
45
|
+
"uuid": "8e1dd48c-e05e-4a72-bf0f-5aed8dd123f5"
|
47
46
|
},
|
48
47
|
{
|
49
48
|
"core": false,
|
@@ -201,6 +200,18 @@
|
|
201
200
|
"unlocked_by": "rna-transcription",
|
202
201
|
"uuid": "331073b3-bd1a-4868-b767-a64ce9fd9d97"
|
203
202
|
},
|
203
|
+
{
|
204
|
+
"core": false,
|
205
|
+
"difficulty": 4,
|
206
|
+
"slug": "proverb",
|
207
|
+
"topics": [
|
208
|
+
"arrays",
|
209
|
+
"loops",
|
210
|
+
"strings"
|
211
|
+
],
|
212
|
+
"unlocked_by": "two-fer",
|
213
|
+
"uuid": "9906491b-a638-408d-86a4-4ad320a92658"
|
214
|
+
},
|
204
215
|
{
|
205
216
|
"core": false,
|
206
217
|
"difficulty": 4,
|
@@ -851,6 +862,18 @@
|
|
851
862
|
"unlocked_by": "matrix",
|
852
863
|
"uuid": "486d342e-c834-40fc-b691-a4dab3f790da"
|
853
864
|
},
|
865
|
+
{
|
866
|
+
"core": false,
|
867
|
+
"difficulty": 6,
|
868
|
+
"slug": "parallel-letter-frequency",
|
869
|
+
"topics": [
|
870
|
+
"concurrency",
|
871
|
+
"maps",
|
872
|
+
"strings"
|
873
|
+
],
|
874
|
+
"unlocked_by": "bank-account",
|
875
|
+
"uuid": "38a405e8-619d-400f-b53c-2f06461fdf9d"
|
876
|
+
},
|
854
877
|
{
|
855
878
|
"core": false,
|
856
879
|
"difficulty": 7,
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import static java.lang.Math.pow;
|
2
|
+
|
3
|
+
class ArmstrongNumbers {
|
4
|
+
|
5
|
+
boolean isArmstrongNumber(int numberToCheck) {
|
6
|
+
|
7
|
+
int number = numberToCheck;
|
8
|
+
int calculation = 0;
|
9
|
+
int length = String.valueOf(number).length();
|
10
|
+
|
11
|
+
while (number > 0) {
|
12
|
+
calculation += pow((number % 10), length);
|
13
|
+
number = number / 10;
|
14
|
+
}
|
15
|
+
|
16
|
+
return numberToCheck == calculation;
|
17
|
+
|
18
|
+
}
|
19
|
+
|
20
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Armstrong Numbers
|
2
|
+
|
3
|
+
An [Armstrong number](https://en.wikipedia.org/wiki/Narcissistic_number) is a number that is the sum of its own digits each raised to the power of the number of digits.
|
4
|
+
|
5
|
+
For example:
|
6
|
+
|
7
|
+
- 9 is an Armstrong number, because `9 = 9^1 = 9`
|
8
|
+
- 10 is *not* an Armstrong number, because `10 != 1^2 + 0^2 = 2`
|
9
|
+
- 153 is an Armstrong number, because: `153 = 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153`
|
10
|
+
- 154 is *not* an Armstrong number, because: `154 != 1^3 + 5^3 + 4^3 = 1 + 125 + 64 = 190`
|
11
|
+
|
12
|
+
Write some code to determine whether a number is an Armstrong number.
|
13
|
+
|
14
|
+
# Running the tests
|
15
|
+
|
16
|
+
You can run all the tests for an exercise by entering
|
17
|
+
|
18
|
+
```sh
|
19
|
+
$ gradle test
|
20
|
+
```
|
21
|
+
|
22
|
+
in your terminal.
|
23
|
+
|
24
|
+
## Source
|
25
|
+
|
26
|
+
Wikipedia [https://en.wikipedia.org/wiki/Narcissistic_number](https://en.wikipedia.org/wiki/Narcissistic_number)
|
27
|
+
|
28
|
+
## Submitting Incomplete Solutions
|
29
|
+
|
30
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|