aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark <53903062+andemark@users.noreply.github.com>2024-02-19 14:38:45 +0000
committerMark <53903062+andemark@users.noreply.github.com>2024-02-19 14:38:45 +0000
commitc0ed66161cb9372d01302da905ae15e7d3916a3c (patch)
treeea41beb5747995ff5b6458c134d68027a62d6a60
parent16999d84c38058abf33d0341227f0cf38e84d21a (diff)
downloadperlweeklychallenge-club-c0ed66161cb9372d01302da905ae15e7d3916a3c.tar.gz
perlweeklychallenge-club-c0ed66161cb9372d01302da905ae15e7d3916a3c.tar.bz2
perlweeklychallenge-club-c0ed66161cb9372d01302da905ae15e7d3916a3c.zip
Challenge 257 Solutions (Raku)
-rw-r--r--challenge-257/mark-anderson/raku/ch-2.raku19
1 files changed, 10 insertions, 9 deletions
diff --git a/challenge-257/mark-anderson/raku/ch-2.raku b/challenge-257/mark-anderson/raku/ch-2.raku
index 5492722dcc..1dc1835310 100644
--- a/challenge-257/mark-anderson/raku/ch-2.raku
+++ b/challenge-257/mark-anderson/raku/ch-2.raku
@@ -36,14 +36,15 @@ sub reduced-row-echelon(+@m)
# the first non-zero number in a row is the pivot
my @pivots = @m>>.first(*.so, :kv);
- # find the first row that is all zeroes
- my $k = @pivots.first(*.so.not, :k);
+ # the first row that is all zeroes
+ my $k = @pivots.first(*.not, :k);
# all 0 rows are grouped at the bottom
- if $k {
- return False unless @pivots[$k..*].all eqv Any;
- @pivots = @pivots[^$k]
- }
+ if $k
+ {
+ return False unless @pivots[$k..*].all eqv Any;
+ @pivots = @pivots[^$k]
+ }
# all pivots == 1
return False unless so @pivots>>.[1].all == 1;
@@ -53,7 +54,7 @@ sub reduced-row-echelon(+@m)
# pivot columns are all 0 (except for the 1)
return all @pivots>>[0].map({
- all @m[*;$_].sum == 1,
- all(@m[*;$_].Bag.keys) ~~ 0..1
- })
+ all @m[*;$_].sum == 1,
+ all(@m[*;$_].Bag.keys) ~~ 0..1
+ })
}