trackler 2.2.1.43 → 2.2.1.44
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/lens-person/description.md +1 -1
- data/problem-specifications/exercises/palindrome-products/description.md +5 -12
- data/problem-specifications/exercises/pascals-triangle/canonical-data.json +1 -7
- data/tracks/c/exercises/meetup/src/example.c +64 -60
- data/tracks/c/exercises/meetup/src/example.h +2 -2
- data/tracks/c/exercises/meetup/test/test_meetup.c +4 -4
- data/tracks/cfml/config.json +179 -169
- data/tracks/cfml/exercises/markdown/.meta/HINTS.md +0 -0
- data/tracks/cfml/exercises/markdown/Markdown.cfc +121 -0
- data/tracks/cfml/exercises/markdown/MarkdownTest.cfc +51 -0
- data/tracks/cfml/exercises/markdown/Solution.cfc +204 -0
- data/tracks/cfml/exercises/markdown/SolutionTest.cfc +7 -0
- data/tracks/cfml/exercises/markdown/TestRunner.cfc +103 -0
- data/tracks/cfml/exercises/markdown/box.json +8 -0
- data/tracks/cfml/exercises/markdown/index.cfm +37 -0
- data/tracks/csharp/exercises/dominoes/DominoesTest.cs +40 -45
- data/tracks/csharp/exercises/meetup/MeetupTest.cs +761 -83
- data/tracks/csharp/generators/Exercises/Dominoes.cs +33 -0
- data/tracks/csharp/generators/Exercises/Meetup.cs +46 -0
- data/tracks/csharp/generators/Output/FormattingExtensions.cs +11 -1
- data/tracks/csharp/generators/Output/TypesExtensions.cs +23 -0
- data/tracks/csharp/generators/Output/ValueFormatter.cs +70 -69
- data/tracks/dart/config.json +15 -3
- data/tracks/dart/exercises/word-count/README.md +18 -0
- data/tracks/dart/exercises/word-count/lib/example.dart +26 -0
- data/tracks/dart/exercises/word-count/lib/word_count.dart +3 -0
- data/tracks/dart/exercises/word-count/pubspec.lock +293 -0
- data/tracks/dart/exercises/word-count/pubspec.yaml +3 -0
- data/tracks/dart/exercises/word-count/test/word_count_test.dart +64 -0
- data/tracks/ecmascript/docs/INSTALLATION.md +4 -7
- data/tracks/elixir/exercises/hello-world/README.md +1 -26
- data/tracks/elixir/exercises/hello-world/example.exs +3 -7
- data/tracks/elixir/exercises/hello-world/hello_world.exs +3 -25
- data/tracks/elixir/exercises/hello-world/hello_world_test.exs +2 -13
- data/tracks/elixir/mix.lock +1 -1
- data/tracks/elm/config.json +11 -0
- data/tracks/elm/exercises/pascals-triangle/README.md +51 -0
- data/tracks/elm/exercises/pascals-triangle/Triangle.elm +1 -0
- data/tracks/elm/exercises/pascals-triangle/Triangle.example.elm +23 -0
- data/tracks/elm/exercises/pascals-triangle/elm-package.json +14 -0
- data/tracks/elm/exercises/pascals-triangle/package.json +14 -0
- data/tracks/elm/exercises/pascals-triangle/tests/Tests.elm +34 -0
- data/tracks/elm/exercises/pascals-triangle/tests/elm-package.json +16 -0
- data/tracks/fsharp/exercises/grade-school/GradeSchool.fs +2 -2
- data/tracks/fsharp/exercises/grade-school/GradeSchoolTest.fs +3 -2
- data/tracks/java/CONTRIBUTING.md +34 -0
- data/tracks/java/config.json +42 -6
- data/tracks/java/exercises/largest-series-product/src/main/java/LargestSeriesProductCalculator.java +7 -3
- data/tracks/java/exercises/matrix/src/main/java/Matrix.java +23 -0
- data/tracks/julia/config.json +11 -2
- data/tracks/julia/exercises/grains/README.md +33 -0
- data/tracks/julia/exercises/grains/example.jl +23 -0
- data/tracks/julia/exercises/grains/grains.jl +9 -0
- data/tracks/julia/exercises/grains/runtests.jl +27 -0
- data/tracks/lua/README.md +1 -1
- data/tracks/mips/exercises/octal/README.md +3 -8
- data/tracks/ocaml/exercises/palindrome-products/README.md +8 -14
- data/tracks/perl6/.travis.yml +7 -3
- data/tracks/perl6/bin/exercise-gen.pl6 +5 -1
- data/tracks/perl6/exercises/accumulate/README.md +0 -3
- data/tracks/perl6/exercises/accumulate/accumulate.t +9 -3
- data/tracks/perl6/exercises/all-your-base/README.md +1 -1
- data/tracks/perl6/exercises/all-your-base/all-your-base.t +23 -11
- data/tracks/perl6/exercises/all-your-base/example.yaml +1 -1
- data/tracks/perl6/exercises/allergies/README.md +0 -1
- data/tracks/perl6/exercises/allergies/allergies.t +22 -10
- data/tracks/perl6/exercises/anagram/anagram.t +22 -10
- data/tracks/perl6/exercises/atbash-cipher/README.md +2 -1
- data/tracks/perl6/exercises/atbash-cipher/atbash-cipher.t +22 -10
- data/tracks/perl6/exercises/binary/README.md +2 -0
- data/tracks/perl6/exercises/bob/bob.t +24 -11
- data/tracks/perl6/exercises/bob/example.yaml +2 -2
- data/tracks/perl6/exercises/clock/clock.t +22 -10
- data/tracks/perl6/exercises/flatten-array/README.md +1 -2
- data/tracks/perl6/exercises/flatten-array/example.yaml +1 -1
- data/tracks/perl6/exercises/flatten-array/flatten-array.t +23 -11
- data/tracks/perl6/exercises/grade-school/README.md +0 -1
- data/tracks/perl6/exercises/grade-school/grade-school.t +9 -3
- data/tracks/perl6/exercises/grains/README.md +0 -1
- data/tracks/perl6/exercises/grains/grains.t +22 -10
- data/tracks/perl6/exercises/hello-world/example.yaml +3 -3
- data/tracks/perl6/exercises/hello-world/hello-world.t +25 -12
- data/tracks/perl6/exercises/leap/README.md +1 -1
- data/tracks/perl6/exercises/leap/example.yaml +1 -1
- data/tracks/perl6/exercises/leap/leap.t +23 -11
- data/tracks/perl6/exercises/linked-list/README.md +10 -10
- data/tracks/perl6/exercises/linked-list/linked-list.t +9 -3
- data/tracks/perl6/exercises/luhn/README.md +7 -7
- data/tracks/perl6/exercises/luhn/luhn.t +22 -10
- data/tracks/perl6/exercises/phone-number/README.md +3 -2
- data/tracks/perl6/exercises/phone-number/phone-number.t +22 -10
- data/tracks/perl6/exercises/raindrops/raindrops.t +22 -10
- data/tracks/perl6/exercises/rna-transcription/rna-transcription.t +22 -10
- data/tracks/perl6/exercises/robot-name/robot-name.t +9 -3
- data/tracks/perl6/exercises/scrabble-score/README.md +3 -1
- data/tracks/perl6/exercises/scrabble-score/scrabble-score.t +22 -10
- data/tracks/perl6/exercises/space-age/README.md +2 -1
- data/tracks/perl6/exercises/space-age/space-age.t +22 -10
- data/tracks/perl6/exercises/trinary/README.md +1 -1
- data/tracks/perl6/exercises/word-count/README.md +1 -2
- data/tracks/perl6/exercises/word-count/word-count.t +22 -10
- data/tracks/perl6/exercises/wordy/README.md +0 -5
- data/tracks/perl6/exercises/wordy/wordy.t +22 -10
- data/tracks/perl6/templates/test.mustache +26 -15
- data/tracks/python/config.json +10 -0
- data/tracks/python/exercises/book-store/book_store.py +1 -1
- data/tracks/python/exercises/flatten-array/flatten_array.py +1 -1
- data/tracks/python/exercises/matrix/matrix.py +1 -1
- data/tracks/python/exercises/palindrome-products/palindrome_products.py +2 -2
- data/tracks/python/exercises/perfect-numbers/perfect_numbers.py +2 -2
- data/tracks/python/exercises/pythagorean-triplet/pythagorean_triplet.py +3 -3
- data/tracks/python/exercises/raindrops/raindrops.py +1 -1
- data/tracks/python/exercises/scale-generator/scale_generator.py +1 -1
- data/tracks/python/exercises/sieve/sieve.py +1 -1
- data/tracks/python/exercises/sublist/sublist.py +1 -1
- data/tracks/python/exercises/transpose/transpose.py +1 -1
- data/tracks/python/exercises/triangle/triangle.py +4 -1
- data/tracks/python/exercises/two-bucket/example.py +59 -0
- data/tracks/python/exercises/two-bucket/two_bucket.py +2 -0
- data/tracks/python/exercises/two-bucket/two_bucket_test.py +32 -0
- data/tracks/scheme/config.json +59 -89
- data/tracks/scheme/config/maintainers.json +11 -11
- data/tracks/sml/exercises/allergies/README.md +20 -5
- data/tracks/sml/exercises/allergies/allergies.sml +11 -14
- data/tracks/sml/exercises/allergies/example.sml +9 -9
- data/tracks/sml/exercises/allergies/test.sml +65 -129
- data/tracks/sml/exercises/allergies/testlib.sml +159 -0
- data/tracks/sml/exercises/hamming/README.md +21 -5
- data/tracks/sml/exercises/hamming/example.sml +14 -10
- data/tracks/sml/exercises/hamming/hamming.sml +4 -3
- data/tracks/sml/exercises/hamming/test.sml +55 -64
- data/tracks/sml/exercises/hamming/testlib.sml +159 -0
- data/tracks/typescript/config.json +15 -0
- data/tracks/typescript/exercises/linked-list/linked-list.test.ts +11 -11
- data/tracks/typescript/exercises/nth-prime/README.md +36 -0
- data/tracks/typescript/exercises/nth-prime/nth-prime.example.ts +28 -0
- data/tracks/typescript/exercises/nth-prime/nth-prime.test.ts +25 -0
- data/tracks/typescript/exercises/nth-prime/nth-prime.ts +0 -0
- data/tracks/typescript/exercises/nth-prime/package.json +36 -0
- data/tracks/typescript/exercises/nth-prime/tsconfig.json +22 -0
- data/tracks/typescript/exercises/nth-prime/tslint.json +127 -0
- data/tracks/typescript/exercises/nth-prime/yarn.lock +2305 -0
- data/tracks/typescript/exercises/prime-factors/README.md +1 -1
- data/tracks/typescript/exercises/prime-factors/prime-factors.test.ts +11 -11
- data/tracks/typescript/exercises/series/README.md +1 -1
- data/tracks/typescript/exercises/series/series.test.ts +11 -11
- data/tracks/typescript/img/icon.png +0 -0
- data/tracks/typescript/img/icon.svg +3 -8
- metadata +44 -2
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import 'package:test/test.dart';
|
|
2
|
+
import 'package:word_count/word_count.dart';
|
|
3
|
+
|
|
4
|
+
final WordCount myWordCounter = new WordCount();
|
|
5
|
+
|
|
6
|
+
void main() {
|
|
7
|
+
group("WordCount: Simple Tests - ", simpleTests);
|
|
8
|
+
group("WordCount: Ignore special characters - ", ignoreSpecialCharacters);
|
|
9
|
+
group("WordCount: Works with numbers too - ", notJustWords);
|
|
10
|
+
group("WordCount: Edge case - ", edgeCases);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
void simpleTests() {
|
|
14
|
+
test("count one word", () {
|
|
15
|
+
Map<String, int> test = myWordCounter.countWords("word");
|
|
16
|
+
expect(test, equals({"word": 1}));
|
|
17
|
+
}, skip: false);
|
|
18
|
+
test("count one of each word", () {
|
|
19
|
+
Map<String, int> test = myWordCounter.countWords("one of each");
|
|
20
|
+
expect(test, equals({"one": 1, "of": 1, "each": 1}));
|
|
21
|
+
}, skip: true);
|
|
22
|
+
test("multiple occurrences of a word", () {
|
|
23
|
+
Map<String, int> test = myWordCounter.countWords("one fish two fish red fish blue fish");
|
|
24
|
+
expect(test, equals({"one": 1, "fish": 4, "two": 1, "red": 1, "blue": 1}));
|
|
25
|
+
}, skip: true);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
void ignoreSpecialCharacters() {
|
|
29
|
+
test("handles cramped lists", () {
|
|
30
|
+
Map<String, int> test = myWordCounter.countWords("one,two,three");
|
|
31
|
+
expect(test, equals({"one": 1, "two": 1, "three": 1}));
|
|
32
|
+
}, skip: true);
|
|
33
|
+
test("handles expanded lists", () {
|
|
34
|
+
Map<String, int> test = myWordCounter.countWords("one,\ntwo,\nthree");
|
|
35
|
+
expect(test, equals({"one": 1, "two": 1, "three": 1}));
|
|
36
|
+
}, skip: true);
|
|
37
|
+
test("ignore punctuation", () {
|
|
38
|
+
Map<String, int> test = myWordCounter.countWords('car: carpet as java: javascript!!&@\$%^&');
|
|
39
|
+
expect(test, equals({"car": 1, "carpet": 1, "as": 1, "java": 1, "javascript": 1}));
|
|
40
|
+
}, skip: true);
|
|
41
|
+
|
|
42
|
+
test("with quotations", () {
|
|
43
|
+
Map<String, int> test = myWordCounter.countWords("Joe can't tell between 'large' and large.");
|
|
44
|
+
expect(test, equals({"joe": 1, "can't": 1, "tell": 1, "between": 1, "large": 2, "and": 1}));
|
|
45
|
+
}, skip: true);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
void notJustWords() {
|
|
49
|
+
test("include numbers", () {
|
|
50
|
+
Map<String, int> test = myWordCounter.countWords("testing, 1, 2 testing");
|
|
51
|
+
expect(test, equals({"testing": 2, "1": 1, "2": 1}));
|
|
52
|
+
}, skip: true);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
void edgeCases() {
|
|
56
|
+
test("normalize case", () {
|
|
57
|
+
Map<String, int> test = myWordCounter.countWords("go Go GO Stop stop");
|
|
58
|
+
expect(test, equals({"go": 3, "stop": 2}));
|
|
59
|
+
}, skip: true);
|
|
60
|
+
test("with apostrophes", () {
|
|
61
|
+
Map<String, int> test = myWordCounter.countWords("First: don't laugh. Then: don't cry.");
|
|
62
|
+
expect(test, equals({"first": 1, "don't": 2, "laugh": 1, "then": 1, "cry": 1}));
|
|
63
|
+
}, skip: true);
|
|
64
|
+
}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
There are a couple of ways to install [NodeJS](http://nodejs.org):
|
|
2
2
|
|
|
3
|
-
*
|
|
4
|
-
[
|
|
5
|
-
* **Linux users**: can install it
|
|
6
|
-
[via package manager](https://nodejs.org/en/download/package-manager/)
|
|
7
|
-
|
|
8
|
-
[linstall]: https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager
|
|
3
|
+
* via an [Installer or Binaries](https://nodejs.org/en/download/)
|
|
4
|
+
* via [package managers](https://nodejs.org/en/download/package-manager/)
|
|
9
5
|
|
|
6
|
+
Both options have selections for Windows, MacOS, and Linux.
|
|
10
7
|
|
|
11
8
|
If you've used the official installer, your `PATH` should have been automatically
|
|
12
9
|
configured, but if your shell has trouble locating your globally installed
|
|
@@ -19,32 +19,7 @@ If everything goes well, you will be ready to fetch your first real exercise.
|
|
|
19
19
|
Execute the tests with:
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
|
-
$ elixir
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
(Replace `bob_test.exs` with the name of the test file.)
|
|
26
|
-
|
|
27
|
-
### Pending tests
|
|
28
|
-
|
|
29
|
-
In the test suites, all but the first test have been skipped.
|
|
30
|
-
|
|
31
|
-
Once you get a test passing, you can unskip the next one by
|
|
32
|
-
commenting out the relevant `@tag :pending` with a `#` symbol.
|
|
33
|
-
|
|
34
|
-
For example:
|
|
35
|
-
|
|
36
|
-
```elixir
|
|
37
|
-
# @tag :pending
|
|
38
|
-
test "shouting" do
|
|
39
|
-
assert Bob.hey("WATCH OUT!") == "Whoa, chill out!"
|
|
40
|
-
end
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
Or, you can enable all the tests by commenting out the
|
|
44
|
-
`ExUnit.configure` line in the test suite.
|
|
45
|
-
|
|
46
|
-
```elixir
|
|
47
|
-
# ExUnit.configure exclude: :pending, trace: true
|
|
22
|
+
$ elixir hello_world_test.exs
|
|
48
23
|
```
|
|
49
24
|
|
|
50
25
|
For more detailed information about the Elixir track, please
|
|
@@ -1,31 +1,9 @@
|
|
|
1
1
|
defmodule HelloWorld do
|
|
2
|
-
@moduledoc """
|
|
3
|
-
Elixir counts the number of arguments as part of the function name.
|
|
4
|
-
For instance;
|
|
5
|
-
|
|
6
|
-
def hello() do
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
would be a completely different function from
|
|
10
|
-
|
|
11
|
-
def hello(name) do
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
Can you find a way to make all the tests pass with just one
|
|
15
|
-
function?
|
|
16
|
-
|
|
17
|
-
Hint: look into argument defaults here:
|
|
18
|
-
http://elixir-lang.org/getting-started/modules-and-functions.html#default-arguments
|
|
19
|
-
"""
|
|
20
|
-
|
|
21
2
|
@doc """
|
|
22
|
-
|
|
23
|
-
if no name is given.
|
|
3
|
+
Simply returns "Hello, world!"
|
|
24
4
|
"""
|
|
25
|
-
@spec hello
|
|
26
|
-
def hello
|
|
27
|
-
|
|
5
|
+
@spec hello :: String.t
|
|
6
|
+
def hello do
|
|
28
7
|
"Your implementation goes here"
|
|
29
|
-
|
|
30
8
|
end
|
|
31
9
|
end
|
|
@@ -3,23 +3,12 @@ if !System.get_env("EXERCISM_TEST_EXAMPLES") do
|
|
|
3
3
|
end
|
|
4
4
|
|
|
5
5
|
ExUnit.start
|
|
6
|
-
ExUnit.configure
|
|
6
|
+
ExUnit.configure trace: true
|
|
7
7
|
|
|
8
8
|
defmodule HelloWorldTest do
|
|
9
9
|
use ExUnit.Case
|
|
10
10
|
|
|
11
|
-
test "says
|
|
11
|
+
test "says 'Hello, World!'" do
|
|
12
12
|
assert HelloWorld.hello() == "Hello, World!"
|
|
13
13
|
end
|
|
14
|
-
|
|
15
|
-
@tag :pending
|
|
16
|
-
test "says hello sample name" do
|
|
17
|
-
assert HelloWorld.hello("Alice") == "Hello, Alice!"
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
@tag :pending
|
|
21
|
-
test "says hello other sample name" do
|
|
22
|
-
assert HelloWorld.hello("Bob") == "Hello, Bob!"
|
|
23
|
-
end
|
|
24
|
-
|
|
25
14
|
end
|
data/tracks/elixir/mix.lock
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
%{"poison": {:hex, :poison, "1.4.0"}}
|
|
1
|
+
%{"poison": {:hex, :poison, "1.4.0", "cd5afb9db7f0d19487572fa28185b6d4de647f14235746824e77b3139b79b725", [], [], "hexpm"}}
|
data/tracks/elm/config.json
CHANGED
|
@@ -321,6 +321,17 @@
|
|
|
321
321
|
"topics": [
|
|
322
322
|
|
|
323
323
|
]
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
"uuid": "a730ca85-057d-db80-e44e-25b8028acede6337cca",
|
|
327
|
+
"slug": "pascals-triangle",
|
|
328
|
+
"core": false,
|
|
329
|
+
"unlocked_by": null,
|
|
330
|
+
"difficulty": 4,
|
|
331
|
+
"topics": [
|
|
332
|
+
"Lists",
|
|
333
|
+
"Control-flow"
|
|
334
|
+
]
|
|
324
335
|
}
|
|
325
336
|
],
|
|
326
337
|
"foregone": [
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Pascals Triangle
|
|
2
|
+
|
|
3
|
+
Compute Pascal's triangle up to a given number of rows.
|
|
4
|
+
|
|
5
|
+
In Pascal's Triangle each number is computed by adding the numbers to
|
|
6
|
+
the right and left of the current position in the previous row.
|
|
7
|
+
|
|
8
|
+
```text
|
|
9
|
+
1
|
|
10
|
+
1 1
|
|
11
|
+
1 2 1
|
|
12
|
+
1 3 3 1
|
|
13
|
+
1 4 6 4 1
|
|
14
|
+
# ... etc
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Elm Installation
|
|
18
|
+
|
|
19
|
+
Refer to the [Exercism help page](http://exercism.io/languages/elm) for Elm
|
|
20
|
+
installation and learning resources.
|
|
21
|
+
|
|
22
|
+
## Writing the Code
|
|
23
|
+
|
|
24
|
+
The first time you start an exercise, you'll need to ensure you have the
|
|
25
|
+
appropriate dependencies installed.
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
$ npm install
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Execute the tests with:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
$ npm test
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Automatically run tests again when you save changes:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
$ npm run watch
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
As you work your way through the test suite, be sure to remove the `skip <|`
|
|
44
|
+
calls from each test until you get them all passing!
|
|
45
|
+
|
|
46
|
+
## Source
|
|
47
|
+
|
|
48
|
+
Pascal's Triangle at Wolfram Math World [http://mathworld.wolfram.com/PascalsTriangle.html](http://mathworld.wolfram.com/PascalsTriangle.html)
|
|
49
|
+
|
|
50
|
+
## Submitting Incomplete Solutions
|
|
51
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module Triangle exposing (..)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module Triangle exposing (rows)
|
|
2
|
+
|
|
3
|
+
import List
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
nextRow : List Int -> List Int
|
|
7
|
+
nextRow row =
|
|
8
|
+
List.map2 (+) (0 :: row) (row ++ [ 0 ])
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
rows : Int -> List (List Int)
|
|
12
|
+
rows n =
|
|
13
|
+
let
|
|
14
|
+
loop i row =
|
|
15
|
+
if i == n then
|
|
16
|
+
[]
|
|
17
|
+
else
|
|
18
|
+
row :: loop (i + 1) (nextRow row)
|
|
19
|
+
in
|
|
20
|
+
if n < 0 then
|
|
21
|
+
[]
|
|
22
|
+
else
|
|
23
|
+
loop 0 [ 1 ]
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "3.0.0",
|
|
3
|
+
"summary": "Exercism problems in Elm.",
|
|
4
|
+
"repository": "https://github.com/exercism/elm.git",
|
|
5
|
+
"license": "BSD3",
|
|
6
|
+
"source-directories": [
|
|
7
|
+
"."
|
|
8
|
+
],
|
|
9
|
+
"exposed-modules": [],
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"elm-lang/core": "5.0.0 <= v < 6.0.0"
|
|
12
|
+
},
|
|
13
|
+
"elm-version": "0.18.0 <= v < 0.19.0"
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Exercism/Elm",
|
|
3
|
+
"repository": "https://github.com/exercism/elm.git",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"postinstall": "elm-package install -y",
|
|
7
|
+
"watch": "elm-test --watch",
|
|
8
|
+
"test": "elm-test"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"elm": "0.18.0",
|
|
12
|
+
"elm-test": "0.18.3"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
module Tests exposing (..)
|
|
2
|
+
|
|
3
|
+
import Expect
|
|
4
|
+
import Test exposing (..)
|
|
5
|
+
import Triangle exposing (rows)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
tests : Test
|
|
9
|
+
tests =
|
|
10
|
+
describe "Triangle"
|
|
11
|
+
[ test "no rows" <|
|
|
12
|
+
\() ->
|
|
13
|
+
Expect.equal [] (rows 0)
|
|
14
|
+
, skip <|
|
|
15
|
+
test "single row" <|
|
|
16
|
+
\() ->
|
|
17
|
+
Expect.equal [ [ 1 ] ] (rows 1)
|
|
18
|
+
, skip <|
|
|
19
|
+
test "two rows" <|
|
|
20
|
+
\() ->
|
|
21
|
+
Expect.equal [ [ 1 ], [ 1, 1 ] ] (rows 2)
|
|
22
|
+
, skip <|
|
|
23
|
+
test "three rows" <|
|
|
24
|
+
\() ->
|
|
25
|
+
Expect.equal [ [ 1 ], [ 1, 1 ], [ 1, 2, 1 ] ] (rows 3)
|
|
26
|
+
, skip <|
|
|
27
|
+
test "four rows" <|
|
|
28
|
+
\() ->
|
|
29
|
+
Expect.equal [ [ 1 ], [ 1, 1 ], [ 1, 2, 1 ], [ 1, 3, 3, 1 ] ] (rows 4)
|
|
30
|
+
, skip <|
|
|
31
|
+
test "negative rows" <|
|
|
32
|
+
\() ->
|
|
33
|
+
Expect.equal [] (rows -1)
|
|
34
|
+
]
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "3.0.0",
|
|
3
|
+
"summary": "Exercism problems in Elm.",
|
|
4
|
+
"repository": "https://github.com/exercism/elm.git",
|
|
5
|
+
"license": "BSD3",
|
|
6
|
+
"source-directories": [
|
|
7
|
+
".",
|
|
8
|
+
".."
|
|
9
|
+
],
|
|
10
|
+
"exposed-modules": [],
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"elm-lang/core": "5.0.0 <= v < 6.0.0",
|
|
13
|
+
"elm-community/elm-test": "4.0.0 <= v < 5.0.0"
|
|
14
|
+
},
|
|
15
|
+
"elm-version": "0.18.0 <= v < 0.19.0"
|
|
16
|
+
}
|
|
@@ -4,6 +4,6 @@ let empty: Map<int, string list> = failwith "You need to implement this function
|
|
|
4
4
|
|
|
5
5
|
let add (student: string) (grade: int) (school: Map<int, string list>): Map<int, string list> = failwith "You need to implement this function."
|
|
6
6
|
|
|
7
|
-
let roster (school: Map<int, string list>):
|
|
7
|
+
let roster (school: Map<int, string list>): (int * string list) list = failwith "You need to implement this function."
|
|
8
8
|
|
|
9
|
-
let grade (number: int) (school: Map<int, string list>): string list = failwith "You need to implement this function."
|
|
9
|
+
let grade (number: int) (school: Map<int, string list>): string list = failwith "You need to implement this function."
|
|
@@ -57,10 +57,11 @@ let ``Student names and grades in roster are sorted`` () =
|
|
|
57
57
|
|> add "Kareem" 6
|
|
58
58
|
|> add "Christopher" 4
|
|
59
59
|
|> add "Kyle" 3
|
|
60
|
+
|> add "Zoe" 4
|
|
60
61
|
|
|
61
62
|
let expected =
|
|
62
63
|
[(3, ["Kyle"]);
|
|
63
|
-
(4, ["Christopher"; "Jennifer"]);
|
|
64
|
+
(4, ["Christopher"; "Jennifer"; "Zoe"]);
|
|
64
65
|
(6, ["Kareem"])]
|
|
65
66
|
|
|
66
|
-
roster school |> should equal expected
|
|
67
|
+
roster school |> should equal expected
|
data/tracks/java/CONTRIBUTING.md
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* [The Problem Submodules](#the-problem-submodules)
|
|
9
9
|
* [Advanced: Complete Local Setup](#advanced-complete-local-setup)
|
|
10
10
|
* [Tip: `gradle clean` before `exercism fetch`](#tip-gradle-clean-before-exercism-fetch)
|
|
11
|
+
* [Adding a New Exercise](#adding-a-new-exercise)
|
|
11
12
|
|
|
12
13
|
## Overview
|
|
13
14
|
|
|
@@ -15,6 +16,7 @@ This guide covers contributing to the Java track. If you are new, this guide is
|
|
|
15
16
|
|
|
16
17
|
If, at any point, you're having any trouble, pop in the [Gitter exercism/java room](https://gitter.im/exercism/java) or the [Gitter exercism/dev room](https://gitter.im/exercism/dev) for help.
|
|
17
18
|
|
|
19
|
+
For general guidelines about contributing to Exercism see the [Exercism contributing guide](https://github.com/exercism/docs/tree/master/contributing-to-language-tracks).
|
|
18
20
|
|
|
19
21
|
## Before Making Your Pull Request
|
|
20
22
|
|
|
@@ -132,3 +134,35 @@ gradle clean
|
|
|
132
134
|
cd ~/workspace/exercism/exercises
|
|
133
135
|
exercism fetch java bob
|
|
134
136
|
```
|
|
137
|
+
|
|
138
|
+
## Adding a New Exercise
|
|
139
|
+
|
|
140
|
+
The easiest way to add a new exercise to the Java track is to port an exercise from another track.
|
|
141
|
+
That means that you take an exercise that has already been implemented in another language and you implement it in this track.
|
|
142
|
+
|
|
143
|
+
To add a completely new exercise you need to open a pull request to the [problem specifications repository](https://github.com/exercism/problem-specifications/tree/master/exercises).
|
|
144
|
+
Any completely new exercise needs to be added and accepted there before it can be added to the Java track.
|
|
145
|
+
|
|
146
|
+
There is a [general Exercism guide for porting an exercise to a new language](https://github.com/exercism/docs/blob/master/you-can-help/implement-an-exercise-from-specification.md).
|
|
147
|
+
Please review this before porting an exercise to the Java track.
|
|
148
|
+
|
|
149
|
+
See [here](http://exercism.io/languages/java/todo) for a list of exercises that have yet to be implemented on the Java track and can therefore be ported to this track.
|
|
150
|
+
Please make sure no one else has a pull request open to implement your chosen exercise before you start.
|
|
151
|
+
Also please make a [dibs pull request](https://github.com/exercism/docs/blob/master/you-can-help/implement-an-exercise-from-specification.md#avoiding-duplicate-work) to make it clear to others that you are working on this exercise.
|
|
152
|
+
|
|
153
|
+
The Java specific details you need to know about adding an exercise are:
|
|
154
|
+
|
|
155
|
+
1. Please add an entry to the `exercises` array in `config.json`. You can find details about what should be in that entry [here](https://github.com/exercism/docs/blob/master/language-tracks/configuration/exercises.md).
|
|
156
|
+
You can also look at other entries in `config.json` as examples and try to mimic them.
|
|
157
|
+
|
|
158
|
+
2. Please add an entry for your exercise to `settings.gradle`.
|
|
159
|
+
This should just be `include 'exercise-name'`.
|
|
160
|
+
This list is in alphabetical order so please add your exercise so that it maintains this order.
|
|
161
|
+
|
|
162
|
+
3. Please add an exercise submodule for your exercise.
|
|
163
|
+
See [The Problem Submodules](#the-problem-submodules) section for what needs to be in this.
|
|
164
|
+
The `build.gradle` file can just be copied from any other exercise submodule.
|
|
165
|
+
See the [POLICIES doc](https://github.com/exercism/java/blob/master/POLICIES.md#starter-implementations) for an explanation of when you need to add a starter implementation.
|
|
166
|
+
|
|
167
|
+
Hopefully that should be enough information to help you port an exercise to the Java track.
|
|
168
|
+
Feel free to open an issue or post in the [Gitter exercism/java room](https://gitter.im/exercism/java) if you have any questions and we'll try and answer as soon as we can.
|