From 04c351127cdce2f37c0582bb0be2560fccc2dd90 Mon Sep 17 00:00:00 2001 From: Jan Krňávek Date: Sun, 21 Sep 2025 10:50:07 +0200 Subject: solution week 337-1 --- challenge-337/wambash/raku/ch-1.raku | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 challenge-337/wambash/raku/ch-1.raku 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; +} -- cgit