aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-081/markus-holzer/raku/ch-1.raku11
-rw-r--r--challenge-081/markus-holzer/raku/ch-2.raku2
2 files changed, 7 insertions, 6 deletions
diff --git a/challenge-081/markus-holzer/raku/ch-1.raku b/challenge-081/markus-holzer/raku/ch-1.raku
index ee685600da..e9a18dd53e 100644
--- a/challenge-081/markus-holzer/raku/ch-1.raku
+++ b/challenge-081/markus-holzer/raku/ch-1.raku
@@ -1,10 +1,11 @@
unit sub MAIN( Str, Str );
-my Str $A = @*ARGS.min;
-my Str $B = @*ARGS.max;
+my Str $A = @*ARGS.min(*.chars);
+my Str $B = @*ARGS.max(*.chars);
# Custom operator, just for fun
-multi sub infix:<%%>( Str $n, Str $d ) {
- $n eq $d x $n.chars div $d.chars }
+multi sub infix:<%%>( Str $n, Str $d ) returns Bool {
+ given $n.chars / $d.chars {
+ .denominator == 1 && $n eq $d x .numerator }}
-.say for grep $B %% *, [\~] $A.comb \ No newline at end of file
+.say for grep all($A, $B) %% *, [\~] $A.comb;
diff --git a/challenge-081/markus-holzer/raku/ch-2.raku b/challenge-081/markus-holzer/raku/ch-2.raku
index 7f6ab7aadc..c9d0bad20c 100644
--- a/challenge-081/markus-holzer/raku/ch-2.raku
+++ b/challenge-081/markus-holzer/raku/ch-2.raku
@@ -11,4 +11,4 @@ my $words = $file
.classify( *.value );
say "{$_} : {sort $words{$_}>>.key}"
- for sort $words.keys; \ No newline at end of file
+ for sort keys $words; \ No newline at end of file