aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2022-10-24 13:31:38 +0100
committerGitHub <noreply@github.com>2022-10-24 13:31:38 +0100
commit677acea0a275fa70c9d65628d19a4a7d0c7b7f93 (patch)
treee910dc5f7c24c8ed1cfe1aefc5bbc7b86d6eab6c
parentbb06570f6b1634ca14bfd08927f3bfc6c052c494 (diff)
parentc7307733a39bb6a776dbb43dce38dccf8d83d476 (diff)
downloadperlweeklychallenge-club-677acea0a275fa70c9d65628d19a4a7d0c7b7f93.tar.gz
perlweeklychallenge-club-677acea0a275fa70c9d65628d19a4a7d0c7b7f93.tar.bz2
perlweeklychallenge-club-677acea0a275fa70c9d65628d19a4a7d0c7b7f93.zip
Merge pull request #6952 from wambash/challenge-week-187
solution week 187-1
-rw-r--r--challenge-187/wambash/raku/ch-1.raku22
1 files changed, 22 insertions, 0 deletions
diff --git a/challenge-187/wambash/raku/ch-1.raku b/challenge-187/wambash/raku/ch-1.raku
new file mode 100644
index 0000000000..a1edafafba
--- /dev/null
+++ b/challenge-187/wambash/raku/ch-1.raku
@@ -0,0 +1,22 @@
+#!/usr/bin/env raku
+multi days-together ( +@dr ) {
+ [∩] @dr
+ andthen .elems
+}
+
+
+multi MAIN (Bool :test($)!) {
+ use Test;
+ is-deeply days-together((.clone(:12day) .. .clone(:20day)), (.clone(:15day) .. .clone(:18day))), 4 with Date.new: '1999-01-01';
+ is-deeply days-together((.clone( :2day) .. .clone(:12day)), (.clone(:13day) .. .clone(:14day))), 0 with Date.new: '1999-03-01';
+ is-deeply days-together((.clone( :2day) .. .clone(:12day)), (.clone(:11day) .. .clone(:15day))), 2 with Date.new: '1999-03-01';
+ is-deeply days-together(
+ (.clone(:30day) .. .clone(:5day:4month)),
+ (.clone(:28day) .. .clone(:2day:4month))
+ ), 4 with Date.new: '1999-03-01';
+ done-testing;
+}
+
+multi MAIN (Date() $Foo-sd,Date() $Foo-ed, Date() $Bar-sd, Date() $Bar-ed) {
+ say days-together $Foo-sd..$Foo-ed, $Bar-sd..$Bar-ed
+}