trackler 2.2.1.59 → 2.2.1.60
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/food-chain/canonical-data.json +31 -23
- data/problem-specifications/exercises/house/canonical-data.json +45 -33
- data/problem-specifications/exercises/house/description.md +1 -1
- data/problem-specifications/exercises/kindergarten-garden/description.md +3 -3
- data/problem-specifications/exercises/nucleotide-count/description.md +2 -2
- data/problem-specifications/exercises/palindrome-products/description.md +1 -1
- data/problem-specifications/exercises/rectangles/description.md +9 -9
- data/problem-specifications/exercises/twelve-days/canonical-data.json +171 -0
- data/problem-specifications/exercises/two-bucket/description.md +7 -7
- data/tracks/c/docs/CONTRIBUTING.md +88 -39
- data/tracks/c/exercises/phone-number/test/test_phone_number.c +33 -29
- data/tracks/c/exercises/triangle/src/example.c +12 -12
- data/tracks/c/exercises/triangle/src/example.h +3 -3
- data/tracks/c/exercises/triangle/test/test_triangle.c +16 -16
- data/tracks/c/exercises/word-count/src/example.c +12 -3
- data/tracks/c/exercises/word-count/src/word_count.h +10 -5
- data/tracks/c/exercises/word-count/test/test_word_count.c +248 -58
- data/tracks/ceylon/exercises/hamming/source/hamming/HammingTest.ceylon +3 -3
- data/tracks/ceylon/exercises/leap/source/leap/LeapTest.ceylon +2 -2
- data/tracks/dart/exercises/phone-number/README.md +1 -1
- data/tracks/dart/exercises/phone-number/test/phone_number_test.dart +5 -5
- data/tracks/gnu-apl/.dockerignore +5 -0
- data/tracks/gnu-apl/.travis.yml +9 -4
- data/tracks/gnu-apl/Dockerfiles/release.dockerfile +15 -0
- data/tracks/gnu-apl/Dockerfiles/svn.dockerfile +22 -0
- data/tracks/gnu-apl/README.md +1 -1
- data/tracks/gnu-apl/bin/install-apl +26 -0
- data/tracks/gnu-apl/test.apl +7 -6
- data/tracks/go/docs/TESTS.md +1 -1
- data/tracks/haskell/.travis.yml +1 -1
- data/tracks/haskell/config.json +9 -0
- data/tracks/haskell/exercises/accumulate/stack.yaml +1 -1
- data/tracks/haskell/exercises/acronym/package.yaml +1 -1
- data/tracks/haskell/exercises/acronym/stack.yaml +1 -1
- data/tracks/haskell/exercises/acronym/test/Tests.hs +3 -0
- data/tracks/haskell/exercises/all-your-base/stack.yaml +1 -1
- data/tracks/haskell/exercises/allergies/stack.yaml +1 -1
- data/tracks/haskell/exercises/alphametics/examples/success-standard/src/Alphametics.hs +2 -1
- data/tracks/haskell/exercises/alphametics/stack.yaml +1 -1
- data/tracks/haskell/exercises/anagram/stack.yaml +1 -1
- data/tracks/haskell/exercises/atbash-cipher/stack.yaml +1 -1
- data/tracks/haskell/exercises/bank-account/stack.yaml +1 -1
- data/tracks/haskell/exercises/beer-song/stack.yaml +1 -1
- data/tracks/haskell/exercises/binary-search-tree/stack.yaml +1 -1
- data/tracks/haskell/exercises/binary/stack.yaml +1 -1
- data/tracks/haskell/exercises/bob/stack.yaml +1 -1
- data/tracks/haskell/exercises/bowling/stack.yaml +1 -1
- data/tracks/haskell/exercises/bracket-push/stack.yaml +1 -1
- data/tracks/haskell/exercises/change/stack.yaml +1 -1
- data/tracks/haskell/exercises/clock/stack.yaml +1 -1
- data/tracks/haskell/exercises/collatz-conjecture/stack.yaml +1 -1
- data/tracks/haskell/exercises/complex-numbers/stack.yaml +1 -1
- data/tracks/haskell/exercises/connect/stack.yaml +1 -1
- data/tracks/haskell/exercises/crypto-square/package.yaml +1 -1
- data/tracks/haskell/exercises/crypto-square/stack.yaml +1 -1
- data/tracks/haskell/exercises/crypto-square/test/Tests.hs +9 -5
- data/tracks/haskell/exercises/custom-set/package.yaml +1 -1
- data/tracks/haskell/exercises/custom-set/stack.yaml +1 -1
- data/tracks/haskell/exercises/custom-set/test/Tests.hs +3 -0
- data/tracks/haskell/exercises/diamond/stack.yaml +1 -1
- data/tracks/haskell/exercises/difference-of-squares/stack.yaml +1 -1
- data/tracks/haskell/exercises/dominoes/README.md +3 -3
- data/tracks/haskell/exercises/dominoes/stack.yaml +1 -1
- data/tracks/haskell/exercises/etl/stack.yaml +1 -1
- data/tracks/haskell/exercises/food-chain/stack.yaml +1 -1
- data/tracks/haskell/exercises/forth/stack.yaml +1 -1
- data/tracks/haskell/exercises/gigasecond/stack.yaml +1 -1
- data/tracks/haskell/exercises/go-counting/stack.yaml +1 -1
- data/tracks/haskell/exercises/grade-school/stack.yaml +1 -1
- data/tracks/haskell/exercises/grains/stack.yaml +1 -1
- data/tracks/haskell/exercises/hamming/package.yaml +1 -1
- data/tracks/haskell/exercises/hamming/stack.yaml +1 -1
- data/tracks/haskell/exercises/hamming/test/Tests.hs +4 -4
- data/tracks/haskell/exercises/hello-world/stack.yaml +1 -1
- data/tracks/haskell/exercises/hexadecimal/stack.yaml +1 -1
- data/tracks/haskell/exercises/house/README.md +1 -1
- data/tracks/haskell/exercises/house/stack.yaml +1 -1
- data/tracks/haskell/exercises/isbn-verifier/README.md +96 -0
- data/tracks/haskell/exercises/isbn-verifier/examples/success-standard/package.yaml +16 -0
- data/tracks/haskell/exercises/isbn-verifier/examples/success-standard/src/IsbnVerifier.hs +10 -0
- data/tracks/haskell/exercises/isbn-verifier/package.yaml +20 -0
- data/tracks/haskell/exercises/isbn-verifier/src/IsbnVerifier.hs +4 -0
- data/tracks/haskell/exercises/isbn-verifier/stack.yaml +1 -0
- data/tracks/haskell/exercises/isbn-verifier/test/Tests.hs +74 -0
- data/tracks/haskell/exercises/isogram/stack.yaml +1 -1
- data/tracks/haskell/exercises/kindergarten-garden/README.md +3 -3
- data/tracks/haskell/exercises/kindergarten-garden/stack.yaml +1 -1
- data/tracks/haskell/exercises/largest-series-product/stack.yaml +1 -1
- data/tracks/haskell/exercises/leap/package.yaml +1 -1
- data/tracks/haskell/exercises/leap/stack.yaml +1 -1
- data/tracks/haskell/exercises/leap/test/Tests.hs +1 -1
- data/tracks/haskell/exercises/lens-person/stack.yaml +1 -1
- data/tracks/haskell/exercises/linked-list/stack.yaml +1 -1
- data/tracks/haskell/exercises/list-ops/stack.yaml +1 -1
- data/tracks/haskell/exercises/luhn/stack.yaml +1 -1
- data/tracks/haskell/exercises/matrix/stack.yaml +1 -1
- data/tracks/haskell/exercises/meetup/stack.yaml +1 -1
- data/tracks/haskell/exercises/minesweeper/stack.yaml +1 -1
- data/tracks/haskell/exercises/nth-prime/package.yaml +1 -1
- data/tracks/haskell/exercises/nth-prime/stack.yaml +1 -1
- data/tracks/haskell/exercises/nucleotide-count/README.md +2 -2
- data/tracks/haskell/exercises/nucleotide-count/package.yaml +1 -1
- data/tracks/haskell/exercises/nucleotide-count/stack.yaml +1 -1
- data/tracks/haskell/exercises/nucleotide-count/test/Tests.hs +6 -0
- data/tracks/haskell/exercises/ocr-numbers/stack.yaml +1 -1
- data/tracks/haskell/exercises/octal/stack.yaml +1 -1
- data/tracks/haskell/exercises/palindrome-products/README.md +1 -1
- data/tracks/haskell/exercises/palindrome-products/stack.yaml +1 -1
- data/tracks/haskell/exercises/pangram/package.yaml +1 -1
- data/tracks/haskell/exercises/pangram/stack.yaml +1 -1
- data/tracks/haskell/exercises/pangram/test/Tests.hs +6 -2
- data/tracks/haskell/exercises/parallel-letter-frequency/stack.yaml +1 -1
- data/tracks/haskell/exercises/pascals-triangle/stack.yaml +1 -1
- data/tracks/haskell/exercises/perfect-numbers/stack.yaml +1 -1
- data/tracks/haskell/exercises/phone-number/README.md +1 -1
- data/tracks/haskell/exercises/phone-number/stack.yaml +1 -1
- data/tracks/haskell/exercises/pig-latin/stack.yaml +1 -1
- data/tracks/haskell/exercises/pov/stack.yaml +1 -1
- data/tracks/haskell/exercises/prime-factors/stack.yaml +1 -1
- data/tracks/haskell/exercises/pythagorean-triplet/stack.yaml +1 -1
- data/tracks/haskell/exercises/queen-attack/stack.yaml +1 -1
- data/tracks/haskell/exercises/raindrops/stack.yaml +1 -1
- data/tracks/haskell/exercises/rna-transcription/stack.yaml +1 -1
- data/tracks/haskell/exercises/robot-name/stack.yaml +1 -1
- data/tracks/haskell/exercises/robot-simulator/stack.yaml +1 -1
- data/tracks/haskell/exercises/roman-numerals/stack.yaml +1 -1
- data/tracks/haskell/exercises/rotational-cipher/stack.yaml +1 -1
- data/tracks/haskell/exercises/run-length-encoding/stack.yaml +1 -1
- data/tracks/haskell/exercises/saddle-points/stack.yaml +1 -1
- data/tracks/haskell/exercises/say/stack.yaml +1 -1
- data/tracks/haskell/exercises/scrabble-score/stack.yaml +1 -1
- data/tracks/haskell/exercises/secret-handshake/stack.yaml +1 -1
- data/tracks/haskell/exercises/series/stack.yaml +1 -1
- data/tracks/haskell/exercises/sgf-parsing/stack.yaml +1 -1
- data/tracks/haskell/exercises/sieve/stack.yaml +1 -1
- data/tracks/haskell/exercises/simple-cipher/stack.yaml +1 -1
- data/tracks/haskell/exercises/simple-linked-list/stack.yaml +1 -1
- data/tracks/haskell/exercises/space-age/stack.yaml +1 -1
- data/tracks/haskell/exercises/spiral-matrix/stack.yaml +1 -1
- data/tracks/haskell/exercises/strain/stack.yaml +1 -1
- data/tracks/haskell/exercises/sublist/stack.yaml +1 -1
- data/tracks/haskell/exercises/sum-of-multiples/stack.yaml +1 -1
- data/tracks/haskell/exercises/triangle/stack.yaml +1 -1
- data/tracks/haskell/exercises/trinary/stack.yaml +1 -1
- data/tracks/haskell/exercises/word-count/stack.yaml +1 -1
- data/tracks/haskell/exercises/wordy/examples/success-standard/src/WordProblem.hs +6 -5
- data/tracks/haskell/exercises/wordy/stack.yaml +1 -1
- data/tracks/haskell/exercises/zebra-puzzle/package.yaml +1 -1
- data/tracks/haskell/exercises/zebra-puzzle/stack.yaml +1 -1
- data/tracks/haskell/exercises/zipper/README.md +1 -1
- data/tracks/haskell/exercises/zipper/stack.yaml +1 -1
- data/tracks/javascript/.eslintignore +43 -0
- data/tracks/javascript/.travis.yml +2 -1
- data/tracks/javascript/exercises/bowling/README.md +5 -5
- data/tracks/javascript/exercises/crypto-square/example.js +2 -1
- data/tracks/javascript/exercises/diffie-hellman/diffie-hellman.spec.js +20 -20
- data/tracks/javascript/exercises/diffie-hellman/example.js +10 -10
- data/tracks/javascript/exercises/largest-series-product/example.js +2 -1
- data/tracks/javascript/exercises/sieve/example.js +5 -2
- data/tracks/javascript/package-lock.json +129 -76
- data/tracks/javascript/package.json +6 -5
- data/tracks/ocaml/config.json +10 -0
- data/tracks/ocaml/exercises/hamming/test.ml +3 -3
- data/tracks/ocaml/exercises/leap/test.ml +2 -2
- data/tracks/ocaml/exercises/pangram/test.ml +3 -3
- data/tracks/ocaml/exercises/rectangles/.merlin +5 -0
- data/tracks/ocaml/exercises/rectangles/Makefile +11 -0
- data/tracks/ocaml/exercises/rectangles/example.ml +30 -0
- data/tracks/ocaml/exercises/rectangles/rectangles.mli +1 -0
- data/tracks/ocaml/exercises/rectangles/test.ml +72 -0
- data/tracks/ocaml/tools/test-generator/templates/ocaml/leap/test.ml +1 -1
- data/tracks/ocaml/tools/test-generator/templates/ocaml/rectangles/test.ml +15 -0
- data/tracks/pony/README.md +1 -1
- data/tracks/pony/exercises/atbash-cipher/example.pony +6 -10
- data/tracks/pony/exercises/difference-of-squares/example.pony +3 -7
- data/tracks/rust/_test/count-ignores.sh +2 -2
- data/tracks/rust/config.json +24 -0
- data/tracks/rust/config/maintainers.json +10 -0
- data/tracks/rust/exercises/acronym/README.md +0 -1
- data/tracks/rust/exercises/all-your-base/README.md +1 -1
- data/tracks/rust/exercises/allergies/README.md +0 -1
- data/tracks/rust/exercises/alphametics/README.md +2 -2
- data/tracks/rust/exercises/atbash-cipher/README.md +2 -1
- data/tracks/rust/exercises/beer-song/README.md +1 -1
- data/tracks/rust/exercises/bowling/README.md +20 -6
- data/tracks/rust/exercises/circular-buffer/README.md +13 -6
- data/tracks/rust/exercises/crypto-square/README.md +10 -8
- data/tracks/rust/exercises/dominoes/Cargo.toml +1 -1
- data/tracks/rust/exercises/etl/README.md +2 -0
- data/tracks/rust/exercises/grade-school/README.md +0 -1
- data/tracks/rust/exercises/grains/README.md +0 -1
- data/tracks/rust/exercises/isbn-verifier/Cargo.lock +4 -0
- data/tracks/rust/exercises/isbn-verifier/Cargo.toml +3 -0
- data/tracks/rust/exercises/isbn-verifier/README.md +74 -0
- data/tracks/rust/exercises/isbn-verifier/example.rs +44 -0
- data/tracks/rust/exercises/isbn-verifier/src/lib.rs +4 -0
- data/tracks/rust/exercises/isbn-verifier/tests/isbn-verifier.rs +83 -0
- data/tracks/rust/exercises/isogram/README.md +3 -2
- data/tracks/rust/exercises/leap/README.md +1 -1
- data/tracks/rust/exercises/luhn/README.md +7 -7
- data/tracks/rust/exercises/nucleotide-count/README.md +8 -22
- data/tracks/rust/exercises/ocr-numbers/README.md +5 -5
- data/tracks/rust/exercises/pangram/README.md +1 -1
- data/tracks/rust/exercises/pascals-triangle/README.md +1 -1
- data/tracks/rust/exercises/perfect-numbers/README.md +2 -2
- data/tracks/rust/exercises/phone-number/README.md +3 -2
- data/tracks/rust/exercises/protein-translation/README.md +4 -5
- data/tracks/rust/exercises/proverb/README.md +13 -11
- data/tracks/rust/exercises/proverb/example.rs +14 -15
- data/tracks/rust/exercises/proverb/tests/proverb.rs +40 -13
- data/tracks/rust/exercises/pythagorean-triplet/README.md +3 -3
- data/tracks/rust/exercises/queen-attack/README.md +1 -1
- data/tracks/rust/exercises/rectangles/README.md +7 -7
- data/tracks/rust/exercises/roman-numerals/README.md +1 -1
- data/tracks/rust/exercises/rotational-cipher/README.md +2 -1
- data/tracks/rust/exercises/run-length-encoding/README.md +4 -4
- data/tracks/rust/exercises/scrabble-score/README.md +3 -1
- data/tracks/rust/exercises/space-age/README.md +1 -1
- data/tracks/rust/exercises/tournament/README.md +5 -5
- data/tracks/rust/exercises/triangle/README.md +9 -6
- data/tracks/rust/exercises/two-bucket/Cargo.lock +4 -0
- data/tracks/rust/exercises/two-bucket/Cargo.toml +3 -0
- data/tracks/rust/exercises/two-bucket/README.md +69 -0
- data/tracks/rust/exercises/two-bucket/example.rs +129 -0
- data/tracks/rust/exercises/two-bucket/src/lib.rs +26 -0
- data/tracks/rust/exercises/two-bucket/tests/two-bucket.rs +68 -0
- data/tracks/rust/exercises/variable-length-quantity/README.md +6 -7
- data/tracks/rust/exercises/word-count/README.md +1 -2
- data/tracks/rust/exercises/wordy/README.md +0 -5
- metadata +33 -4
- data/tracks/go/.github/PULL_REQUEST_TEMPLATE.md +0 -23
- data/tracks/ruby/.github/PULL_REQUEST_TEMPLATE.md +0 -40
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -23,6 +23,12 @@ specs = do
|
|
23
23
|
, ('G', 0)
|
24
24
|
, ('T', 0) ]
|
25
25
|
|
26
|
+
it "can count one nucleotide in single-character input" $
|
27
|
+
nucleotideCounts "G" `matchesMap` [ ('A', 0)
|
28
|
+
, ('C', 0)
|
29
|
+
, ('G', 1)
|
30
|
+
, ('T', 0) ]
|
31
|
+
|
26
32
|
it "repetitive-sequence-has-only-guanosine" $
|
27
33
|
nucleotideCounts "GGGGGGGG" `matchesMap` [ ('A', 0)
|
28
34
|
, ('C', 0)
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -9,7 +9,7 @@ Given a range of numbers, find the largest and smallest palindromes which
|
|
9
9
|
are products of numbers within that range.
|
10
10
|
|
11
11
|
Your solution should return the largest and smallest palindromes, along with the
|
12
|
-
factors of each within the range. If the largest or smallest palindrome has more
|
12
|
+
factors of each within the range. If the largest or smallest palindrome has more
|
13
13
|
than one pair of factors within the range, then return all the pairs.
|
14
14
|
|
15
15
|
## Example 1
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -24,6 +24,10 @@ cases = [ Case { description = "sentence empty"
|
|
24
24
|
, input = ""
|
25
25
|
, expected = False
|
26
26
|
}
|
27
|
+
, Case { description = "recognizes a perfect lower case pangram"
|
28
|
+
, input = "abcdefghijklmnopqrstuvwxyz"
|
29
|
+
, expected = True
|
30
|
+
}
|
27
31
|
, Case { description = "pangram with only lower case"
|
28
32
|
, input = "the quick brown fox jumps over the lazy dog"
|
29
33
|
, expected = True
|
@@ -32,8 +36,8 @@ cases = [ Case { description = "sentence empty"
|
|
32
36
|
, input = "a quick movement of the enemy will jeopardize five gunboats"
|
33
37
|
, expected = False
|
34
38
|
}
|
35
|
-
, Case { description = "another missing character '
|
36
|
-
, input = "
|
39
|
+
, Case { description = "another missing character, e.g. 'h'"
|
40
|
+
, input = "five boxing wizards jump quickly at it"
|
37
41
|
, expected = False
|
38
42
|
}
|
39
43
|
, Case { description = "pangram with underscores"
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -14,7 +14,7 @@ The format is usually represented as
|
|
14
14
|
|
15
15
|
where `N` is any digit from 2 through 9 and `X` is any digit from 0 through 9.
|
16
16
|
|
17
|
-
Your task is to clean up differently
|
17
|
+
Your task is to clean up differently formatted telephone numbers by removing punctuation and the country code (1) if present.
|
18
18
|
|
19
19
|
For example, the inputs
|
20
20
|
- `+1 (613)-995-0253`
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1,5 +1,6 @@
|
|
1
1
|
{-# LANGUAGE OverloadedStrings #-}
|
2
2
|
module WordProblem (answer) where
|
3
|
+
import Data.Functor (($>))
|
3
4
|
import Data.Text (pack)
|
4
5
|
import Data.List (foldl')
|
5
6
|
import Control.Applicative ((<|>))
|
@@ -10,7 +11,7 @@ answerParser :: Parser Int
|
|
10
11
|
answerParser = do
|
11
12
|
n <- "What is " *> signed decimal
|
12
13
|
ops <- many' (space *> operation)
|
13
|
-
"?"
|
14
|
+
"?" $> foldl' (flip ($)) n ops
|
14
15
|
|
15
16
|
answer :: String -> Maybe Int
|
16
17
|
answer = maybeResult . parse answerParser . pack
|
@@ -19,7 +20,7 @@ operation :: Parser (Int -> Int)
|
|
19
20
|
operation = (flip <$> operator) <* space <*> signed decimal
|
20
21
|
|
21
22
|
operator :: Parser (Int -> Int -> Int)
|
22
|
-
operator = "plus"
|
23
|
-
"minus"
|
24
|
-
"multiplied by"
|
25
|
-
"divided by"
|
23
|
+
operator = "plus" $> (+) <|>
|
24
|
+
"minus" $> (-) <|>
|
25
|
+
"multiplied by" $> (*) <|>
|
26
|
+
"divided by" $> div
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Creating a zipper for a binary tree.
|
4
4
|
|
5
5
|
[Zippers](https://en.wikipedia.org/wiki/Zipper_%28data_structure%29) are
|
6
|
-
a
|
6
|
+
a purely functional way of navigating within a data structure and
|
7
7
|
manipulating it. They essentially contain a data structure and a
|
8
8
|
pointer into that data structure (called the focus).
|
9
9
|
|
@@ -1 +1 @@
|
|
1
|
-
resolver: lts-
|
1
|
+
resolver: lts-9.11
|
@@ -0,0 +1,43 @@
|
|
1
|
+
big-integer.js
|
2
|
+
exercises/accumulate
|
3
|
+
exercises/acronym
|
4
|
+
exercises/alphametics
|
5
|
+
exercises/anagram
|
6
|
+
exercises/binary-search
|
7
|
+
exercises/binary-search-tree
|
8
|
+
exercises/bowling
|
9
|
+
exercises/bracket-push
|
10
|
+
exercises/circular-buffer
|
11
|
+
exercises/clock
|
12
|
+
exercises/custom-set
|
13
|
+
exercises/diamond
|
14
|
+
exercises/flatten-array
|
15
|
+
exercises/food-chain
|
16
|
+
exercises/grade-school
|
17
|
+
exercises/grains
|
18
|
+
exercises/kindergarten-garden
|
19
|
+
exercises/leap
|
20
|
+
exercises/linked-list
|
21
|
+
exercises/list-ops
|
22
|
+
exercises/luhn
|
23
|
+
exercises/minesweeper
|
24
|
+
exercises/nth-prime
|
25
|
+
exercises/octal
|
26
|
+
exercises/palindrome-products
|
27
|
+
exercises/pangram
|
28
|
+
exercises/perfect-numbers
|
29
|
+
exercises/pythagorean-triplet
|
30
|
+
exercises/queen-attack
|
31
|
+
exercises/robot-name
|
32
|
+
exercises/robot-simulator
|
33
|
+
exercises/roman-numerals
|
34
|
+
exercises/saddle-points
|
35
|
+
exercises/say
|
36
|
+
exercises/scrabble-score
|
37
|
+
exercises/secret-handshake
|
38
|
+
exercises/simple-cipher
|
39
|
+
exercises/simple-linked-list
|
40
|
+
exercises/sum-of-multiples
|
41
|
+
exercises/triangle
|
42
|
+
exercises/trinary
|
43
|
+
exercises/wordy
|
@@ -8,13 +8,13 @@ of a game of bowling.
|
|
8
8
|
|
9
9
|
## Scoring Bowling
|
10
10
|
|
11
|
-
|
11
|
+
A game consists of 10 frames. A frame is composed of one or two balls thrown, with 10 pins standing at the start of the frame. There are three cases for the tabulation of a frame:
|
12
12
|
|
13
|
-
* An open frame is where a score of less than 10 is recorded for the frame. In this case the score for the frame is the number of pins knocked down.
|
13
|
+
* An open frame is where a score of less than 10 is recorded for the frame. In this case the score for the frame is the number of pins knocked down after the second throw.
|
14
14
|
|
15
|
-
* A spare is where all ten pins are knocked down after the second throw. The total value of a spare is 10 plus the number of pins knocked down in
|
15
|
+
* A spare is where all ten pins are knocked down after the second throw. The total value of a spare is 10 plus the number of pins knocked down in the next throw.
|
16
16
|
|
17
|
-
* A strike is where all ten pins are knocked down after the first throw. The total value of a strike is 10 plus the number of pins knocked down in
|
17
|
+
* A strike is where all ten pins are knocked down after the first throw. The total value of a strike is 10 plus the number of pins knocked down in the next two throws. If a strike is immediately followed by another strike, then the first strike's value cannot be totalled until the next throw.
|
18
18
|
|
19
19
|
Here is a three frame example:
|
20
20
|
|
@@ -30,7 +30,7 @@ Frame 3 is (9 + 0) = 9
|
|
30
30
|
|
31
31
|
This means the current running total is 48.
|
32
32
|
|
33
|
-
The tenth frame in the game is a special case. If
|
33
|
+
The tenth frame in the game is a special case. If the player throws a strike or a spare, then they get one extra throw called a fill ball. Fill balls exist to calculate the total of the 10th frame. Scoring a strike or spare on the fill ball does not give the player more fill balls. The total value of the 10th frame is the total number of pins knocked down.
|
34
34
|
|
35
35
|
For a tenth frame of X1/ (strike and a spare), the total value is 20.
|
36
36
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
var DiffieHellman = require('./diffie-hellman');
|
2
2
|
|
3
|
-
describe('diffie-hellman', function(){
|
3
|
+
describe('diffie-hellman', function () {
|
4
4
|
var p = 23;
|
5
5
|
var g = 5;
|
6
6
|
var diffieHellman = new DiffieHellman(p, g);
|
@@ -11,57 +11,57 @@ describe('diffie-hellman', function(){
|
|
11
11
|
var bobPrivateKey = 15;
|
12
12
|
var bobPublicKey = 19;
|
13
13
|
|
14
|
-
it('throws an error if the constructor arguments are out of range', function() {
|
15
|
-
expect(function() {
|
16
|
-
new DiffieHellman(0, 9999);
|
14
|
+
it('throws an error if the constructor arguments are out of range', function () {
|
15
|
+
expect(function () {
|
16
|
+
return new DiffieHellman(0, 9999);
|
17
17
|
}).toThrow();
|
18
18
|
});
|
19
19
|
|
20
|
-
xit('throws an error if the constructor arguments are not prime', function() {
|
21
|
-
expect(function() {
|
22
|
-
new DiffieHellman(10, 13);
|
20
|
+
xit('throws an error if the constructor arguments are not prime', function () {
|
21
|
+
expect(function () {
|
22
|
+
return new DiffieHellman(10, 13);
|
23
23
|
}).toThrow();
|
24
24
|
});
|
25
25
|
|
26
|
-
xit('throws an error if private key is negative', function() {
|
27
|
-
expect(function() {
|
26
|
+
xit('throws an error if private key is negative', function () {
|
27
|
+
expect(function () {
|
28
28
|
diffieHellman.getPublicKeyFromPrivateKey(-1);
|
29
29
|
}).toThrow();
|
30
30
|
});
|
31
31
|
|
32
|
-
xit('throws an error if private key is zero', function() {
|
33
|
-
expect(function() {
|
32
|
+
xit('throws an error if private key is zero', function () {
|
33
|
+
expect(function () {
|
34
34
|
diffieHellman.getPublicKeyFromPrivateKey(0);
|
35
35
|
}).toThrow();
|
36
36
|
});
|
37
37
|
|
38
|
-
xit('throws an error if private key is one', function() {
|
39
|
-
expect(function() {
|
38
|
+
xit('throws an error if private key is one', function () {
|
39
|
+
expect(function () {
|
40
40
|
diffieHellman.getPublicKeyFromPrivateKey(1);
|
41
41
|
}).toThrow();
|
42
42
|
});
|
43
43
|
|
44
|
-
xit('throws an error if private key equals the modulus parameter p', function() {
|
45
|
-
expect(function() {
|
44
|
+
xit('throws an error if private key equals the modulus parameter p', function () {
|
45
|
+
expect(function () {
|
46
46
|
diffieHellman.getPublicKeyFromPrivateKey(p);
|
47
47
|
}).toThrow();
|
48
48
|
});
|
49
49
|
|
50
|
-
xit('throws an error if private key is greater than the modulus parameter p', function() {
|
51
|
-
expect(function() {
|
50
|
+
xit('throws an error if private key is greater than the modulus parameter p', function () {
|
51
|
+
expect(function () {
|
52
52
|
diffieHellman.getPublicKeyFromPrivateKey(p + 1);
|
53
53
|
}).toThrow();
|
54
54
|
});
|
55
55
|
|
56
|
-
xit('when given a private key, returns the correct public one', function() {
|
56
|
+
xit('when given a private key, returns the correct public one', function () {
|
57
57
|
expect(diffieHellman.getPublicKeyFromPrivateKey(alicePrivateKey)).toEqual(alicePublicKey);
|
58
58
|
});
|
59
59
|
|
60
|
-
xit('when given a different private key, returns the correct public one', function() {
|
60
|
+
xit('when given a different private key, returns the correct public one', function () {
|
61
61
|
expect(diffieHellman.getPublicKeyFromPrivateKey(bobPrivateKey)).toEqual(bobPublicKey);
|
62
62
|
});
|
63
63
|
|
64
|
-
xit('can generate a shared secret from our private key and their public key', function() {
|
64
|
+
xit('can generate a shared secret from our private key and their public key', function () {
|
65
65
|
var sharedSecret = 2;
|
66
66
|
|
67
67
|
expect(diffieHellman.getSharedSecret(alicePrivateKey, bobPublicKey))
|