diff options
| author | deoac <deoac.bollinger@gmail.com> | 2023-05-11 19:40:32 -0400 |
|---|---|---|
| committer | deoac <deoac.bollinger@gmail.com> | 2023-05-11 19:40:32 -0400 |
| commit | 2b669d12f3017817f34c91d44bf893b0e2f519d2 (patch) | |
| tree | 66d554943f5afeb605b1c128d5112ed6605374e4 | |
| parent | ee07ff2e5f8046e3d3af78e91b5bd7e7d5569ce0 (diff) | |
| download | perlweeklychallenge-club-2b669d12f3017817f34c91d44bf893b0e2f519d2.tar.gz perlweeklychallenge-club-2b669d12f3017817f34c91d44bf893b0e2f519d2.tar.bz2 perlweeklychallenge-club-2b669d12f3017817f34c91d44bf893b0e2f519d2.zip | |
Improved the output to match the examples.
| -rw-r--r-- | challenge-216/shimon-ben-avraham/raku/ch-1.md | 6 | ||||
| -rwxr-xr-x | challenge-216/shimon-ben-avraham/raku/ch-1.raku | 13 | ||||
| -rwxr-xr-x | challenge-216/shimon-ben-avraham/raku/registration-number.raku | 10 |
3 files changed, 16 insertions, 13 deletions
diff --git a/challenge-216/shimon-ben-avraham/raku/ch-1.md b/challenge-216/shimon-ben-avraham/raku/ch-1.md index 5130597373..43bd6f28ae 100644 --- a/challenge-216/shimon-ben-avraham/raku/ch-1.md +++ b/challenge-216/shimon-ben-avraham/raku/ch-1.md @@ -1,6 +1,9 @@ + TITLE ===== + + Task 1: Registration Number =========================== @@ -129,6 +132,5 @@ Finally, make sure we test every word in the `@words` array... ...and print the results! ```raku - say @result.List; + say @result.map({"'$_'"}).join(', ').map({ ($_) } ); } # end of multi MAIN (Str $reg, *@words) - diff --git a/challenge-216/shimon-ben-avraham/raku/ch-1.raku b/challenge-216/shimon-ben-avraham/raku/ch-1.raku index 400c22ce2e..31493cbe00 100755 --- a/challenge-216/shimon-ben-avraham/raku/ch-1.raku +++ b/challenge-216/shimon-ben-avraham/raku/ch-1.raku @@ -2,7 +2,7 @@ # Perl Weekly Challenge #216, Challenge 1 # © 2023 Shimon Bollinger. All rights reserved. -# Last modified: Thu 11 May 2023 06:24:39 PM EDT +# Last modified: Thu 11 May 2023 07:36:57 PM EDT # Version 0.0.1 # always use the latest version of Raku @@ -18,17 +18,18 @@ multi MAIN (Str $reg, *@words) { @result.push($_) if .lc .comb($reg-letters) - !~~ () for @words; + !~~ () + for @words; - say @result.List; + say @result.map({"'$_'"}).join(', ').map({ ($_) } ); } # end of multi MAIN (Str $reg, *@words) #| Run with the option '--test' to test the program multi MAIN (Bool :$test!) { use Test::Output; - output-is {samewith('AB1 2CD', <abc abcd abd>)}, "(abcd)\n", 'Example 1 OK'; - output-is {samewith('007 JB', <job james bjorg>)}, "(job bjorg)\n", 'Example 2 OK'; - output-is {samewith('C7 RA2', <crack road rac>)}, "(crack rac)\n", 'Example 3 OK'; + output-is {samewith('AB1 2CD', <abc abcd abd>)}, "('abcd')\n", 'Example 1 OK'; + output-is {samewith('007 JB', <job james bjorg>)}, "('job', 'bjorg')\n", 'Example 2 OK'; + output-is {samewith('C7 RA2', <crack road rac>)}, "('crack', 'rac')\n", 'Example 3 OK'; } diff --git a/challenge-216/shimon-ben-avraham/raku/registration-number.raku b/challenge-216/shimon-ben-avraham/raku/registration-number.raku index f8e06ded41..230c49ea94 100755 --- a/challenge-216/shimon-ben-avraham/raku/registration-number.raku +++ b/challenge-216/shimon-ben-avraham/raku/registration-number.raku @@ -2,7 +2,7 @@ # Perl Weekly Challenge #216, Challenge 1 # © 2023 Shimon Bollinger. All rights reserved. -# Last modified: Thu 11 May 2023 06:24:53 PM EDT +# Last modified: Thu 11 May 2023 07:36:57 PM EDT # Version 0.0.1 # always use the latest version of Raku @@ -124,15 +124,15 @@ Finally, make sure we test every word in the C<@words> array... ...and print the results! =end pod - say @result.List; + say @result.map({"'$_'"}).join(', ').map({ ($_) } ); } # end of multi MAIN (Str $reg, *@words) #| Run with the option '--test' to test the program multi MAIN (Bool :$test!) { use Test::Output; - output-is {samewith('AB1 2CD', <abc abcd abd>)}, "(abcd)\n", 'Example 1 OK'; - output-is {samewith('007 JB', <job james bjorg>)}, "(job bjorg)\n", 'Example 2 OK'; - output-is {samewith('C7 RA2', <crack road rac>)}, "(crack rac)\n", 'Example 3 OK'; + output-is {samewith('AB1 2CD', <abc abcd abd>)}, "('abcd')\n", 'Example 1 OK'; + output-is {samewith('007 JB', <job james bjorg>)}, "('job', 'bjorg')\n", 'Example 2 OK'; + output-is {samewith('C7 RA2', <crack road rac>)}, "('crack', 'rac')\n", 'Example 3 OK'; } |
