From c7307733a39bb6a776dbb43dce38dccf8d83d476 Mon Sep 17 00:00:00 2001 From: Jan Krňávek Date: Sun, 23 Oct 2022 21:39:42 +0200 Subject: solution week 187-1 --- challenge-187/wambash/raku/ch-1.raku | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 challenge-187/wambash/raku/ch-1.raku 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 +} -- cgit