aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwambash <wamba@centrum.cz>2024-02-25 19:12:08 +0100
committerwambash <wamba@centrum.cz>2024-02-25 19:12:08 +0100
commitc4486329e97608177c60341200117f9fec4f6b9a (patch)
treed545c8d2a1cbec0e63e31e37eaac0bfebdd16834
parent174e3582dbcf0b3c51c594161e495c1bf45949b6 (diff)
downloadperlweeklychallenge-club-c4486329e97608177c60341200117f9fec4f6b9a.tar.gz
perlweeklychallenge-club-c4486329e97608177c60341200117f9fec4f6b9a.tar.bz2
perlweeklychallenge-club-c4486329e97608177c60341200117f9fec4f6b9a.zip
solution 257-1
-rw-r--r--challenge-257/wambash/raku/ch-1.raku27
1 files changed, 27 insertions, 0 deletions
diff --git a/challenge-257/wambash/raku/ch-1.raku b/challenge-257/wambash/raku/ch-1.raku
new file mode 100644
index 0000000000..f3bd676a43
--- /dev/null
+++ b/challenge-257/wambash/raku/ch-1.raku
@@ -0,0 +1,27 @@
+#!/usr/bin/env raku
+
+sub smaller-than-current (+@ints) {
+ my %small := (
+ @ints
+ andthen .sort
+ andthen .squish
+ andthen .antipairs
+ andthen .Map
+ );
+
+ @ints.map: -> \i { %small{i} }
+}
+
+multi MAIN (Bool :test($)!) {
+ use Test;
+ is smaller-than-current(5,2,1,6),(2,1,0,3);
+ is smaller-than-current(1,2,0,3),(1,2,0,3);
+ is smaller-than-current(0,1),(0,1);
+ is smaller-than-current(9,4,9,2),(2,1,2,0);
+ done-testing;
+}
+
+
+multi MAIN (*@ints) {
+ put smaller-than-current @ints
+}