trackler 2.2.1.176 → 2.2.1.177

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/isbn-verifier/canonical-data.json +9 -9
  4. data/tracks/bash/docs/LEARNING.md +1 -1
  5. data/tracks/bash/docs/RESOURCES.md +7 -3
  6. data/tracks/clojure/docs/RESOURCES.md +1 -1
  7. data/tracks/crystal/config.json +1 -0
  8. data/tracks/crystal/docs/ABOUT.md +3 -1
  9. data/tracks/crystal/exercises/gigasecond/spec/gigasecond_spec.cr +10 -10
  10. data/tracks/delphi/exercises/isbn-verifier/uTestISBNVerifier.pas +7 -7
  11. data/tracks/erlang/config.json +36 -0
  12. data/tracks/erlang/exercises/armstrong-numbers/test/armstrong_numbers_tests.erl +1 -1
  13. data/tracks/erlang/exercises/minesweeper/README.md +68 -0
  14. data/tracks/erlang/exercises/minesweeper/rebar.config +30 -0
  15. data/tracks/erlang/exercises/minesweeper/src/example.erl +76 -0
  16. data/tracks/erlang/exercises/minesweeper/src/minesweeper.app.src +9 -0
  17. data/tracks/erlang/exercises/minesweeper/src/minesweeper.erl +8 -0
  18. data/tracks/erlang/exercises/minesweeper/test/minesweeper_tests.erl +154 -0
  19. data/tracks/erlang/exercises/perfect-numbers/README.md +59 -0
  20. data/tracks/erlang/exercises/perfect-numbers/rebar.config +30 -0
  21. data/tracks/erlang/exercises/perfect-numbers/src/example.erl +35 -0
  22. data/tracks/erlang/exercises/perfect-numbers/src/perfect_numbers.app.src +9 -0
  23. data/tracks/erlang/exercises/perfect-numbers/src/perfect_numbers.erl +8 -0
  24. data/tracks/erlang/exercises/perfect-numbers/test/perfect_numbers_tests.erl +48 -0
  25. data/tracks/erlang/exercises/secret-handshake/README.md +70 -0
  26. data/tracks/erlang/exercises/secret-handshake/rebar.config +30 -0
  27. data/tracks/erlang/exercises/secret-handshake/src/example.erl +19 -0
  28. data/tracks/erlang/exercises/secret-handshake/src/secret_handshake.app.src +9 -0
  29. data/tracks/erlang/exercises/secret-handshake/src/secret_handshake.erl +8 -0
  30. data/tracks/erlang/exercises/secret-handshake/test/secret_handshake_tests.erl +45 -0
  31. data/tracks/go/.travis.yml +2 -2
  32. data/tracks/nim/config.json +2 -2
  33. data/tracks/nim/docs/SNIPPET.txt +4 -1
  34. data/tracks/python/config.json +12 -0
  35. data/tracks/python/exercises/ledger/README.md +60 -0
  36. data/tracks/python/exercises/ledger/example.py +85 -0
  37. data/tracks/python/exercises/ledger/ledger.py +298 -0
  38. data/tracks/python/exercises/ledger/ledger_test.py +147 -0
  39. data/tracks/python/exercises/linked-list/example.py +8 -8
  40. data/tracks/python/exercises/linked-list/linked_list.py +1 -1
  41. data/tracks/python/exercises/reverse-string/example.py +2 -2
  42. data/tracks/python/exercises/reverse-string/reverse_string.py +1 -1
  43. data/tracks/reasonml/config.json +24 -0
  44. data/tracks/reasonml/exercises/armstrong-numbers/README.md +35 -0
  45. data/tracks/reasonml/exercises/armstrong-numbers/__tests__/ArmstrongNumbers_test.re +37 -0
  46. data/tracks/reasonml/exercises/armstrong-numbers/bsconfig.json +25 -0
  47. data/tracks/reasonml/exercises/armstrong-numbers/package-lock.json +5835 -0
  48. data/tracks/reasonml/exercises/armstrong-numbers/package.json +20 -0
  49. data/tracks/reasonml/exercises/armstrong-numbers/src/ArmstrongNumbers.rei +1 -0
  50. data/tracks/reasonml/exercises/armstrong-numbers/src/Example.re +17 -0
  51. data/tracks/reasonml/exercises/isogram/README.md +38 -0
  52. data/tracks/reasonml/exercises/isogram/__tests__/Isogram_test.re +41 -0
  53. data/tracks/reasonml/exercises/isogram/bsconfig.json +25 -0
  54. data/tracks/reasonml/exercises/isogram/package-lock.json +5835 -0
  55. data/tracks/reasonml/exercises/isogram/package.json +20 -0
  56. data/tracks/reasonml/exercises/isogram/src/Example.re +17 -0
  57. data/tracks/reasonml/exercises/isogram/src/Isogram.rei +1 -0
  58. data/tracks/rust/config.json +95 -94
  59. data/tracks/rust/exercises/diffie-hellman/.meta/hints.md +2 -0
  60. data/tracks/rust/exercises/diffie-hellman/README.md +4 -0
  61. data/tracks/rust/exercises/diffie-hellman/example.rs +24 -2
  62. data/tracks/rust/exercises/diffie-hellman/tests/diffie-hellman.rs +30 -0
  63. data/tracks/rust/exercises/{twofer → two-fer}/.gitignore +0 -0
  64. data/tracks/rust/exercises/{twofer → two-fer}/Cargo.toml +0 -0
  65. data/tracks/rust/exercises/{twofer → two-fer}/README.md +1 -1
  66. data/tracks/rust/exercises/{twofer → two-fer}/example.rs +0 -0
  67. data/tracks/rust/exercises/{twofer → two-fer}/src/lib.rs +0 -0
  68. data/tracks/rust/exercises/{twofer → two-fer}/tests/two-fer.rs +0 -0
  69. metadata +45 -8
@@ -0,0 +1,59 @@
1
+ Determine if a number is perfect, abundant, or deficient based on
2
+ Nicomachus' (60 - 120 CE) classification scheme for natural numbers.
3
+
4
+ The Greek mathematician [Nicomachus](https://en.wikipedia.org/wiki/Nicomachus) devised a classification scheme for natural numbers, identifying each as belonging uniquely to the categories of **perfect**, **abundant**, or **deficient** based on their [aliquot sum](https://en.wikipedia.org/wiki/Aliquot_sum). The aliquot sum is defined as the sum of the factors of a number not including the number itself. For example, the aliquot sum of 15 is (1 + 3 + 5) = 9
5
+
6
+ - **Perfect**: aliquot sum = number
7
+ - 6 is a perfect number because (1 + 2 + 3) = 6
8
+ - 28 is a perfect number because (1 + 2 + 4 + 7 + 14) = 28
9
+ - **Abundant**: aliquot sum > number
10
+ - 12 is an abundant number because (1 + 2 + 3 + 4 + 6) = 16
11
+ - 24 is an abundant number because (1 + 2 + 3 + 4 + 6 + 8 + 12) = 36
12
+ - **Deficient**: aliquot sum < number
13
+ - 8 is a deficient number because (1 + 2 + 4) = 7
14
+ - Prime numbers are deficient
15
+
16
+ Implement a way to determine whether a given number is **perfect**. Depending on your language track, you may also need to implement a way to determine whether a given number is **abundant** or **deficient**.
17
+
18
+ ## Running tests
19
+
20
+ In order to run the tests, issue the following command from the exercise
21
+ directory:
22
+
23
+ For running the tests provided, `rebar3` is used as it is the official build and
24
+ dependency management tool for erlang now. Please refer to [the tracks installation
25
+ instructions](http://exercism.io/languages/erlang/installation) on how to do that.
26
+
27
+ In order to run the tests, you can issue the following command from the exercise
28
+ directory.
29
+
30
+ ```bash
31
+ $ rebar3 eunit
32
+ ```
33
+
34
+ ### Test versioning
35
+
36
+ Each problem defines a macro `TEST_VERSION` in the test file and
37
+ verifies that the solution defines and exports a function `test_version`
38
+ returning that same value.
39
+
40
+ To make tests pass, add the following to your solution:
41
+
42
+ ```erlang
43
+ -export([test_version/0]).
44
+
45
+ test_version() ->
46
+ 1.
47
+ ```
48
+
49
+ The benefit of this is that reviewers can see against which test version
50
+ an iteration was written if, for example, a previously posted solution
51
+ does not solve the current problem or passes current tests.
52
+
53
+ ## Questions?
54
+
55
+ For detailed information about the Erlang track, please refer to the
56
+ [help page](http://exercism.io/languages/erlang) on the Exercism site.
57
+ This covers the basic information on setting up the development
58
+ environment expected by the exercises.
59
+
@@ -0,0 +1,30 @@
1
+ %% Erlang compiler options
2
+ {erl_opts, [debug_info]}.
3
+
4
+ {deps, [{erl_exercism, "0.1.1"}]}.
5
+
6
+ {dialyzer, [
7
+ {warnings, [underspecs, no_return]},
8
+ {get_warnings, true},
9
+ {plt_apps, top_level_deps}, % top_level_deps | all_deps
10
+ {plt_extra_apps, []},
11
+ {plt_location, local}, % local | "/my/file/name"
12
+ {plt_prefix, "rebar3"},
13
+ {base_plt_apps, [stdlib, kernel, crypto]},
14
+ {base_plt_location, global}, % global | "/my/file/name"
15
+ {base_plt_prefix, "rebar3"}
16
+ ]}.
17
+
18
+ %% eunit:test(Tests)
19
+ {eunit_tests, []}.
20
+ %% Options for eunit:test(Tests, Opts)
21
+ {eunit_opts, [verbose]}.
22
+
23
+ %% == xref ==
24
+
25
+ {xref_warnings, true}.
26
+
27
+ %% xref checks to run
28
+ {xref_checks, [undefined_function_calls, undefined_functions,
29
+ locals_not_used, exports_not_used,
30
+ deprecated_function_calls, deprecated_functions]}.
@@ -0,0 +1,35 @@
1
+ -module(example).
2
+
3
+ -export([classify/1, test_version/0]).
4
+
5
+ classify(1) ->
6
+ deficient;
7
+
8
+ classify(N) when N>1 ->
9
+ classify(N, aliquot(N));
10
+
11
+ classify(_) ->
12
+ {error, "Classification is only possible for natural numbers."}.
13
+
14
+ classify(N, N) ->
15
+ perfect;
16
+
17
+ classify(N, Aliquot) when N<Aliquot ->
18
+ abundant;
19
+
20
+ classify(_, _) ->
21
+ deficient.
22
+
23
+ aliquot(N) ->
24
+ aliquot(N, N div 2, 0).
25
+
26
+ aliquot(_, 0, Acc) ->
27
+ Acc;
28
+
29
+ aliquot(N, D, Acc) when N rem D=:=0 ->
30
+ aliquot(N, D-1, Acc+D);
31
+
32
+ aliquot(N, D, Acc) ->
33
+ aliquot(N, D-1, Acc).
34
+
35
+ test_version() -> 1.
@@ -0,0 +1,9 @@
1
+ {application, perfect_numbers,
2
+ [{description, "exercism.io - perfect-numbers"},
3
+ {vsn, "0.0.1"},
4
+ {modules, []},
5
+ {registered, []},
6
+ {applications, [kernel,
7
+ stdlib]},
8
+ {env, []}
9
+ ]}.
@@ -0,0 +1,8 @@
1
+ -module(perfect_numbers).
2
+
3
+ -export([classify/1, test_version/0]).
4
+
5
+ classify(N) ->
6
+ undefined.
7
+
8
+ test_version() -> 1.
@@ -0,0 +1,48 @@
1
+ %% based on canonical data version 1.1.0
2
+ %% https://raw.githubusercontent.com/exercism/problem-specifications/master/exercises/perfect-numbers/canonical-data.json
3
+
4
+ -module(perfect_numbers_tests).
5
+
6
+ -define(TESTED_MODULE, (sut(perfect_numbers))).
7
+ -define(TEST_VERSION, 1).
8
+ -include_lib("erl_exercism/include/exercism.hrl").
9
+ -include_lib("eunit/include/eunit.hrl").
10
+
11
+ perfect_smallest_test() ->
12
+ ?assertMatch(perfect, perfect_numbers:classify(6)).
13
+
14
+ perfect_medium_test() ->
15
+ ?assertMatch(perfect, perfect_numbers:classify(28)).
16
+
17
+ perfect_large_test() ->
18
+ ?assertMatch(perfect, perfect_numbers:classify(33550336)).
19
+
20
+ abundant_smallest_test() ->
21
+ ?assertMatch(abundant, perfect_numbers:classify(12)).
22
+
23
+ abundant_medium_test() ->
24
+ ?assertMatch(abundant, perfect_numbers:classify(30)).
25
+
26
+ abundant_large_test() ->
27
+ ?assertMatch(abundant, perfect_numbers:classify(33550335)).
28
+
29
+ deficient_smallest_prime_test() ->
30
+ ?assertMatch(deficient, perfect_numbers:classify(2)).
31
+
32
+ deficient_smallest_non_prime_test() ->
33
+ ?assertMatch(deficient, perfect_numbers:classify(4)).
34
+
35
+ deficient_medium_test() ->
36
+ ?assertMatch(deficient, perfect_numbers:classify(32)).
37
+
38
+ deficient_large_test() ->
39
+ ?assertMatch(deficient, perfect_numbers:classify(33550337)).
40
+
41
+ deficient_edge_case_1_test() ->
42
+ ?assertMatch(deficient, perfect_numbers:classify(1)).
43
+
44
+ invalid_zero_test() ->
45
+ ?assertMatch({error, "Classification is only possible for natural numbers."}, perfect_numbers:classify(0)).
46
+
47
+ invalid_negative_test() ->
48
+ ?assertMatch({error, "Classification is only possible for natural numbers."}, perfect_numbers:classify(-1)).
@@ -0,0 +1,70 @@
1
+ > There are 10 types of people in the world: Those who understand
2
+ > binary, and those who don't.
3
+
4
+ You and your fellow cohort of those in the "know" when it comes to
5
+ binary decide to come up with a secret "handshake".
6
+
7
+ ```text
8
+ 1 = wink
9
+ 10 = double blink
10
+ 100 = close your eyes
11
+ 1000 = jump
12
+
13
+
14
+ 10000 = Reverse the order of the operations in the secret handshake.
15
+ ```
16
+
17
+ Given a decimal number, convert it to the appropriate sequence of events for a secret handshake.
18
+
19
+ Here's a couple of examples:
20
+
21
+ Given the input 3, the function would return the array
22
+ ["wink", "double blink"] because 3 is 11 in binary.
23
+
24
+ Given the input 19, the function would return the array
25
+ ["double blink", "wink"] because 19 is 10011 in binary.
26
+ Notice that the addition of 16 (10000 in binary)
27
+ has caused the array to be reversed.
28
+
29
+ ## Running tests
30
+
31
+ In order to run the tests, issue the following command from the exercise
32
+ directory:
33
+
34
+ For running the tests provided, `rebar3` is used as it is the official build and
35
+ dependency management tool for erlang now. Please refer to [the tracks installation
36
+ instructions](http://exercism.io/languages/erlang/installation) on how to do that.
37
+
38
+ In order to run the tests, you can issue the following command from the exercise
39
+ directory.
40
+
41
+ ```bash
42
+ $ rebar3 eunit
43
+ ```
44
+
45
+ ### Test versioning
46
+
47
+ Each problem defines a macro `TEST_VERSION` in the test file and
48
+ verifies that the solution defines and exports a function `test_version`
49
+ returning that same value.
50
+
51
+ To make tests pass, add the following to your solution:
52
+
53
+ ```erlang
54
+ -export([test_version/0]).
55
+
56
+ test_version() ->
57
+ 1.
58
+ ```
59
+
60
+ The benefit of this is that reviewers can see against which test version
61
+ an iteration was written if, for example, a previously posted solution
62
+ does not solve the current problem or passes current tests.
63
+
64
+ ## Questions?
65
+
66
+ For detailed information about the Erlang track, please refer to the
67
+ [help page](http://exercism.io/languages/erlang) on the Exercism site.
68
+ This covers the basic information on setting up the development
69
+ environment expected by the exercises.
70
+
@@ -0,0 +1,30 @@
1
+ %% Erlang compiler options
2
+ {erl_opts, [debug_info]}.
3
+
4
+ {deps, [{erl_exercism, "0.1.1"}]}.
5
+
6
+ {dialyzer, [
7
+ {warnings, [underspecs, no_return]},
8
+ {get_warnings, true},
9
+ {plt_apps, top_level_deps}, % top_level_deps | all_deps
10
+ {plt_extra_apps, []},
11
+ {plt_location, local}, % local | "/my/file/name"
12
+ {plt_prefix, "rebar3"},
13
+ {base_plt_apps, [stdlib, kernel, crypto]},
14
+ {base_plt_location, global}, % global | "/my/file/name"
15
+ {base_plt_prefix, "rebar3"}
16
+ ]}.
17
+
18
+ %% eunit:test(Tests)
19
+ {eunit_tests, []}.
20
+ %% Options for eunit:test(Tests, Opts)
21
+ {eunit_opts, [verbose]}.
22
+
23
+ %% == xref ==
24
+
25
+ {xref_warnings, true}.
26
+
27
+ %% xref checks to run
28
+ {xref_checks, [undefined_function_calls, undefined_functions,
29
+ locals_not_used, exports_not_used,
30
+ deprecated_function_calls, deprecated_functions]}.
@@ -0,0 +1,19 @@
1
+ -module(example).
2
+
3
+ -export([commands/1, test_version/0]).
4
+
5
+ commands(N) when N band 2#10000=:=2#10000 ->
6
+ commands(N, [2#1000, 2#0100, 2#0010, 2#0001]);
7
+
8
+ commands(N) ->
9
+ commands(N, [2#0001, 2#0010, 2#0100, 2#1000]).
10
+
11
+ commands(N, Bits) ->
12
+ [action(X) || X <- Bits, N band X=:=X].
13
+
14
+ action(2#0001) -> "wink";
15
+ action(2#0010) -> "double blink";
16
+ action(2#0100) -> "close your eyes";
17
+ action(2#1000) -> "jump".
18
+
19
+ test_version() -> 1.
@@ -0,0 +1,9 @@
1
+ {application, secret_handshake,
2
+ [{description, "exercism.io - secret-handshake"},
3
+ {vsn, "0.0.1"},
4
+ {modules, []},
5
+ {registered, []},
6
+ {applications, [kernel,
7
+ stdlib]},
8
+ {env, []}
9
+ ]}.
@@ -0,0 +1,8 @@
1
+ -module(secret_handshake).
2
+
3
+ -export([commands/1, test_version/0]).
4
+
5
+ commands(N) ->
6
+ undefined.
7
+
8
+ test_version() -> 1.
@@ -0,0 +1,45 @@
1
+ %% based on canonical data version 1.2.0
2
+ %% https://raw.githubusercontent.com/exercism/problem-specifications/master/exercises/secret-handshake/canonical-data.json
3
+
4
+ -module(secret_handshake_tests).
5
+
6
+ -define(TESTED_MODULE, (sut(secret_handshake))).
7
+ -define(TEST_VERSION, 1).
8
+ -include_lib("erl_exercism/include/exercism.hrl").
9
+ -include_lib("eunit/include/eunit.hrl").
10
+
11
+ wink_for_1_test() ->
12
+ ?assertMatch(["wink"], secret_handshake:commands(1)).
13
+
14
+ double_blink_for_10_test() ->
15
+ ?assertMatch(["double blink"], secret_handshake:commands(2)).
16
+
17
+ close_your_eyes_for_100_test() ->
18
+ ?assertMatch(["close your eyes"], secret_handshake:commands(4)).
19
+
20
+ jump_for_1000_test() ->
21
+ ?assertMatch(["jump"], secret_handshake:commands(8)).
22
+
23
+ combine_two_actions_test() ->
24
+ ?assertMatch(["wink", "double blink"], secret_handshake:commands(3)).
25
+
26
+ reverse_two_actions_test() ->
27
+ ?assertMatch(["double blink", "wink"], secret_handshake:commands(19)).
28
+
29
+ reversing_one_action_gives_the_same_action_test() ->
30
+ ?assertMatch(["jump"], secret_handshake:commands(24)).
31
+
32
+ reversing_no_actions_gives_no_actions_test() ->
33
+ ?assertMatch([], secret_handshake:commands(16)).
34
+
35
+ all_possible_actions_test() ->
36
+ ?assertMatch(["wink", "double blink", "close your eyes", "jump"], secret_handshake:commands(15)).
37
+
38
+ reverse_all_possible_actions_test() ->
39
+ ?assertMatch(["jump", "close your eyes", "double blink", "wink"], secret_handshake:commands(31)).
40
+
41
+ do_nothing_for_zero_test() ->
42
+ ?assertMatch([], secret_handshake:commands(0)).
43
+
44
+ version_test() ->
45
+ ?assertMatch(?TEST_VERSION, secret_handshake:test_version()).
@@ -19,7 +19,7 @@ sudo: false
19
19
  # it is better citizenship to not test the additional versions.
20
20
  go:
21
21
  - 1.9.x
22
- - 1.x
22
+ - 1.10.x
23
23
  - tip
24
24
 
25
25
  # Travis runs in a 64 bit environment but beginning with Go 1.5, building a
@@ -61,7 +61,7 @@ script:
61
61
  matrix:
62
62
  include:
63
63
  # Keep this in sync with the latest version.
64
- - go: 1.x
64
+ - go: 1.10.x
65
65
  env: STATIC_CHECKERS=1
66
66
  allow_failures:
67
67
  - go: tip
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "language": "Nim",
3
3
  "active": false,
4
- "blurb": "",
4
+ "blurb": "Nim is a system and applications programming language that is statically typed and compiled, designed to be efficient, expressive, and elegant. Being general-purpose it can fill a wide range of uses but has found a niche in game development and systems programming including embedded systems.",
5
5
  "exercises": [
6
6
  {
7
7
  "slug": "hello-world",
8
8
  "uuid": "4817a6c0-6c9f-41ce-b53e-54ee3c0a6e40",
9
9
  "core": true,
10
+ "auto_approve": true,
10
11
  "unlocked_by": null,
11
12
  "difficulty": 1,
12
- "auto_approve": true,
13
13
  "topics": [
14
14
  "conditionals",
15
15
  "optional_values",
@@ -1,2 +1,5 @@
1
1
  proc helloWorld*(name="World"): string =
2
- return "Hello, " & name & "!"
2
+ "Hello, " & name & "!"
3
+
4
+ let greeting = helloWorld("Exercism")
5
+ echo greeting
@@ -1354,6 +1354,18 @@
1354
1354
  "conditionals"
1355
1355
  ]
1356
1356
  },
1357
+ {
1358
+ "slug": "ledger",
1359
+ "uuid": "c2e9d08d-1a58-4d9a-a797-cea265973bd4",
1360
+ "core": false,
1361
+ "unlocked_by": "markdown",
1362
+ "difficulty": 5,
1363
+ "topics": [
1364
+ "globalization",
1365
+ "refactoring",
1366
+ "strings"
1367
+ ]
1368
+ },
1357
1369
  {
1358
1370
  "slug": "accumulate",
1359
1371
  "uuid": "e7351e8e-d3ff-4621-b818-cd55cf05bffd",