trackler 2.0.0.2 → 2.0.0.3
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/common/exercises/forth/canonical-data.json +1 -1
- data/common/exercises/pangram/canonical-data.json +0 -10
- data/common/exercises/run-length-encoding/canonical-data.json +21 -11
- data/lib/trackler/version.rb +1 -1
- data/tracks/bash/SETUP.md +2 -39
- data/tracks/bash/config.json +0 -9
- data/tracks/bash/exercises/hello-world/HINTS.md +38 -0
- data/tracks/bash/exercises/hello-world/hello_world_test.sh +0 -14
- data/tracks/haskell/.travis.yml +2 -13
- data/tracks/haskell/README.md +2 -1
- data/tracks/haskell/config.json +6 -0
- data/tracks/haskell/exercises/accumulate/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/accumulate/{src/Example.hs → examples/success-standard/src/Accumulate.hs} +0 -0
- data/tracks/haskell/exercises/all-your-base/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/all-your-base/{src/Example.hs → examples/success-standard/src/Base.hs} +0 -0
- data/tracks/haskell/exercises/allergies/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/allergies/{src/Example.hs → examples/success-standard/src/Allergies.hs} +0 -0
- data/tracks/haskell/exercises/alphametics/HINTS.md +5 -0
- data/tracks/haskell/exercises/alphametics/examples/success-standard/package.yaml +18 -0
- data/tracks/haskell/exercises/alphametics/examples/success-standard/src/Alphametics.hs +116 -0
- data/tracks/haskell/exercises/alphametics/package.yaml +20 -0
- data/tracks/haskell/exercises/alphametics/src/Alphametics.hs +4 -0
- data/tracks/haskell/exercises/alphametics/stack.yaml +1 -0
- data/tracks/haskell/exercises/alphametics/test/Tests.hs +78 -0
- data/tracks/haskell/exercises/anagram/examples/{list-string → success-liststring}/package.yaml +0 -1
- data/tracks/haskell/exercises/anagram/examples/{list-string → success-liststring/src}/Anagram.hs +0 -0
- data/tracks/haskell/exercises/anagram/examples/{set-text → success-settext}/package.yaml +0 -0
- data/tracks/haskell/exercises/anagram/examples/{set-text → success-settext/src}/Anagram.hs +0 -0
- data/tracks/haskell/exercises/atbash-cipher/examples/success-standard/package.yaml +18 -0
- data/tracks/haskell/exercises/atbash-cipher/{src/Example.hs → examples/success-standard/src/Atbash.hs} +0 -0
- data/tracks/haskell/exercises/bank-account/examples/success-standard/package.yaml +18 -0
- data/tracks/haskell/exercises/bank-account/{src/Example.hs → examples/success-standard/src/BankAccount.hs} +0 -0
- data/tracks/haskell/exercises/beer-song/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/beer-song/{src/Example.hs → examples/success-standard/src/Beer.hs} +0 -0
- data/tracks/haskell/exercises/binary-search-tree/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/binary-search-tree/{src/Example.hs → examples/success-standard/src/BST.hs} +0 -0
- data/tracks/haskell/exercises/binary/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/binary/{src/Example.hs → examples/success-standard/src/Binary.hs} +0 -0
- data/tracks/haskell/exercises/bob/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/bob/{src/Example.hs → examples/success-standard/src/Bob.hs} +0 -0
- data/tracks/haskell/exercises/change/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/change/{src/Example.hs → examples/success-standard/src/Change.hs} +0 -0
- data/tracks/haskell/exercises/clock/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/clock/{src/Example.hs → examples/success-standard/src/Clock.hs} +0 -0
- data/tracks/haskell/exercises/connect/examples/success-standard/package.yaml +18 -0
- data/tracks/haskell/exercises/connect/{src/Example.hs → examples/success-standard/src/Connect.hs} +0 -0
- data/tracks/haskell/exercises/crypto-square/examples/success-standard/package.yaml +18 -0
- data/tracks/haskell/exercises/crypto-square/{src/Example.hs → examples/success-standard/src/CryptoSquare.hs} +0 -0
- data/tracks/haskell/exercises/custom-set/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/custom-set/{src/Example.hs → examples/success-standard/src/CustomSet.hs} +0 -0
- data/tracks/haskell/exercises/difference-of-squares/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/difference-of-squares/{src/Example.hs → examples/success-standard/src/Squares.hs} +0 -0
- data/tracks/haskell/exercises/etl/examples/success-standard/package.yaml +17 -0
- data/tracks/haskell/exercises/etl/{src/Example.hs → examples/success-standard/src/ETL.hs} +0 -0
- data/tracks/haskell/exercises/food-chain/examples/success-standard/package.yaml +18 -0
- data/tracks/haskell/exercises/food-chain/{src/Example.hs → examples/success-standard/src/FoodChain.hs} +0 -0
- data/tracks/haskell/exercises/forth/HINTS.md +2 -2
- data/tracks/haskell/exercises/forth/examples/success-standard/package.yaml +19 -0
- data/tracks/haskell/exercises/forth/{src/Example.hs → examples/success-standard/src/Forth.hs} +3 -3
- data/tracks/haskell/exercises/forth/package.yaml +0 -1
- data/tracks/haskell/exercises/forth/src/Forth.hs +3 -3
- data/tracks/haskell/exercises/forth/test/Tests.hs +120 -65
- data/tracks/haskell/exercises/gigasecond/examples/success-standard/package.yaml +17 -0
- data/tracks/haskell/exercises/gigasecond/{src/Example.hs → examples/success-standard/src/Gigasecond.hs} +0 -0
- data/tracks/haskell/exercises/go-counting/examples/success-standard/package.yaml +20 -0
- data/tracks/haskell/exercises/go-counting/{src/Example.hs → examples/success-standard/src/Counting.hs} +0 -0
- data/tracks/haskell/exercises/grade-school/examples/success-standard/package.yaml +18 -0
- data/tracks/haskell/exercises/grade-school/{src/Example.hs → examples/success-standard/src/School.hs} +0 -0
- data/tracks/haskell/exercises/grains/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/grains/{src/Example.hs → examples/success-standard/src/Grains.hs} +0 -0
- data/tracks/haskell/exercises/grains/test/Tests.hs +1 -2
- data/tracks/haskell/exercises/hamming/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/hamming/{src/Example.hs → examples/success-standard/src/Hamming.hs} +0 -0
- data/tracks/haskell/exercises/hexadecimal/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/hexadecimal/{src/Example.hs → examples/success-standard/src/Hexadecimal.hs} +0 -0
- data/tracks/haskell/exercises/house/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/house/{src/Example.hs → examples/success-standard/src/House.hs} +0 -0
- data/tracks/haskell/exercises/kindergarten-garden/examples/success-standard/package.yaml +19 -0
- data/tracks/haskell/exercises/kindergarten-garden/{src/Example.hs → examples/success-standard/src/Garden.hs} +0 -0
- data/tracks/haskell/exercises/largest-series-product/examples/success-standard/package.yaml +18 -0
- data/tracks/haskell/exercises/largest-series-product/{src/Example.hs → examples/success-standard/src/Series.hs} +0 -0
- data/tracks/haskell/exercises/leap/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/leap/{src/Example.hs → examples/success-standard/src/LeapYear.hs} +0 -0
- data/tracks/haskell/exercises/lens-person/examples/success-standard/package.yaml +19 -0
- data/tracks/haskell/exercises/lens-person/{src/Example.hs → examples/success-standard/src/Person.hs} +0 -0
- data/tracks/haskell/exercises/linked-list/examples/success-standard/package.yaml +18 -0
- data/tracks/haskell/exercises/linked-list/{src/Example.hs → examples/success-standard/src/Deque.hs} +0 -0
- data/tracks/haskell/exercises/list-ops/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/list-ops/{src/Example.hs → examples/success-standard/src/ListOps.hs} +0 -0
- data/tracks/haskell/exercises/luhn/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/luhn/{src/Example.hs → examples/success-standard/src/Luhn.hs} +0 -0
- data/tracks/haskell/exercises/matrix/examples/success-standard/package.yaml +17 -0
- data/tracks/haskell/exercises/matrix/{src/Example.hs → examples/success-standard/src/Matrix.hs} +0 -0
- data/tracks/haskell/exercises/meetup/examples/success-standard/package.yaml +17 -0
- data/tracks/haskell/exercises/meetup/{src/Example.hs → examples/success-standard/src/Meetup.hs} +0 -0
- data/tracks/haskell/exercises/minesweeper/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/minesweeper/{src/Example.hs → examples/success-standard/src/Minesweeper.hs} +0 -0
- data/tracks/haskell/exercises/nth-prime/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/nth-prime/{src/Example.hs → examples/success-standard/src/Prime.hs} +0 -0
- data/tracks/haskell/exercises/nucleotide-count/examples/success-standard/package.yaml +17 -0
- data/tracks/haskell/exercises/nucleotide-count/{src/Example.hs → examples/success-standard/src/DNA.hs} +0 -0
- data/tracks/haskell/exercises/ocr-numbers/examples/success-standard/package.yaml +19 -0
- data/tracks/haskell/exercises/ocr-numbers/{src/Example.hs → examples/success-standard/src/OCR.hs} +0 -0
- data/tracks/haskell/exercises/octal/examples/success-standard/package.yaml +17 -0
- data/tracks/haskell/exercises/octal/{src/Example.hs → examples/success-standard/src/Octal.hs} +0 -0
- data/tracks/haskell/exercises/palindrome-products/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/palindrome-products/{src/Example.hs → examples/success-standard/src/Palindromes.hs} +0 -0
- data/tracks/haskell/exercises/parallel-letter-frequency/examples/success-standard/package.yaml +20 -0
- data/tracks/haskell/exercises/parallel-letter-frequency/{src/Example.hs → examples/success-standard/src/Frequency.hs} +0 -0
- data/tracks/haskell/exercises/pascals-triangle/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/pascals-triangle/{src/Example.hs → examples/success-standard/src/Triangle.hs} +0 -0
- data/tracks/haskell/exercises/phone-number/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/phone-number/{src/Example.hs → examples/success-standard/src/Phone.hs} +0 -0
- data/tracks/haskell/exercises/pig-latin/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/pig-latin/{src/Example.hs → examples/success-standard/src/PigLatin.hs} +0 -0
- data/tracks/haskell/exercises/pig-latin/test/Tests.hs +2 -1
- data/tracks/haskell/exercises/pov/examples/success-standard/package.yaml +17 -0
- data/tracks/haskell/exercises/pov/{src/Example.hs → examples/success-standard/src/POV.hs} +0 -0
- data/tracks/haskell/exercises/pov/test/Tests.hs +34 -8
- data/tracks/haskell/exercises/prime-factors/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/prime-factors/{src/Example.hs → examples/success-standard/src/PrimeFactors.hs} +0 -0
- data/tracks/haskell/exercises/pythagorean-triplet/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/pythagorean-triplet/{src/Example.hs → examples/success-standard/src/Triplet.hs} +0 -0
- data/tracks/haskell/exercises/queen-attack/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/queen-attack/{src/Example.hs → examples/success-standard/src/Queens.hs} +0 -0
- data/tracks/haskell/exercises/raindrops/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/raindrops/{src/Example.hs → examples/success-standard/src/Raindrops.hs} +0 -0
- data/tracks/haskell/exercises/rna-transcription/examples/success-standard/package.yaml +18 -0
- data/tracks/haskell/exercises/rna-transcription/{src/Example.hs → examples/success-standard/src/DNA.hs} +0 -0
- data/tracks/haskell/exercises/robot-name/examples/success-standard/package.yaml +18 -0
- data/tracks/haskell/exercises/robot-name/{src/Example.hs → examples/success-standard/src/Robot.hs} +0 -0
- data/tracks/haskell/exercises/robot-simulator/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/robot-simulator/{src/Example.hs → examples/success-standard/src/Robot.hs} +0 -0
- data/tracks/haskell/exercises/roman-numerals/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/roman-numerals/{src/Example.hs → examples/success-standard/src/Roman.hs} +0 -0
- data/tracks/haskell/exercises/saddle-points/examples/success-standard/package.yaml +19 -0
- data/tracks/haskell/exercises/saddle-points/{src/Example.hs → examples/success-standard/src/Matrix.hs} +0 -0
- data/tracks/haskell/exercises/say/examples/success-standard/package.yaml +18 -0
- data/tracks/haskell/exercises/say/{src/Example.hs → examples/success-standard/src/Say.hs} +0 -0
- data/tracks/haskell/exercises/say/test/Tests.hs +4 -2
- data/tracks/haskell/exercises/scrabble-score/examples/success-standard/package.yaml +18 -0
- data/tracks/haskell/exercises/scrabble-score/{src/Example.hs → examples/success-standard/src/Scrabble.hs} +0 -0
- data/tracks/haskell/exercises/secret-handshake/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/secret-handshake/{src/Example.hs → examples/success-standard/src/SecretHandshake.hs} +0 -0
- data/tracks/haskell/exercises/series/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/series/{src/Example.hs → examples/success-standard/src/Series.hs} +0 -0
- data/tracks/haskell/exercises/sgf-parsing/examples/success-standard/package.yaml +20 -0
- data/tracks/haskell/exercises/sgf-parsing/{src/Example.hs → examples/success-standard/src/Sgf.hs} +0 -0
- data/tracks/haskell/exercises/sieve/examples/success-standard/package.yaml +18 -0
- data/tracks/haskell/exercises/sieve/{src/Example.hs → examples/success-standard/src/Sieve.hs} +0 -0
- data/tracks/haskell/exercises/simple-cipher/examples/success-standard/package.yaml +18 -0
- data/tracks/haskell/exercises/simple-cipher/{src/Example.hs → examples/success-standard/src/Cipher.hs} +0 -0
- data/tracks/haskell/exercises/simple-linked-list/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/simple-linked-list/{src/Example.hs → examples/success-standard/src/LinkedList.hs} +0 -0
- data/tracks/haskell/exercises/space-age/examples/success-double/package.yaml +0 -3
- data/tracks/haskell/exercises/space-age/examples/success-double/{SpaceAge.hs → src/SpaceAge.hs} +0 -0
- data/tracks/haskell/exercises/space-age/examples/success-rational/package.yaml +0 -3
- data/tracks/haskell/exercises/space-age/examples/success-rational/{SpaceAge.hs → src/SpaceAge.hs} +0 -0
- data/tracks/haskell/exercises/strain/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/strain/{src/Example.hs → examples/success-standard/src/Strain.hs} +0 -0
- data/tracks/haskell/exercises/sublist/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/sublist/{src/Example.hs → examples/success-standard/src/Sublist.hs} +0 -0
- data/tracks/haskell/exercises/sum-of-multiples/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/sum-of-multiples/{src/Example.hs → examples/success-standard/src/SumOfMultiples.hs} +0 -0
- data/tracks/haskell/exercises/triangle/examples/success-standard/package.yaml +18 -0
- data/tracks/haskell/exercises/triangle/{src/Example.hs → examples/success-standard/src/Triangle.hs} +0 -0
- data/tracks/haskell/exercises/trinary/examples/success-standard/package.yaml +17 -0
- data/tracks/haskell/exercises/trinary/{src/Example.hs → examples/success-standard/src/Trinary.hs} +0 -0
- data/tracks/haskell/exercises/word-count/examples/success-newtype/package.yaml +0 -2
- data/tracks/haskell/exercises/word-count/examples/success-newtype/{WordCount.hs → src/WordCount.hs} +0 -0
- data/tracks/haskell/exercises/word-count/examples/success-simple/package.yaml +0 -2
- data/tracks/haskell/exercises/word-count/examples/success-simple/{WordCount.hs → src/WordCount.hs} +0 -0
- data/tracks/haskell/exercises/wordy/examples/success-standard/package.yaml +19 -0
- data/tracks/haskell/exercises/wordy/{src/Example.hs → examples/success-standard/src/WordProblem.hs} +0 -0
- data/tracks/haskell/exercises/zebra-puzzle/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/zebra-puzzle/{src/Example.hs → examples/success-standard/src/ZebraPuzzle.hs} +0 -0
- data/tracks/haskell/exercises/zipper/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/zipper/{src/Example.hs → examples/success-standard/src/Zipper.hs} +0 -0
- data/tracks/java/config.json +7 -1
- data/tracks/java/exercises/difference-of-squares/build.gradle +17 -0
- data/tracks/java/exercises/difference-of-squares/src/example/java/.keep +0 -0
- data/tracks/java/exercises/difference-of-squares/src/example/java/Difference.java +20 -0
- data/tracks/java/exercises/difference-of-squares/src/main/java/.keep +0 -0
- data/tracks/java/exercises/difference-of-squares/src/main/java/Difference.java +5 -0
- data/tracks/java/exercises/difference-of-squares/src/test/java/DifferenceTest.java +87 -0
- data/tracks/java/exercises/settings.gradle +1 -0
- data/tracks/kotlin/docs/TESTS.md +97 -13
- data/tracks/ruby/exercises/alphametics/.version +1 -1
- data/tracks/ruby/exercises/alphametics/alphametics_test.rb +55 -45
- data/tracks/ruby/exercises/alphametics/example.rb +100 -63
- data/tracks/ruby/exercises/alphametics/example.tt +7 -6
- data/tracks/ruby/lib/alphametics_cases.rb +49 -13
- data/tracks/ruby/lib/generator.rb +2 -1
- data/tracks/rust/docs/LEARNING.md +1 -0
- data/tracks/rust/exercises/acronym/tests/acronym.rs +6 -0
- metadata +164 -80
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 13d90971009884bd820bdbe76a985c6a084b4a71
|
|
4
|
+
data.tar.gz: 45d64cda7e36d7934c5fe4827525ff6aa0555eb6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fb8974eb51e067fd796d4cc65ed3fe25df92f865ef5db6b24517036b3121ea31b73c5f62d4b49774c6dcf06b1d6fecbcad776dbb7a68f5d3ac98b4ef83f6fd6c
|
|
7
|
+
data.tar.gz: fd4f843c2e21324070fab9e4925c40a85901e760d2a557b9e6088758304204328cc3a834fd1c705a72e8c9f76f197fe4f0e35cb87b35727eeb581d0007ecdbce
|
|
@@ -39,16 +39,6 @@
|
|
|
39
39
|
"description": "pangram with mixed case and punctuation",
|
|
40
40
|
"input": "\"Five quacking Zephyrs jolt my wax bed.\"",
|
|
41
41
|
"expected": true
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"description": "pangram with non ascii characters",
|
|
45
|
-
"input": "Victor jagt zwölf Boxkämpfer quer über den großen Sylter Deich.",
|
|
46
|
-
"expected": true
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
"description": "Panagram in alphabet other than ASCII",
|
|
50
|
-
"input": "Широкая электрификация южных губерний даст мощный толчок подъёму сельского хозяйства.",
|
|
51
|
-
"expected": false
|
|
52
42
|
}
|
|
53
43
|
]
|
|
54
44
|
}
|
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"#": [
|
|
3
|
-
|
|
3
|
+
"The tests deliberately check that single characters are encoded without count."
|
|
4
4
|
],
|
|
5
5
|
"cases": [
|
|
6
|
+
{
|
|
7
|
+
"description": "encode empty string",
|
|
8
|
+
"input": "",
|
|
9
|
+
"expected": ""
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"description": "encode single characters only",
|
|
13
|
+
"input": "XYZ",
|
|
14
|
+
"expected": "XYZ"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"description": "decode empty string",
|
|
18
|
+
"input": "",
|
|
19
|
+
"expected": ""
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"description": "decode single characters only",
|
|
23
|
+
"input": "XYZ",
|
|
24
|
+
"expected": "XYZ"
|
|
25
|
+
},
|
|
6
26
|
{
|
|
7
27
|
"description": "encode simple",
|
|
8
28
|
"input": "AABBBCCCC",
|
|
@@ -27,16 +47,6 @@
|
|
|
27
47
|
"description": "decode(encode(...)) combination",
|
|
28
48
|
"input": "zzz ZZ zZ",
|
|
29
49
|
"expected": "zzz ZZ zZ"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"description": "encode unicode",
|
|
33
|
-
"input": "⏰⚽⚽⚽⭐⭐⏰",
|
|
34
|
-
"expected": "⏰3⚽2⭐⏰"
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
"description": "decode unicode",
|
|
38
|
-
"input": "⏰3⚽2⭐⏰",
|
|
39
|
-
"expected": "⏰⚽⚽⚽⭐⭐⏰"
|
|
40
50
|
}
|
|
41
51
|
]
|
|
42
52
|
}
|
data/lib/trackler/version.rb
CHANGED
data/tracks/bash/SETUP.md
CHANGED
|
@@ -1,40 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
Run the tests with:
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
If you are on a Mac or other unix-y platform, you almost definitely
|
|
5
|
-
already have bash. In fact, anything you type into the terminal is
|
|
6
|
-
likely going through bash.
|
|
7
|
-
|
|
8
|
-
The downside to this is that there isn't much of a development
|
|
9
|
-
ecosystem around bash like there is for other languages, and there are
|
|
10
|
-
multiple verions of bash that can be frustratingly incompatible. Luckily
|
|
11
|
-
we shouldn't hit those differences for these basic examples, and if you
|
|
12
|
-
can get the tests to pass on your machine, we are doing great.
|
|
13
|
-
|
|
14
|
-
## Installation
|
|
15
|
-
|
|
16
|
-
As I said above, if you are on a unix-like OS (Mac OS X, Linux, Solaris,
|
|
17
|
-
etc), you probably already have bash.
|
|
18
|
-
|
|
19
|
-
## Testing
|
|
20
|
-
|
|
21
|
-
As there isn't much of a bash ecosystem, there also isn't really a de
|
|
22
|
-
facto leader in the bash testing area. For these examples we are using
|
|
23
|
-
[bats](https://github.com/sstephenson/bats). You should be able to
|
|
24
|
-
install it from your favorite package manager, on OS X with homebrew
|
|
25
|
-
this would look something like this:
|
|
26
|
-
|
|
27
|
-
```
|
|
28
|
-
$ brew install bats
|
|
29
|
-
==> Downloading
|
|
30
|
-
https://github.com/sstephenson/bats/archive/v0.4.0.tar.gz
|
|
31
|
-
==> Downloading from
|
|
32
|
-
https://codeload.github.com/sstephenson/bats/tar.gz/v0.4.0
|
|
33
|
-
########################################################################
|
|
34
|
-
100.0%
|
|
35
|
-
==> ./install.sh /opt/boxen/homebrew/Cellar/bats/0.4.0
|
|
36
|
-
🍺 /opt/boxen/homebrew/Cellar/bats/0.4.0: 10 files, 60K, built in 2
|
|
37
|
-
seconds
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Run the tests with `bats whatever_test.sh`.
|
|
3
|
+
bats whatever_test.sh
|
data/tracks/bash/config.json
CHANGED
|
@@ -4,15 +4,6 @@
|
|
|
4
4
|
"repository": "https://github.com/exercism/xbash",
|
|
5
5
|
"checklist_issue": 4,
|
|
6
6
|
"active": false,
|
|
7
|
-
"problems": [
|
|
8
|
-
"hello-world",
|
|
9
|
-
"gigasecond",
|
|
10
|
-
"leap",
|
|
11
|
-
"hamming",
|
|
12
|
-
"rna-transcription",
|
|
13
|
-
"raindrops",
|
|
14
|
-
"bob"
|
|
15
|
-
],
|
|
16
7
|
"exercises": [
|
|
17
8
|
{
|
|
18
9
|
"slug": "hello-world" ,
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Welcome to Bash!
|
|
2
|
+
|
|
3
|
+
Unlike many other languages here, bash is a bit of a special snowflake.
|
|
4
|
+
If you are on a Mac or other unix-y platform, you almost definitely
|
|
5
|
+
already have bash. In fact, anything you type into the terminal is
|
|
6
|
+
likely going through bash.
|
|
7
|
+
|
|
8
|
+
The downside to this is that there isn't much of a development
|
|
9
|
+
ecosystem around bash like there is for other languages, and there are
|
|
10
|
+
multiple verions of bash that can be frustratingly incompatible. Luckily
|
|
11
|
+
we shouldn't hit those differences for these basic examples, and if you
|
|
12
|
+
can get the tests to pass on your machine, we are doing great.
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
As I said above, if you are on a unix-like OS (Mac OS X, Linux, Solaris,
|
|
17
|
+
etc), you probably already have bash.
|
|
18
|
+
|
|
19
|
+
## Testing
|
|
20
|
+
|
|
21
|
+
As there isn't much of a bash ecosystem, there also isn't really a de
|
|
22
|
+
facto leader in the bash testing area. For these examples we are using
|
|
23
|
+
[bats](https://github.com/sstephenson/bats). You should be able to
|
|
24
|
+
install it from your favorite package manager, on OS X with homebrew
|
|
25
|
+
this would look something like this:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
$ brew install bats
|
|
29
|
+
==> Downloading
|
|
30
|
+
https://github.com/sstephenson/bats/archive/v0.4.0.tar.gz
|
|
31
|
+
==> Downloading from
|
|
32
|
+
https://codeload.github.com/sstephenson/bats/tar.gz/v0.4.0
|
|
33
|
+
########################################################################
|
|
34
|
+
100.0%
|
|
35
|
+
==> ./install.sh /opt/boxen/homebrew/Cellar/bats/0.4.0
|
|
36
|
+
🍺 /opt/boxen/homebrew/Cellar/bats/0.4.0: 10 files, 60K, built in 2
|
|
37
|
+
seconds
|
|
38
|
+
```
|
|
@@ -18,17 +18,3 @@
|
|
|
18
18
|
[ "$status" -eq 0 ]
|
|
19
19
|
[ "$output" = "Hello, Bob!" ]
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
@test 'When given an empty string it should have a space and punctuation, though admittedly this is strange.' {
|
|
23
|
-
run bash hello_world.sh ""
|
|
24
|
-
|
|
25
|
-
[ "$status" -eq 0 ]
|
|
26
|
-
[ "$output" = "Hello, !" ]
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
@test 'When given "Alice and Bob" it greets them both' {
|
|
30
|
-
run bash hello_world.sh Alice and Bob
|
|
31
|
-
|
|
32
|
-
[ "$status" -eq 0 ]
|
|
33
|
-
[ "$output" = "Hello, Alice and Bob!" ]
|
|
34
|
-
}
|
data/tracks/haskell/.travis.yml
CHANGED
|
@@ -52,18 +52,7 @@ script:
|
|
|
52
52
|
for exercise in ${TRAVIS_BUILD_DIR}/exercises/* ; do
|
|
53
53
|
pushd ${exercise}
|
|
54
54
|
|
|
55
|
-
if
|
|
56
|
-
# `stack --work-dir` fails if not targeting a subdirectory, so we just
|
|
57
|
-
# symbolic-link `.stack-work` to a subfolder in the cache directory.
|
|
58
|
-
mkdir -p "${HOME}/.foldercache/${exercise}/.stack-work"
|
|
59
|
-
ln -f -s "${HOME}/.foldercache/${exercise}/.stack-work"
|
|
60
|
-
|
|
61
|
-
# Here we prepare the exercise to be tested by Stack.
|
|
62
|
-
MODULE=`sed -n 's/ *module \+\([a-zA-Z0-9]\+\).*/\1/p' src/Example.hs`
|
|
63
|
-
mv src/Example.hs "src/${MODULE}.hs"
|
|
64
|
-
|
|
65
|
-
test_exercise
|
|
66
|
-
elif ! stat -t examples/*/ > /dev/null 2>&1; then
|
|
55
|
+
if ! stat -t examples/*/ > /dev/null 2>&1; then
|
|
67
56
|
echo "No examples for ${exercise}!"
|
|
68
57
|
exit 1
|
|
69
58
|
else
|
|
@@ -74,7 +63,7 @@ script:
|
|
|
74
63
|
|
|
75
64
|
echo "testing ${example}"
|
|
76
65
|
rm -f src/*.hs
|
|
77
|
-
mv ${example}/*.hs src
|
|
66
|
+
mv ${example}/src/*.hs src
|
|
78
67
|
mv ${example}/package.yaml .
|
|
79
68
|
|
|
80
69
|
test_exercise
|
data/tracks/haskell/README.md
CHANGED
|
@@ -22,8 +22,9 @@ All exercises have the following structure:
|
|
|
22
22
|
resolver for all the exercises.
|
|
23
23
|
- `package.yaml` is a file in the [hpack](https://github.com/sol/hpack#readme)
|
|
24
24
|
format that has all dependencies and build instructions for an exercise.
|
|
25
|
-
- `src/Example.hs` is a sample solution passing the tests.
|
|
26
25
|
- `src/ModuleName.hs` is a *stub solution*.
|
|
26
|
+
- `src/examples/success-foo/package.yaml` has dependencies for the example solution named `foo`.
|
|
27
|
+
- `src/examples/success-foo/src/ModuleName.hs` is the source code of the sample solution.
|
|
27
28
|
- `test/Tests.hs` is the test suite.
|
|
28
29
|
- `HINTS.md` is an optional file containing instructions and/or hints.
|
|
29
30
|
|
data/tracks/haskell/config.json
CHANGED
|
File without changes
|
data/tracks/haskell/exercises/all-your-base/{src/Example.hs → examples/success-standard/src/Base.hs}
RENAMED
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
{-# LANGUAGE GADTs #-}
|
|
2
|
+
module Alphametics (solve) where
|
|
3
|
+
|
|
4
|
+
import Control.Monad (guard)
|
|
5
|
+
import Data.List (foldl', find, union)
|
|
6
|
+
import Data.Maybe (fromJust, isJust, listToMaybe)
|
|
7
|
+
import Prelude hiding (Word)
|
|
8
|
+
import Text.Parsec
|
|
9
|
+
import Text.Parsec.String
|
|
10
|
+
|
|
11
|
+
type Solution = [(Char, Int)]
|
|
12
|
+
|
|
13
|
+
solve :: String -> Maybe Solution
|
|
14
|
+
solve puzzle = do
|
|
15
|
+
boolTerm' <- parseTerm puzzle
|
|
16
|
+
let columns = [0..maxLength boolTerm' - 1]
|
|
17
|
+
emptySolutions = [([], (0, 0))]
|
|
18
|
+
solutions = foldl' (flip $ partialSolutions boolTerm') emptySolutions columns
|
|
19
|
+
fst <$> listToMaybe solutions
|
|
20
|
+
|
|
21
|
+
parseTerm :: String -> Maybe (Term Bool)
|
|
22
|
+
parseTerm str = either (const Nothing) Just parseResult
|
|
23
|
+
where parseResult = parse boolTerm "boolTerm" str
|
|
24
|
+
|
|
25
|
+
type PartialResult = (Integer, Integer) -- (result, carry)
|
|
26
|
+
type PartialSolution = (Solution, PartialResult)
|
|
27
|
+
|
|
28
|
+
partialSolutions :: Term a -> Int -> [PartialSolution] -> [PartialSolution]
|
|
29
|
+
partialSolutions (Word xs) col solutionsSoFar
|
|
30
|
+
| col >= length xs = solutionsSoFar -- pass, no more constraints from this word
|
|
31
|
+
| otherwise = mergePartialSolutions takeChar charSolutions solutionsSoFar
|
|
32
|
+
where
|
|
33
|
+
charSolutions = toCharSolution <$> [if firstChar then 1 else 0..9]
|
|
34
|
+
char' = reverse xs !! col -- process from the right
|
|
35
|
+
firstChar = head xs == char'
|
|
36
|
+
toCharSolution x = ([(char', x)], (toInteger x, 0))
|
|
37
|
+
takeChar (x, _) (_, y) = Just (x, y)
|
|
38
|
+
partialSolutions (Plus left right) col solutionsSoFar =
|
|
39
|
+
mergePartialSolutions addResults leftSolutions rightSolutions
|
|
40
|
+
where
|
|
41
|
+
leftSolutions = partialSolutions left col solutionsSoFar
|
|
42
|
+
rightSolutions = partialSolutions right col solutionsSoFar
|
|
43
|
+
addResults (x1, x2) (y1, _) = Just (x1 + y1, x2)
|
|
44
|
+
partialSolutions (Equals left right) col solutionsSoFar =
|
|
45
|
+
mergePartialSolutions equateResults leftSolutions rightSolutions
|
|
46
|
+
where
|
|
47
|
+
equateResults (leftResult, leftCarry) (rightResult, _)
|
|
48
|
+
| rightResult == requiredResult = Just (0, carry)
|
|
49
|
+
| otherwise = Nothing
|
|
50
|
+
where (carry, requiredResult) = (leftResult + leftCarry) `divMod` 10
|
|
51
|
+
leftSolutions = partialSolutions left col solutionsSoFar
|
|
52
|
+
rightSolutions = partialSolutions right col solutionsSoFar
|
|
53
|
+
|
|
54
|
+
mergePartialSolutions :: (PartialResult -> PartialResult -> Maybe PartialResult) ->
|
|
55
|
+
[PartialSolution] -> [PartialSolution] -> [PartialSolution]
|
|
56
|
+
mergePartialSolutions mergeResults xs ys = do
|
|
57
|
+
(xSolution, xResult) <- xs
|
|
58
|
+
(ySolution, yResult) <- ys
|
|
59
|
+
let mergedSolution = mergeSolutions xSolution ySolution
|
|
60
|
+
guard $ (not . null) mergedSolution
|
|
61
|
+
let mergedResult = mergeResults xResult yResult
|
|
62
|
+
guard $ isJust mergedResult
|
|
63
|
+
return (mergedSolution, fromJust mergedResult)
|
|
64
|
+
where
|
|
65
|
+
mergeSolutions :: Solution -> Solution -> Solution
|
|
66
|
+
mergeSolutions s1 s2
|
|
67
|
+
| any conflict s1 = []
|
|
68
|
+
| otherwise = s1 `union` s2
|
|
69
|
+
where
|
|
70
|
+
conflict (k1, v1) =
|
|
71
|
+
maybe False (/= v1) (lookup k1 s2) ||
|
|
72
|
+
maybe False ((/= k1) . fst) (find ((== v1) . snd) s2)
|
|
73
|
+
|
|
74
|
+
data Term a where
|
|
75
|
+
Word :: String -> Term Integer
|
|
76
|
+
Equals :: (Eq a) => Term a -> Term a -> Term Bool
|
|
77
|
+
Plus :: Term Integer -> Term Integer -> Term Integer
|
|
78
|
+
|
|
79
|
+
maxLength :: Term a -> Int
|
|
80
|
+
maxLength (Word xs) = length xs
|
|
81
|
+
maxLength (Equals l r) = max (maxLength l) (maxLength r)
|
|
82
|
+
maxLength (Plus l r) = max (maxLength l) (maxLength r)
|
|
83
|
+
|
|
84
|
+
-- Term Parser
|
|
85
|
+
boolTerm :: Parser (Term Bool)
|
|
86
|
+
boolTerm = do
|
|
87
|
+
left <- integerTerm
|
|
88
|
+
_ <- trimmed (string "==")
|
|
89
|
+
right <- integerTerm
|
|
90
|
+
return $ Equals left right
|
|
91
|
+
|
|
92
|
+
integerTerm :: Parser (Term Integer)
|
|
93
|
+
integerTerm = try integerOperation <|> simpleIntegerTerm
|
|
94
|
+
|
|
95
|
+
integerOperation :: Parser (Term Integer)
|
|
96
|
+
integerOperation = do
|
|
97
|
+
left <- simpleIntegerTerm
|
|
98
|
+
op <- integerOperator
|
|
99
|
+
right <- integerTerm
|
|
100
|
+
return $ op left right
|
|
101
|
+
|
|
102
|
+
simpleIntegerTerm :: Parser (Term Integer)
|
|
103
|
+
simpleIntegerTerm = word
|
|
104
|
+
|
|
105
|
+
integerOperator :: Parser (Term Integer -> Term Integer -> Term Integer)
|
|
106
|
+
integerOperator = plus
|
|
107
|
+
|
|
108
|
+
word :: Parser (Term Integer)
|
|
109
|
+
word = Word <$> many1 upper
|
|
110
|
+
|
|
111
|
+
plus :: Parser (Term Integer -> Term Integer -> Term Integer)
|
|
112
|
+
plus = trimmed (char '+') *> pure Plus
|
|
113
|
+
|
|
114
|
+
trimmed :: Parser a -> Parser a
|
|
115
|
+
trimmed p = spaces *> p <* spaces
|
|
116
|
+
|