aboutsummaryrefslogtreecommitdiff
path: root/challenge-132
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2021-10-02 08:33:06 +0100
committerGitHub <noreply@github.com>2021-10-02 08:33:06 +0100
commitbd48c8222705dc94f43cdd36d4377da531113304 (patch)
treec293a487a4e3e6f69117ee9095ae6ed058332d22 /challenge-132
parent65f5bc5d20c0944491b5fdc38ec4ee0b6303c338 (diff)
parent4d207840e4f7bc9bdc12b191d1d50c905870df49 (diff)
downloadperlweeklychallenge-club-bd48c8222705dc94f43cdd36d4377da531113304.tar.gz
perlweeklychallenge-club-bd48c8222705dc94f43cdd36d4377da531113304.tar.bz2
perlweeklychallenge-club-bd48c8222705dc94f43cdd36d4377da531113304.zip
Merge pull request #4949 from wambash/challenge-week-132
solution week 131-1
Diffstat (limited to 'challenge-132')
-rw-r--r--challenge-132/wambash/raku/ch-1.raku19
1 files changed, 19 insertions, 0 deletions
diff --git a/challenge-132/wambash/raku/ch-1.raku b/challenge-132/wambash/raku/ch-1.raku
new file mode 100644
index 0000000000..0e370322af
--- /dev/null
+++ b/challenge-132/wambash/raku/ch-1.raku
@@ -0,0 +1,19 @@
+#!/usr/bin/env raku
+
+sub mirror-dates (Date() $birth, Date() :$today = Date.today ) {
+ my $age = $today - $birth;
+ $birth - $age, $today + $age
+}
+
+
+multi MAIN ($birth, :$today = Date.today) {
+ put mirror-dates $birth, :$today
+}
+
+multi MAIN (Bool :test($)!) {
+ use Test;
+ is mirror-dates( '2021-09-18', :today<2021-09-22> ), <2021-09-14 2021-09-26>;
+ is mirror-dates( '1975-10-10', :today<2021-09-22> ), <1929-10-27 2067-09-05>;
+ is mirror-dates( '1967-02-14', :today<2021-09-22> ), <1912-07-08 2076-04-30>;
+ done-testing
+}