aboutsummaryrefslogtreecommitdiff
path: root/challenge-245
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <Mohammad.Anwar@yahoo.com>2023-12-04 10:40:00 +0000
committerGitHub <noreply@github.com>2023-12-04 10:40:00 +0000
commit9a86b80671dffa57fd613d13f24ec13be11360f6 (patch)
treef1e61ac42e9ab6e20110d1e16d50897a82a7f6f0 /challenge-245
parentb41848354dc1a09ae68e01e91b551a36d13f8bda (diff)
parent6049e266c441dbc2de27cffc7d96fb0758e24580 (diff)
downloadperlweeklychallenge-club-9a86b80671dffa57fd613d13f24ec13be11360f6.tar.gz
perlweeklychallenge-club-9a86b80671dffa57fd613d13f24ec13be11360f6.tar.bz2
perlweeklychallenge-club-9a86b80671dffa57fd613d13f24ec13be11360f6.zip
Merge pull request #9188 from wambash/challenge-week-245
solution 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
+}