diff options
| author | Jan Krňávek <Jan.Krnavek@gmail.com> | 2025-09-21 10:50:07 +0200 |
|---|---|---|
| committer | Jan Krňávek <Jan.Krnavek@gmail.com> | 2025-09-21 10:50:07 +0200 |
| commit | 04c351127cdce2f37c0582bb0be2560fccc2dd90 (patch) | |
| tree | 040df0013ae44c5278102b4d9b221831f70eb840 | |
| parent | 75acf511270cc4df6d1b59fdd27a072fcf8d5b20 (diff) | |
| download | perlweeklychallenge-club-04c351127cdce2f37c0582bb0be2560fccc2dd90.tar.gz perlweeklychallenge-club-04c351127cdce2f37c0582bb0be2560fccc2dd90.tar.bz2 perlweeklychallenge-club-04c351127cdce2f37c0582bb0be2560fccc2dd90.zip | |
solution week 337-1
| -rw-r--r-- | challenge-337/wambash/raku/ch-1.raku | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/challenge-337/wambash/raku/ch-1.raku b/challenge-337/wambash/raku/ch-1.raku new file mode 100644 index 0000000000..7c6e2b18ba --- /dev/null +++ b/challenge-337/wambash/raku/ch-1.raku @@ -0,0 +1,26 @@ +#!/usr/bin/env raku + +sub smaller-than-current (+@num) { + my %num-idx := ( + @num + andthen .sort + andthen .antipairs + andthen .Map + ); + + %num-idx{@num} +} + +multi MAIN (Bool :test($)!) { + use Test; + is smaller-than-current(6,5,4,8), (2,1,0,3); + is smaller-than-current(7 xx 4), (3 xx 4); + is smaller-than-current(5...1), (4...0); + is smaller-than-current(-1, 0, 3, -2, 1), (1,2,4,0,3); + is smaller-than-current(0,1,1,2,0), (1,3,3,4,1); + done-testing; +} + +multi MAIN (+num) { + put smaller-than-current num; +} |
