trackler 2.1.0.33 → 2.1.0.34
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/tracks/bash/config.json +39 -20
- data/tracks/bash/{SETUP.md → docs/EXERCISE_README_INSERT.md} +0 -0
- data/tracks/bash/exercises/difference-of-squares/difference_of_squares_test.sh +71 -0
- data/tracks/bash/exercises/difference-of-squares/example.sh +25 -0
- data/tracks/clojurescript/config.json +0 -5
- data/tracks/clojurescript/{exercises/TRACK_HINTS.md → docs/EXERCISE_README_INSERT.md} +0 -0
- data/tracks/coffeescript/config.json +63 -26
- data/tracks/coffeescript/{SETUP.md → docs/EXERCISE_README_INSERT.md} +4 -2
- data/tracks/coffeescript/exercises/luhn/luhn_test.spec.coffee +2 -2
- data/tracks/coffeescript/exercises/palindrome-products/palindrome_products_test.spec.coffee +1 -1
- data/tracks/crystal/config.json +27 -10
- data/tracks/dlang/config.json +2 -3
- data/tracks/dlang/{SETUP.md → docs/EXERCISE_README_INSERT.md} +0 -0
- data/tracks/haxe/config.json +7 -2
- data/tracks/haxe/{SETUP.md → docs/EXERCISE_README_INSERT.md} +0 -0
- data/tracks/java/{exercises/_template → _template}/build.gradle +0 -0
- data/tracks/java/{exercises/_template → _template}/src/example/java/.keep +0 -0
- data/tracks/java/{exercises/_template → _template}/src/main/java/.keep +0 -0
- data/tracks/java/{exercises/_template → _template}/src/test/java/.keep +0 -0
- data/tracks/java/config.json +201 -77
- data/tracks/julia/config.json +1 -7
- data/tracks/kotlin/{exercises/_template → _template}/build.gradle +0 -0
- data/tracks/kotlin/{exercises/_template → _template}/src/example/kotlin/.keep +0 -0
- data/tracks/kotlin/{exercises/_template → _template}/src/main/kotlin/.keep +0 -0
- data/tracks/kotlin/{exercises/_template → _template}/src/test/kotlin/.keep +0 -0
- data/tracks/mips/config.json +42 -14
- data/tracks/mips/{SETUP.md → docs/EXERCISE_README_INSERT.md} +0 -0
- data/tracks/nasm/config.json +1 -0
- data/tracks/nasm/{SETUP.md → docs/EXERCISE_README_INSERT.md} +0 -0
- data/tracks/nasm/exercises/.keep +0 -2
- data/tracks/nim/config.json +6 -0
- data/tracks/nim/{SETUP.md → docs/EXERCISE_README_INSERT.md} +0 -0
- data/tracks/nim/exercises/raindrops/example.nim +18 -0
- data/tracks/nim/exercises/raindrops/raindrops_test.nim +51 -0
- data/tracks/ocaml/config.json +97 -30
- data/tracks/perl5/config.json +186 -66
- data/tracks/perl5/{SETUP.md → docs/EXERCISE_README_INSERT.md} +0 -0
- data/tracks/perl6/bin/README.md +16 -6
- data/tracks/perl6/bin/exercise-gen.pl6 +21 -6
- data/tracks/perl6/{SETUP.md → docs/EXERCISE_README_INSERT.md} +0 -0
- data/tracks/perl6/exercises/accumulate/example.yaml +10 -0
- data/tracks/perl6/exercises/all-your-base/all-your-base.t +1 -0
- data/tracks/perl6/exercises/all-your-base/example.yaml +49 -0
- data/tracks/perl6/exercises/allergies/Allergies.pm6 +1 -1
- data/tracks/perl6/exercises/allergies/example.yaml +21 -0
- data/tracks/perl6/exercises/anagram/example.yaml +19 -0
- data/tracks/perl6/exercises/atbash-cipher/AtbashCipher.pm6 +1 -1
- data/tracks/perl6/exercises/atbash-cipher/example.yaml +15 -0
- data/tracks/perl6/exercises/bob/Example.pm6 +4 -0
- data/tracks/perl6/exercises/bob/example.yaml +24 -0
- data/tracks/perl6/exercises/clock/clock.t +1 -0
- data/tracks/perl6/exercises/clock/example.yaml +17 -0
- data/tracks/perl6/exercises/flatten-array/example.yaml +17 -0
- data/tracks/perl6/exercises/grade-school/example.yaml +22 -0
- data/tracks/perl6/exercises/grains/example.yaml +13 -0
- data/tracks/perl6/exercises/hello-world/Example.pm6 +9 -0
- data/tracks/perl6/exercises/hello-world/example.yaml +21 -0
- data/tracks/perl6/exercises/leap/Example.pm6 +1 -1
- data/tracks/perl6/exercises/leap/Leap.pm6 +1 -1
- data/tracks/perl6/exercises/leap/example.yaml +15 -0
- data/tracks/perl6/exercises/linked-list/LinkedList.pm6 +1 -1
- data/tracks/perl6/exercises/linked-list/example.yaml +51 -0
- data/tracks/perl6/exercises/linked-list/linked-list.t +0 -1
- data/tracks/perl6/exercises/luhn/example.yaml +19 -0
- data/tracks/perl6/exercises/phone-number/{PhoneNumber.pm6 → Phone.pm6} +0 -0
- data/tracks/perl6/exercises/phone-number/example.yaml +10 -0
- data/tracks/perl6/exercises/raindrops/example.yaml +15 -0
- data/tracks/perl6/exercises/rna-transcription/example.yaml +10 -0
- data/tracks/perl6/exercises/robot-name/example.yaml +24 -0
- data/tracks/perl6/exercises/robot-name/robot-name.t +4 -0
- data/tracks/perl6/exercises/scrabble-score/example.yaml +21 -0
- data/tracks/perl6/exercises/space-age/example.yaml +52 -0
- data/tracks/perl6/exercises/word-count/example.yaml +9 -0
- data/tracks/perl6/exercises/wordy/example.yaml +20 -0
- data/tracks/perl6/templates/module.mustache +4 -0
- data/tracks/perl6/templates/test.mustache +2 -1
- data/tracks/plsql/config.json +30 -10
- data/tracks/plsql/{SETUP.md → docs/EXERCISE_README_INSERT.md} +0 -0
- data/tracks/pony/config.json +0 -6
- data/tracks/pony/{SETUP.md → docs/EXERCISE_README_INSERT.md} +0 -0
- data/tracks/powershell/config.json +6 -2
- data/tracks/powershell/{SETUP.md → docs/EXERCISE_README_INSERT.md} +0 -0
- data/tracks/python/config.json +101 -39
- data/tracks/r/config.json +0 -4
- data/tracks/ruby/config.json +84 -6
- data/tracks/ruby/{exercises/TRACK_HINTS.md → docs/EXERCISE_README_INSERT.md} +0 -0
- data/tracks/tcl/config.json +1 -0
- data/tracks/tcl/{SETUP.md → docs/EXERCISE_README_INSERT.md} +0 -0
- data/tracks/tcl/exercises/.keep +0 -2
- data/tracks/teco/config.json +0 -4
- data/tracks/teco/{SETUP.md → docs/EXERCISE_README_INSERT.md} +0 -0
- data/tracks/vbnet/config.json +1 -0
- data/tracks/vbnet/{SETUP.md → docs/EXERCISE_README_INSERT.md} +0 -0
- data/tracks/vimscript/config.json +64 -19
- data/tracks/vimscript/{TRACK_HINTS.md → docs/EXERCISE_README_INSERT.md} +0 -0
- data/tracks/vimscript/exercises/beer-song/beer_song.vader +50 -0
- data/tracks/vimscript/exercises/beer-song/beer_song.vim +24 -0
- data/tracks/vimscript/exercises/beer-song/example.vim +21 -0
- metadata +37 -29
File without changes
|
data/tracks/perl6/bin/README.md
CHANGED
@@ -10,25 +10,35 @@ You will either need to create a symlink to or clone the
|
|
10
10
|
into the root directory of this repository.
|
11
11
|
The generator will retrieve data from an `example.yaml` file within
|
12
12
|
each exercise directory, and use the contained information to generate
|
13
|
-
test files using `templates/test.mustache
|
14
|
-
`canonical-data.json` file in
|
15
|
-
question it will be included.
|
13
|
+
test files using `templates/test.mustache`, and Example.pm6 files using
|
14
|
+
`templates/module.mustache`. If it finds a `canonical-data.json` file in
|
15
|
+
`x-common` for the exercise in question it will be included.
|
16
16
|
|
17
17
|
Example of a yaml file:
|
18
18
|
```yaml
|
19
19
|
exercise: MyExercise
|
20
20
|
version: 1
|
21
|
-
plan:
|
21
|
+
plan: 2
|
22
22
|
modules:
|
23
23
|
- use: Data::Dump
|
24
24
|
- use: Foo::Bar
|
25
25
|
imports: 'MyClass &my-subroutine'
|
26
26
|
methods: 'foo bar'
|
27
27
|
tests: |
|
28
|
-
ok
|
28
|
+
ok my-subroutine, 'Perl 6 code here';
|
29
29
|
pass;
|
30
|
+
|
31
|
+
unit: module
|
32
|
+
example: |
|
33
|
+
sub my-subroutine is export {
|
34
|
+
True;
|
35
|
+
}
|
36
|
+
|
37
|
+
class MyClass is export {
|
38
|
+
}
|
30
39
|
```
|
31
40
|
|
32
41
|
You must have `Template::Mustache` and `YAMLish` to run `exercise-gen.pl6`.
|
33
42
|
|
34
|
-
Note (2017-05-22): [YAMLish](http://modules.perl6.org/dist/YAMLish)
|
43
|
+
Note (2017-05-22): [YAMLish](http://modules.perl6.org/dist/YAMLish)
|
44
|
+
is not yet feature complete, so some valid YAML files may not parse.
|
@@ -8,7 +8,7 @@ my @exercises;
|
|
8
8
|
|
9
9
|
if @*ARGS {
|
10
10
|
if @*ARGS[0] eq '--all' {
|
11
|
-
push @exercises,
|
11
|
+
push @exercises, .basename for $base-dir.child('exercises').dir;
|
12
12
|
} else {
|
13
13
|
@exercises = @*ARGS;
|
14
14
|
}
|
@@ -23,14 +23,29 @@ if @*ARGS {
|
|
23
23
|
}
|
24
24
|
|
25
25
|
for @exercises -> $exercise {
|
26
|
+
say "Generating $exercise...";
|
26
27
|
my $exercise-dir = $base-dir.child("exercises/$exercise");
|
27
28
|
next if (my $yaml = $exercise-dir.child('example.yaml')) !~~ :f;
|
28
|
-
|
29
|
+
|
29
30
|
my %data = load-yaml $yaml.slurp;
|
30
|
-
|
31
|
+
$_=.chomp when Str for @(%data.values);
|
32
|
+
|
33
|
+
my $cdata = $base-dir.child("x-common/exercises/$exercise/canonical-data.json");
|
34
|
+
%data<cdata> = :json($cdata.slurp) if $cdata ~~ :f;
|
35
|
+
|
36
|
+
create-file "$exercise.t", 'test';
|
37
|
+
|
38
|
+
%data<module_file> = %data<example>;
|
39
|
+
create-file |<Example.pm6 module>;
|
40
|
+
|
41
|
+
%data<module_file> = %data<stub>;
|
42
|
+
create-file "{%data<exercise>}.pm6", 'module';
|
31
43
|
|
32
|
-
spurt (my $test = $exercise-dir.child("$exercise.t")),
|
33
|
-
Template::Mustache.render($base-dir.child('templates/test.mustache').slurp, %data);
|
34
|
-
$test.chmod(0o755);
|
35
44
|
say "$exercise generated.";
|
45
|
+
|
46
|
+
sub create-file ($filename, $template) {
|
47
|
+
spurt (my $file = $exercise-dir.child($filename)),
|
48
|
+
Template::Mustache.render($base-dir.child("templates/$template.mustache").slurp, %data);
|
49
|
+
$file.chmod(0o755) if $template ~~ 'test';
|
50
|
+
}
|
36
51
|
}
|
File without changes
|
@@ -21,3 +21,13 @@ tests: |
|
|
21
21
|
is-deeply accumulate(['the', 'quick', 'brown', 'fox'], sub { @_[0].flip }),
|
22
22
|
['eht', 'kciuq', 'nworb', 'xof'],
|
23
23
|
'reverse strings';
|
24
|
+
|
25
|
+
unit: module
|
26
|
+
example: |
|
27
|
+
sub accumulate (@list, $function) is export {
|
28
|
+
my @accumulated;
|
29
|
+
for @list -> $element {
|
30
|
+
@accumulated.push: $function($element);
|
31
|
+
}
|
32
|
+
return @accumulated;
|
33
|
+
}
|
@@ -23,6 +23,7 @@ require ::($module) <&convert-base>;
|
|
23
23
|
|
24
24
|
my $c-data;
|
25
25
|
sub test ($case, $expected) { is-deeply &::('convert-base')(|$case<input_base input_digits output_base>), $expected, $case<description> }
|
26
|
+
|
26
27
|
for @($c-data<cases>) {
|
27
28
|
when .<expected> ~~ Array { test $_, .<expected> }
|
28
29
|
when .<description> ~~ /base|digit/ { throws-like {&::('convert-base')(|.<input_base input_digits output_base>)}, Exception, .<description> }
|
@@ -4,6 +4,7 @@ plan: 23
|
|
4
4
|
imports: '&convert-base'
|
5
5
|
tests: |
|
6
6
|
sub test ($case, $expected) { is-deeply &::('convert-base')(|$case<input_base input_digits output_base>), $expected, $case<description> }
|
7
|
+
|
7
8
|
for @($c-data<cases>) {
|
8
9
|
when .<expected> ~~ Array { test $_, .<expected> }
|
9
10
|
when .<description> ~~ /base|digit/ { throws-like {&::('convert-base')(|.<input_base input_digits output_base>)}, Exception, .<description> }
|
@@ -12,3 +13,51 @@ tests: |
|
|
12
13
|
when .<description> ~~ /zero/ { test $_, [0] }
|
13
14
|
default { flunk .<description> } # To ensure that no canonical-data cases are missed.
|
14
15
|
}
|
16
|
+
|
17
|
+
unit: module
|
18
|
+
example: |
|
19
|
+
class X::AllYourBase::InvalidBase is Exception {
|
20
|
+
has $.payload;
|
21
|
+
method message {"$!payload is not a valid base."}
|
22
|
+
}
|
23
|
+
|
24
|
+
class X::AllYourBase::InvalidDigit is Exception {
|
25
|
+
has %.payload;
|
26
|
+
method message {"%!payload<digit> is not a valid digit for base %!payload<base>."}
|
27
|
+
}
|
28
|
+
|
29
|
+
sub convert-base (Int:D $input-base, @input-digits, Int:D $output-base --> Array:D) is export {
|
30
|
+
for $input-base, $output-base {
|
31
|
+
X::AllYourBase::InvalidBase.new(payload => $_).throw if $_ < 2;
|
32
|
+
}
|
33
|
+
from-decimal($output-base, (to-decimal $input-base, @input-digits));
|
34
|
+
}
|
35
|
+
|
36
|
+
sub to-decimal ($input-base, @input-digits) {
|
37
|
+
return [].Slip if !@input-digits;
|
38
|
+
my $elems = @input-digits.elems;
|
39
|
+
for @input-digits {
|
40
|
+
if $_ == 0 { $elems-- }
|
41
|
+
else { last }
|
42
|
+
}
|
43
|
+
my $dec = 0;
|
44
|
+
loop (my $i = 0; $i < $elems; $i++) {
|
45
|
+
if @input-digits.reverse[$i] < 0 || @input-digits.reverse[$i] >= $input-base {
|
46
|
+
X::AllYourBase::InvalidDigit.new( :payload(base => $input-base, digit => @input-digits.reverse[$i]) ).throw;
|
47
|
+
}
|
48
|
+
$dec += @input-digits.reverse[$i] * $input-base ** $i;
|
49
|
+
}
|
50
|
+
return $dec;
|
51
|
+
}
|
52
|
+
|
53
|
+
sub from-decimal ($output-base, $dec) {
|
54
|
+
my @output-digits;
|
55
|
+
my $num = $dec;
|
56
|
+
while $num >= $output-base {
|
57
|
+
unshift @output-digits, $num % $output-base;
|
58
|
+
$num div= $output-base;
|
59
|
+
}
|
60
|
+
unshift @output-digits, $num;
|
61
|
+
return @output-digits;
|
62
|
+
}
|
63
|
+
|
@@ -1 +1 @@
|
|
1
|
-
unit module Allergies:ver<1>;
|
1
|
+
unit module Allergies:ver<1>;
|
@@ -19,3 +19,24 @@ tests: |
|
|
19
19
|
}
|
20
20
|
} if %cases<description> ~~ 'list';
|
21
21
|
}
|
22
|
+
|
23
|
+
unit: module
|
24
|
+
example: |
|
25
|
+
our @allergens = <
|
26
|
+
eggs
|
27
|
+
peanuts
|
28
|
+
shellfish
|
29
|
+
strawberries
|
30
|
+
tomatoes
|
31
|
+
chocolate
|
32
|
+
pollen
|
33
|
+
cats
|
34
|
+
>;
|
35
|
+
|
36
|
+
sub allergic-to($code,$substance) is export {
|
37
|
+
return so $code +& ( 2 ** @allergens.first({ $_ eq $substance},:k) )
|
38
|
+
}
|
39
|
+
|
40
|
+
sub list-allergies($code) is export {
|
41
|
+
return grep { allergic-to($code,$_) }, @allergens;
|
42
|
+
}
|
@@ -4,3 +4,22 @@ plan: 18
|
|
4
4
|
imports: '&match-anagrams'
|
5
5
|
tests: |
|
6
6
|
is match-anagrams(|.<subject candidates>), |.<expected description> for @($c-data<cases>);
|
7
|
+
|
8
|
+
unit: module
|
9
|
+
example: |
|
10
|
+
sub match-anagrams ($word, @words) is export {
|
11
|
+
my @results;
|
12
|
+
my $canonical = canonize($word);
|
13
|
+
for @words -> $w {
|
14
|
+
next if $w.lc eq $word.lc;
|
15
|
+
my $try = canonize($w);
|
16
|
+
if $try eq $canonical {
|
17
|
+
@results.push: $w;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
@results;
|
21
|
+
}
|
22
|
+
|
23
|
+
sub canonize ($str) {
|
24
|
+
(($str.lc.split('')).sort).join('');
|
25
|
+
}
|
@@ -1 +1 @@
|
|
1
|
-
unit module AtbashCipher:ver<1>;
|
1
|
+
unit module AtbashCipher:ver<1>;
|
@@ -11,3 +11,18 @@ tests: |
|
|
11
11
|
is &::($test)(.<phrase>), |.<expected description> for @cases;
|
12
12
|
}
|
13
13
|
}
|
14
|
+
|
15
|
+
unit: module
|
16
|
+
example: |
|
17
|
+
sub encode($input) is export {
|
18
|
+
decode($input.lc.trans( ['a'..'z', 0..9] => '', :complement ) )
|
19
|
+
.comb(5)
|
20
|
+
.join: ' ';
|
21
|
+
}
|
22
|
+
|
23
|
+
sub decode (Str $input) is export {
|
24
|
+
return $input
|
25
|
+
.lc
|
26
|
+
.subst( /\W/, '', :g )
|
27
|
+
.trans( [ 'a'..'z' ] => ['a'..'z'].reverse );
|
28
|
+
}
|
@@ -18,3 +18,27 @@ methods_comment: "Check that the class 'Bob' can use all of the methods\nneeded
|
|
18
18
|
cdata_test_comment: Ignore this for your exercise! Tells Exercism folks when exercise cases become out of date.
|
19
19
|
done_testing_comment: There are no more tests after this :)
|
20
20
|
INIT_comment: "'INIT' is a phaser, it makes sure that the test data is available before everything else\nstarts running (otherwise we'd have to shove the test data into the middle of the file!)"
|
21
|
+
|
22
|
+
unit: class
|
23
|
+
unit_comment: |
|
24
|
+
#`[
|
25
|
+
Declare class 'Bob' with version and unit-scope the class
|
26
|
+
i.e. everything in this file is part of 'Bob'.
|
27
|
+
]
|
28
|
+
example: |
|
29
|
+
method hey ($msg) {
|
30
|
+
given $msg.trim {
|
31
|
+
when !* { 'Fine. Be that way!' }
|
32
|
+
when /<:Upper>/ and $_.uc eq * { 'Whoa, chill out!' }
|
33
|
+
when /'?'$/ { 'Sure.' }
|
34
|
+
default { 'Whatever.' }
|
35
|
+
}
|
36
|
+
}
|
37
|
+
stub: |
|
38
|
+
method hey ($msg) {
|
39
|
+
#`[
|
40
|
+
Remove the comments and write some code here to pass the test suite.
|
41
|
+
You can experiment with the code outside of this block,
|
42
|
+
but no changes are needed for the test suite to pass.
|
43
|
+
]
|
44
|
+
}
|
@@ -23,5 +23,22 @@ tests: |
|
|
23
23
|
}
|
24
24
|
}
|
25
25
|
}
|
26
|
+
|
26
27
|
todo 'optional test' unless %*ENV<EXERCISM>;
|
27
28
|
is ::($exercise).new(:0hour,:0minute).?add-minutes(65).?time, '01:05', 'add-minutes method can be chained';
|
29
|
+
|
30
|
+
unit: class
|
31
|
+
example: |
|
32
|
+
has Int:D $.hour = 0;
|
33
|
+
has Int:D $.minute = 0;
|
34
|
+
|
35
|
+
method time {
|
36
|
+
sprintf '%02d:%02d', ($!hour + $!minute div 60) % 24, $!minute % 60;
|
37
|
+
}
|
38
|
+
|
39
|
+
method add-minutes (Int:D $min) {
|
40
|
+
$!minute += $min and return self;
|
41
|
+
}
|
42
|
+
stub: |
|
43
|
+
has $.hour;
|
44
|
+
has $.minute;
|
@@ -4,3 +4,20 @@ plan: 8
|
|
4
4
|
imports: '&flatten-array'
|
5
5
|
tests: |
|
6
6
|
is-deeply &::('flatten-array')(.<input>), |.<expected description> for @($c-data<cases>);
|
7
|
+
|
8
|
+
unit: module
|
9
|
+
example: |
|
10
|
+
sub flatten-array(@input --> Array) is export {
|
11
|
+
@input.&denest;
|
12
|
+
return my @result;
|
13
|
+
|
14
|
+
sub denest(@array) {
|
15
|
+
for @array {
|
16
|
+
.&denest when Array;
|
17
|
+
@result.push: $_ when Int;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
stub: |
|
22
|
+
sub flatten-array(@input) is export {
|
23
|
+
}
|
@@ -21,3 +21,25 @@ tests: |
|
|
21
21
|
ok $roster.?add-student(:name($_), :3grade), "Add $_ to grade 3" for <Tom Dick Harry>;
|
22
22
|
}
|
23
23
|
is $roster.?list-all, ('Grade 1', <Anna Barb Charlie>, 'Grade 2', <Alex Jim Zoe>, 'Grade 3', <Dick Harry Tom>), 'List all';
|
24
|
+
|
25
|
+
unit: module
|
26
|
+
example: |
|
27
|
+
class Roster is export {
|
28
|
+
has %!roster;
|
29
|
+
|
30
|
+
method add-student (Str:D :$name!, Int:D :$grade!) {
|
31
|
+
%!roster.append($grade, $name);
|
32
|
+
}
|
33
|
+
|
34
|
+
method list-grade (Int:D $grade --> Seq:D) {
|
35
|
+
%!roster{$grade}.sort;
|
36
|
+
}
|
37
|
+
|
38
|
+
method list-all {
|
39
|
+
my @list.append("Grade $_", %!roster{$_}.sort) for %!roster.keys.sort;
|
40
|
+
return @list;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
stub: |
|
44
|
+
class Roster is export {
|
45
|
+
}
|
@@ -11,3 +11,16 @@ tests: |
|
|
11
11
|
}
|
12
12
|
}
|
13
13
|
is total-grains, |$c-data<cases>[1]<expected description>;
|
14
|
+
|
15
|
+
unit: module
|
16
|
+
example: |
|
17
|
+
sub grains-on-square ($number) is export {
|
18
|
+
die if $number < 1 or $number > 64;
|
19
|
+
2**($number-1);
|
20
|
+
}
|
21
|
+
|
22
|
+
sub total-grains is export {
|
23
|
+
my Int $total;
|
24
|
+
for 1..64 { $total += grains-on-square($_) }
|
25
|
+
$total;
|
26
|
+
}
|
@@ -1,3 +1,12 @@
|
|
1
|
+
#`(
|
2
|
+
This is a 'stub' file. It's a little start on your solution.
|
3
|
+
It is not a complete solution though; you will have to write some code.
|
4
|
+
|
5
|
+
The ':ver<>' adverb defines the version of a module or class.
|
6
|
+
The version is checked in the test suite to ensure the exercise
|
7
|
+
and test suite line up. If the test is updated, it will indicate
|
8
|
+
to others who test your code that some tests may no longer pass.
|
9
|
+
)
|
1
10
|
unit module HelloWorld:ver<2>;
|
2
11
|
|
3
12
|
sub hello is export {
|
@@ -18,3 +18,24 @@ imports_comment: Import '&hello' from 'HelloWorld'
|
|
18
18
|
cdata_test_comment: Ignore this for your exercise! Tells Exercism folks when exercise cases become out of date.
|
19
19
|
done_testing_comment: There are no more tests after this :)
|
20
20
|
INIT_comment: "'INIT' is a phaser, it makes sure that the test data is available before everything else\nstarts running (otherwise we'd have to shove the test data into the middle of the file!)"
|
21
|
+
|
22
|
+
unit: module
|
23
|
+
unit_comment: |
|
24
|
+
#`(
|
25
|
+
This is a 'stub' file. It's a little start on your solution.
|
26
|
+
It is not a complete solution though; you will have to write some code.
|
27
|
+
|
28
|
+
The ':ver<>' adverb defines the version of a module or class.
|
29
|
+
The version is checked in the test suite to ensure the exercise
|
30
|
+
and test suite line up. If the test is updated, it will indicate
|
31
|
+
to others who test your code that some tests may no longer pass.
|
32
|
+
)
|
33
|
+
example: |
|
34
|
+
sub hello is export {
|
35
|
+
'Hello, World!'
|
36
|
+
}
|
37
|
+
stub: |
|
38
|
+
sub hello is export {
|
39
|
+
# Write your solution to pass the test suite here.
|
40
|
+
# Be sure to remove all stock comments once you are done!
|
41
|
+
}
|