diff options
| author | Mark <53903062+andemark@users.noreply.github.com> | 2021-11-10 02:10:02 +0000 |
|---|---|---|
| committer | Mark <53903062+andemark@users.noreply.github.com> | 2021-11-10 02:10:02 +0000 |
| commit | 5e5f1cf3f56dc531e64ce47c8889177a26822719 (patch) | |
| tree | d456a45f38685ea2d78accd7a17e83038c742742 | |
| parent | 7f84f0b1330ecf5338e117596ed155d6c2a513cd (diff) | |
| download | perlweeklychallenge-club-5e5f1cf3f56dc531e64ce47c8889177a26822719.tar.gz perlweeklychallenge-club-5e5f1cf3f56dc531e64ce47c8889177a26822719.tar.bz2 perlweeklychallenge-club-5e5f1cf3f56dc531e64ce47c8889177a26822719.zip | |
array instead of hash
| -rw-r--r-- | challenge-138/mark-anderson/raku/ch-1.raku | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/challenge-138/mark-anderson/raku/ch-1.raku b/challenge-138/mark-anderson/raku/ch-1.raku index d5928ef653..96f10551a7 100644 --- a/challenge-138/mark-anderson/raku/ch-1.raku +++ b/challenge-138/mark-anderson/raku/ch-1.raku @@ -15,26 +15,9 @@ is workdays(2076), 262; sub workdays($year) { - my %h is Map = False => { - 6 => 260, - 7 => 260, - 1 => 261, - 2 => 261, - 3 => 261, - 4 => 261, - 5 => 261 - }, - True => { - 6 => 260, - 5 => 261, - 7 => 261, - 1 => 262, - 2 => 262, - 3 => 262, - 4 => 262 - } + my @a = [ Nil, 261, 261, 261, 261, 261, 260, 260 ], + [ Nil, 262, 262, 262, 262, 261, 260, 261 ]; my $dt = Date.new($year, 1, 1); - - %h{ $dt.is-leap-year }{ $dt.day-of-week } + @a[ +$dt.is-leap-year ][ $dt.day-of-week ]; } |
