trackler 2.2.1.43 → 2.2.1.44
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/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
data/tracks/java/config.json
CHANGED
@@ -199,7 +199,14 @@
|
|
199
199
|
"core": true,
|
200
200
|
"difficulty": 4,
|
201
201
|
"slug": "matrix",
|
202
|
-
"topics":
|
202
|
+
"topics": [
|
203
|
+
"loops",
|
204
|
+
"arrays",
|
205
|
+
"pattern_matching",
|
206
|
+
"integers",
|
207
|
+
"strings",
|
208
|
+
"type_conversion"
|
209
|
+
],
|
203
210
|
"unlocked_by": null,
|
204
211
|
"uuid": "c1d4e0b4-6a0f-4be9-8222-345966621f53"
|
205
212
|
},
|
@@ -229,7 +236,13 @@
|
|
229
236
|
"core": false,
|
230
237
|
"difficulty": 4,
|
231
238
|
"slug": "sieve",
|
232
|
-
"topics":
|
239
|
+
"topics": [
|
240
|
+
"loops",
|
241
|
+
"lists",
|
242
|
+
"integers",
|
243
|
+
"algorithms",
|
244
|
+
"mathematics"
|
245
|
+
],
|
233
246
|
"unlocked_by": "difference-of-squares",
|
234
247
|
"uuid": "6791d01f-bae4-4b63-ae76-86529ac49e36"
|
235
248
|
},
|
@@ -274,7 +287,13 @@
|
|
274
287
|
"core": false,
|
275
288
|
"difficulty": 4,
|
276
289
|
"slug": "collatz-conjecture",
|
277
|
-
"topics":
|
290
|
+
"topics": [
|
291
|
+
"exception_handling",
|
292
|
+
"recursion",
|
293
|
+
"conditionals",
|
294
|
+
"integers",
|
295
|
+
"mathematics"
|
296
|
+
],
|
278
297
|
"unlocked_by": "triangle",
|
279
298
|
"uuid": "1500d39a-c9d9-4d3a-9e77-fdc1837fc6ad"
|
280
299
|
},
|
@@ -282,7 +301,13 @@
|
|
282
301
|
"core": false,
|
283
302
|
"difficulty": 4,
|
284
303
|
"slug": "nth-prime",
|
285
|
-
"topics":
|
304
|
+
"topics": [
|
305
|
+
"arrays",
|
306
|
+
"exception_handling",
|
307
|
+
"lists",
|
308
|
+
"loops",
|
309
|
+
"integers"
|
310
|
+
],
|
286
311
|
"unlocked_by": "triangle",
|
287
312
|
"uuid": "2c69db99-648d-4bd7-8012-1fbdeff6ca0a"
|
288
313
|
},
|
@@ -399,7 +424,14 @@
|
|
399
424
|
"core": false,
|
400
425
|
"difficulty": 5,
|
401
426
|
"slug": "prime-factors",
|
402
|
-
"topics":
|
427
|
+
"topics": [
|
428
|
+
"arrays",
|
429
|
+
"conditionals",
|
430
|
+
"integers",
|
431
|
+
"lists",
|
432
|
+
"loops",
|
433
|
+
"mathematics"
|
434
|
+
],
|
403
435
|
"unlocked_by": "triangle",
|
404
436
|
"uuid": "599c08ec-7338-46ed-99f8-a76f78f724e6"
|
405
437
|
},
|
@@ -796,7 +828,11 @@
|
|
796
828
|
"core": false,
|
797
829
|
"difficulty": 8,
|
798
830
|
"slug": "complex-numbers",
|
799
|
-
"topics":
|
831
|
+
"topics": [
|
832
|
+
"mathematics",
|
833
|
+
"floating_point_numbers",
|
834
|
+
"classes"
|
835
|
+
],
|
800
836
|
"unlocked_by": "triangle",
|
801
837
|
"uuid": "52d11278-0d65-4b5b-b387-1374fced3243"
|
802
838
|
},
|
data/tracks/java/exercises/largest-series-product/src/main/java/LargestSeriesProductCalculator.java
CHANGED
@@ -1,5 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
class LargestSeriesProductCalculator {
|
2
|
+
LargestSeriesProductCalculator(String inputNumber) {
|
3
|
+
throw new UnsupportedOperationException ("Delete this statement and write your own implementation.");
|
4
|
+
}
|
4
5
|
|
6
|
+
long calculateLargestProductForSeriesLength(int numberOfDigits) {
|
7
|
+
throw new UnsupportedOperationException ("Delete this statement and write your own implementation.");
|
8
|
+
}
|
5
9
|
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
class Matrix {
|
3
|
+
|
4
|
+
Matrix(String matrixAsString) {
|
5
|
+
throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
|
6
|
+
}
|
7
|
+
|
8
|
+
int[] getRow(int rowNumber) {
|
9
|
+
throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
|
10
|
+
}
|
11
|
+
|
12
|
+
int[] getColumn(int columnNumber) {
|
13
|
+
throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
|
14
|
+
}
|
15
|
+
|
16
|
+
int getRowsCount() {
|
17
|
+
throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
|
18
|
+
}
|
19
|
+
|
20
|
+
int getColumnsCount() {
|
21
|
+
throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
|
22
|
+
}
|
23
|
+
}
|
data/tracks/julia/config.json
CHANGED
@@ -2,8 +2,7 @@
|
|
2
2
|
"language": "Julia",
|
3
3
|
"active": true,
|
4
4
|
"blurb": "Julia is an open-source high-level, dynamic programming language whose sweet spot is technical and scientific computing. It is convenient for day-to-day work and fast enough for high performance computing.",
|
5
|
-
"exercises": [
|
6
|
-
{
|
5
|
+
"exercises": [{
|
7
6
|
"uuid": "a668410d-41aa-4710-a68f-54521da6486d",
|
8
7
|
"slug": "hello-world",
|
9
8
|
"core": true,
|
@@ -358,6 +357,16 @@
|
|
358
357
|
"mathematics",
|
359
358
|
"iterators"
|
360
359
|
]
|
360
|
+
},
|
361
|
+
{
|
362
|
+
"uuid": "2ed6e171-04e1-b080-f383-a801b2564b3e0f4f1ee",
|
363
|
+
"slug": "grains",
|
364
|
+
"core": false,
|
365
|
+
"unlocked_by": "difference-of-squares",
|
366
|
+
"difficulty": 1,
|
367
|
+
"topics": [
|
368
|
+
"exceptions"
|
369
|
+
]
|
361
370
|
}
|
362
371
|
],
|
363
372
|
"foregone": [
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Grains
|
2
|
+
|
3
|
+
Calculate the number of grains of wheat on a chessboard given that the number
|
4
|
+
on each square doubles.
|
5
|
+
|
6
|
+
There once was a wise servant who saved the life of a prince. The king
|
7
|
+
promised to pay whatever the servant could dream up. Knowing that the
|
8
|
+
king loved chess, the servant told the king he would like to have grains
|
9
|
+
of wheat. One grain on the first square of a chess board. Two grains on
|
10
|
+
the next. Four on the third, and so on.
|
11
|
+
|
12
|
+
There are 64 squares on a chessboard.
|
13
|
+
|
14
|
+
Write code that shows:
|
15
|
+
- how many grains were on each square (`on_square`)
|
16
|
+
- the total number of grains (`total_after`)
|
17
|
+
|
18
|
+
## For bonus points
|
19
|
+
|
20
|
+
Did you get the tests passing and the code clean? If you want to, these
|
21
|
+
are some additional things you could try:
|
22
|
+
|
23
|
+
- Optimize for speed.
|
24
|
+
- Optimize for readability.
|
25
|
+
|
26
|
+
Then please share your thoughts in a comment on the submission. Did this
|
27
|
+
experiment make the code better? Worse? Did you learn anything from it?
|
28
|
+
|
29
|
+
## Source
|
30
|
+
JavaRanch Cattle Drive, exercise 6 [http://www.javaranch.com/grains.jsp](http://www.javaranch.com/grains.jsp)
|
31
|
+
|
32
|
+
## Submitting Incomplete Solutions
|
33
|
+
It's possible to submit an incomplete solution so you can see how others have completed the exercise.
|
@@ -0,0 +1,23 @@
|
|
1
|
+
"""Calculate the number of grains on square `square`."""
|
2
|
+
function on_square(square)
|
3
|
+
check_square_input(square)
|
4
|
+
2 ^ (square - 1)
|
5
|
+
end
|
6
|
+
|
7
|
+
"""Calculate the total number of grains after square `square`."""
|
8
|
+
function total_after(square)
|
9
|
+
check_square_input(square)
|
10
|
+
sum(map(on_square, 1:square))
|
11
|
+
end
|
12
|
+
|
13
|
+
"""Validate an arbitrary square."""
|
14
|
+
function check_square_input(square)
|
15
|
+
square == 0 && throw(DomainError(square, "Square input of zero is invalid."))
|
16
|
+
square < 0 && throw(DomainError(square, "Negative square input is invalid."))
|
17
|
+
square > 64 && throw(DomainError(square, "Square input greater than 64 is invalid."))
|
18
|
+
end
|
19
|
+
|
20
|
+
if VERSION < v"0.7" # backwards compatibility
|
21
|
+
Base.DomainError(val) = DomainError()
|
22
|
+
Base.DomainError(val, msg) = DomainError()
|
23
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
using Base.Test
|
2
|
+
|
3
|
+
include("grains.jl")
|
4
|
+
|
5
|
+
@testset "On squares" begin
|
6
|
+
@testset "On square $s" for s = UInt64(1):64
|
7
|
+
@test on_square(s) == 2^(s-1)
|
8
|
+
@test total_after(s) == 2^s - 1
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
@testset "Invalid values" begin
|
13
|
+
@testset "Zero" begin
|
14
|
+
@test_throws DomainError on_square(0)
|
15
|
+
@test_throws DomainError total_after(0)
|
16
|
+
end
|
17
|
+
|
18
|
+
@testset "Negative" begin
|
19
|
+
@test_throws DomainError on_square(-1)
|
20
|
+
@test_throws DomainError total_after(-1)
|
21
|
+
end
|
22
|
+
|
23
|
+
@testset "Greater than 64" begin
|
24
|
+
@test_throws DomainError on_square(65)
|
25
|
+
@test_throws DomainError total_after(65)
|
26
|
+
end
|
27
|
+
end
|
data/tracks/lua/README.md
CHANGED
@@ -56,7 +56,7 @@ Pleases see the [Useful Lua Resources][8] page.
|
|
56
56
|
## Lua icon
|
57
57
|
The Lua icon is inspired by the [Lua logo][9], which was designed by Alexandre Nakonechnyj.
|
58
58
|
|
59
|
-
[1]: http://exercism.io/languages/lua/
|
59
|
+
[1]: http://exercism.io/languages/lua/installation
|
60
60
|
[2]: https://help.github.com/articles/fork-a-repo/
|
61
61
|
[3]: https://help.github.com/articles/creating-a-pull-request/
|
62
62
|
[4]: https://github.com/exercism/lua/tree/master/exercises/bob
|
@@ -1,15 +1,10 @@
|
|
1
1
|
# Octal
|
2
2
|
|
3
|
-
Convert an octal number, represented as a string (e.g.
|
4
|
-
decimal equivalent using first principles
|
5
|
-
|
6
|
-
|
7
|
-
Implement octal to decimal conversion. Given an octal input
|
8
|
-
string, your program should produce a decimal output.
|
3
|
+
Convert an octal number, represented as a string of ascii values (e.g. "1735263"), to its
|
4
|
+
decimal equivalent using first principles. For instance, given the input "10", your program
|
5
|
+
should return the integer 8.
|
9
6
|
|
10
7
|
## Note
|
11
|
-
- Implement the conversion yourself.
|
12
|
-
Do not use something else to perform the conversion for you.
|
13
8
|
- Treat invalid input as octal 0.
|
14
9
|
|
15
10
|
## About Octal (Base-8)
|
@@ -5,22 +5,16 @@ Detect palindrome products in a given range.
|
|
5
5
|
A palindromic number is a number that remains the same when its digits are
|
6
6
|
reversed. For example, `121` is a palindromic number but `112` is not.
|
7
7
|
|
8
|
-
Given
|
9
|
-
|
10
|
-
`a` and `b` are integers (possibly, but _not_ necessarily palindromic numbers).
|
8
|
+
Given a range of numbers, find the largest and smallest palindromes which
|
9
|
+
are products of numbers within that range.
|
11
10
|
|
12
|
-
|
13
|
-
|
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
|
13
|
+
than one pair of factors within the range, then return all the pairs.
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
Write a program that given a range of integers, returns the smallest and largest
|
20
|
-
palindromic product of factors within that range, along with all the factors in the range for that product.
|
21
|
-
|
22
|
-
Not all ranges of factors can produce a Palindrome, and ranges must have their max at least as large
|
23
|
-
as their min. This exercise uses the OCaml `Result.t` type to specify errors.
|
15
|
+
Not all ranges of factors can produce a Palindrome, and ranges must have their
|
16
|
+
max at least as large as their min. This exercise uses the OCaml `Result.t`
|
17
|
+
type to specify errors.
|
24
18
|
|
25
19
|
## Example 1
|
26
20
|
|
data/tracks/perl6/.travis.yml
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
---
|
2
2
|
sudo: false
|
3
|
-
services:
|
4
|
-
- docker
|
5
3
|
before_script:
|
6
4
|
- git clone https://github.com/exercism/problem-specifications.git
|
7
5
|
- bin/fetch-configlet
|
8
6
|
- docker pull rakudo-star:latest
|
9
7
|
script:
|
10
8
|
- bin/configlet lint .
|
11
|
-
- docker run
|
9
|
+
- docker run
|
10
|
+
--env EXERCISM=1
|
11
|
+
--volume $PWD:/exercism
|
12
|
+
rakudo-star prove /exercism
|
13
|
+
--exec perl6
|
14
|
+
--recurse
|
15
|
+
--jobs 2
|
@@ -6,6 +6,10 @@ use YAMLish;
|
|
6
6
|
my $base-dir = $?FILE.IO.resolve.parent.parent;
|
7
7
|
my @exercises;
|
8
8
|
|
9
|
+
if $base-dir.child('problem-specifications') !~~ :d {
|
10
|
+
warn 'problem-specifications directory not found; some exercises may generate incorrectly.';
|
11
|
+
}
|
12
|
+
|
9
13
|
if @*ARGS {
|
10
14
|
if @*ARGS[0] eq '--all' {
|
11
15
|
push @exercises, .basename for $base-dir.child('exercises').dir;
|
@@ -59,4 +63,4 @@ for @exercises -> $exercise {
|
|
59
63
|
}
|
60
64
|
|
61
65
|
if @dir-not-found {warn 'exercise directory does not exist for: ' ~ join ' ', @dir-not-found}
|
62
|
-
if @yaml-not-found {
|
66
|
+
if @yaml-not-found {note 'example.yaml not found for: ' ~ join ' ', @yaml-not-found}
|
@@ -25,9 +25,6 @@ Keep your hands off that collect/map/fmap/whatchamacallit functionality
|
|
25
25
|
provided by your standard library!
|
26
26
|
Solve this one yourself using other basic tools instead.
|
27
27
|
|
28
|
-
Lisp specific: it's perfectly fine to use `MAPCAR` or the equivalent,
|
29
|
-
as this is idiomatic Lisp, not a library function.
|
30
|
-
|
31
28
|
## Resources
|
32
29
|
|
33
30
|
Remember to check out the Perl 6 [documentation](https://docs.perl6.org/) and
|
@@ -3,9 +3,9 @@ use v6;
|
|
3
3
|
use Test;
|
4
4
|
use lib $?FILE.IO.dirname;
|
5
5
|
|
6
|
-
my $exercise
|
7
|
-
my $version = v1;
|
8
|
-
my $module
|
6
|
+
my Str:D $exercise := 'Accumulate';
|
7
|
+
my Version:D $version = v1;
|
8
|
+
my Str $module //= $exercise;
|
9
9
|
plan 7;
|
10
10
|
|
11
11
|
use-ok $module or bail-out;
|
@@ -40,3 +40,9 @@ is-deeply accumulate(['the', 'quick', 'brown', 'fox'], sub { @_[0].flip }),
|
|
40
40
|
'reverse strings';
|
41
41
|
|
42
42
|
done-testing;
|
43
|
+
|
44
|
+
INIT {
|
45
|
+
if %*ENV<EXERCISM> {
|
46
|
+
$module = 'Example';
|
47
|
+
}
|
48
|
+
}
|
@@ -6,6 +6,7 @@ Implement general base conversion. Given a number in base **a**,
|
|
6
6
|
represented as a sequence of digits, convert it to base **b**.
|
7
7
|
|
8
8
|
## Note
|
9
|
+
|
9
10
|
- Try to implement the conversion yourself.
|
10
11
|
Do not use something else to perform the conversion for you.
|
11
12
|
|
@@ -28,7 +29,6 @@ The number 1120, *in base 3*, means:
|
|
28
29
|
|
29
30
|
I think you got the idea!
|
30
31
|
|
31
|
-
|
32
32
|
*Yes. Those three numbers above are exactly the same. Congratulations!*
|
33
33
|
|
34
34
|
## Resources
|
@@ -4,10 +4,12 @@ use Test;
|
|
4
4
|
use lib my $dir = $?FILE.IO.dirname;
|
5
5
|
use JSON::Fast;
|
6
6
|
|
7
|
-
my $exercise
|
8
|
-
my $version = v2;
|
9
|
-
my $module
|
10
|
-
|
7
|
+
my Str:D $exercise := 'AllYourBase';
|
8
|
+
my Version:D $version = v2;
|
9
|
+
my Str $module //= $exercise;
|
10
|
+
INIT {
|
11
|
+
plan 23;
|
12
|
+
}
|
11
13
|
|
12
14
|
use-ok $module or bail-out;
|
13
15
|
require ::($module);
|
@@ -41,15 +43,9 @@ for @($c-data<cases>) -> $case {
|
|
41
43
|
is-deeply call-convert-base, $expected, $case<description>
|
42
44
|
}
|
43
45
|
|
44
|
-
sub call-convert-base {
|
46
|
+
sub call-convert-base { convert-base(|$case<input_base input_digits output_base>) }
|
45
47
|
}
|
46
48
|
|
47
|
-
if %*ENV<EXERCISM> {
|
48
|
-
if (my $c-data-file = "$dir/../../problem-specifications/exercises/{$dir.IO.resolve.basename}/canonical-data.json".IO.resolve) ~~ :f {
|
49
|
-
is-deeply $c-data, EVAL('use JSON::Fast; from-json($c-data-file.slurp);'), 'canonical-data';
|
50
|
-
} else { flunk 'canonical-data' }
|
51
|
-
} else { skip }
|
52
|
-
|
53
49
|
done-testing;
|
54
50
|
|
55
51
|
INIT {
|
@@ -251,4 +247,20 @@ $c-data := from-json q:to/END/;
|
|
251
247
|
}
|
252
248
|
|
253
249
|
END
|
250
|
+
|
251
|
+
if %*ENV<EXERCISM> {
|
252
|
+
$module = 'Example';
|
253
|
+
if (my $c-data-file =
|
254
|
+
"$dir/../../problem-specifications/exercises/{$dir.IO.resolve.basename}/canonical-data.json"
|
255
|
+
.IO.resolve) ~~ :f
|
256
|
+
{
|
257
|
+
is-deeply $c-data, EVAL('from-json $c-data-file.slurp'), 'canonical-data';
|
258
|
+
}
|
259
|
+
else {
|
260
|
+
flunk 'canonical-data';
|
261
|
+
}
|
262
|
+
}
|
263
|
+
else {
|
264
|
+
skip;
|
265
|
+
}
|
254
266
|
}
|