diff options
| author | Mohammad Sajid Anwar <Mohammad.Anwar@yahoo.com> | 2025-09-21 11:02:23 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-21 11:02:23 +0100 |
| commit | 3ac78b222a010268643c7e26a0fb90fbedd92ddc (patch) | |
| tree | 3cc7423333e5319b826c4e5793cc81535da9ea21 | |
| parent | 7fb2c6d54f1d78502c9f79a35f8d03217fe6cd3c (diff) | |
| parent | 04c351127cdce2f37c0582bb0be2560fccc2dd90 (diff) | |
| download | perlweeklychallenge-club-3ac78b222a010268643c7e26a0fb90fbedd92ddc.tar.gz perlweeklychallenge-club-3ac78b222a010268643c7e26a0fb90fbedd92ddc.tar.bz2 perlweeklychallenge-club-3ac78b222a010268643c7e26a0fb90fbedd92ddc.zip | |
Merge pull request #12703 from wambash/challenge-week-337
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; +} |
