diff options
| author | Jan Krňávek <Jan.Krnavek@gmail.com> | 2022-10-23 21:39:42 +0200 |
|---|---|---|
| committer | Jan Krňávek <Jan.Krnavek@gmail.com> | 2022-10-23 21:39:42 +0200 |
| commit | c7307733a39bb6a776dbb43dce38dccf8d83d476 (patch) | |
| tree | 8448ce374f7c37ad933def4edb7e236d0bc297f4 | |
| parent | 4b3fe273df847c163c605f2d4d920853abb98f87 (diff) | |
| download | perlweeklychallenge-club-c7307733a39bb6a776dbb43dce38dccf8d83d476.tar.gz perlweeklychallenge-club-c7307733a39bb6a776dbb43dce38dccf8d83d476.tar.bz2 perlweeklychallenge-club-c7307733a39bb6a776dbb43dce38dccf8d83d476.zip | |
solution week 187-1
| -rw-r--r-- | challenge-187/wambash/raku/ch-1.raku | 22 |
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 +} |
