aboutsummaryrefslogtreecommitdiff
path: root/challenge-245
diff options
context:
space:
mode:
authorJan Krňávek <Jan.Krnavek@gmail.com>2023-12-04 07:38:01 +0100
committerJan Krňávek <Jan.Krnavek@gmail.com>2023-12-04 07:38:01 +0100
commit6049e266c441dbc2de27cffc7d96fb0758e24580 (patch)
treea1c48ff1736df612ec48f8534a3af43b36ad79b9 /challenge-245
parent758c8b5490c35ce2a83dcc29d26488de87e591ff (diff)
downloadperlweeklychallenge-club-6049e266c441dbc2de27cffc7d96fb0758e24580.tar.gz
perlweeklychallenge-club-6049e266c441dbc2de27cffc7d96fb0758e24580.tar.bz2
perlweeklychallenge-club-6049e266c441dbc2de27cffc7d96fb0758e24580.zip
solutions week 245-1
Diffstat (limited to 'challenge-245')
-rw-r--r--challenge-245/wambash/raku/ch-1.raku19
1 files changed, 19 insertions, 0 deletions
diff --git a/challenge-245/wambash/raku/ch-1.raku b/challenge-245/wambash/raku/ch-1.raku
new file mode 100644
index 0000000000..01f30341c8
--- /dev/null
+++ b/challenge-245/wambash/raku/ch-1.raku
@@ -0,0 +1,19 @@
+#!/usr/bin/env raku
+
+sub sort-language (:@lang,:@popularity) {
+ @popularity Z=> @lang
+ andthen .sort
+ andthen .map: *.value
+}
+
+multi MAIN (Bool :test($)!) {
+ use Test;
+ is sort-language(:lang<perl c python>,:popularity(2,1,3)), <c perl python>;
+ is sort-language(:lang<c++ haskell java>,:popularity(1,3,2)), <c++ java haskell>;
+ is sort-language(:lang<raku ruby perl>,:popularity(2,3,1)), <perl raku ruby>;
+ done-testing;
+}
+
+multi MAIN (:@lang,:@popularity) {
+ put sort-language :@lang,:@popularity
+}