aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrir <rirans@comcast.net>2024-05-25 16:17:46 -0400
committerrir <rirans@comcast.net>2024-05-25 16:17:46 -0400
commit429df312931ed70fc328fa8f185bd2c5db01f2bd (patch)
tree4fbed57bbb8d14477985d722426fa1cbe53b4d98
parenta3510fad6c2b5379215d5862b9cc01b25ae13b02 (diff)
downloadperlweeklychallenge-club-429df312931ed70fc328fa8f185bd2c5db01f2bd.tar.gz
perlweeklychallenge-club-429df312931ed70fc328fa8f185bd2c5db01f2bd.tar.bz2
perlweeklychallenge-club-429df312931ed70fc328fa8f185bd2c5db01f2bd.zip
270 de-boil
-rw-r--r--challenge-270/0rir/raku/ch-1.raku7
-rw-r--r--challenge-270/0rir/raku/ch-2.raku11
2 files changed, 3 insertions, 15 deletions
diff --git a/challenge-270/0rir/raku/ch-1.raku b/challenge-270/0rir/raku/ch-1.raku
index 91e911afca..bbfa61f3dd 100644
--- a/challenge-270/0rir/raku/ch-1.raku
+++ b/challenge-270/0rir/raku/ch-1.raku
@@ -1,8 +1,6 @@
#!/usr/bin/env raku
# :vim ft=raku sw=4 expandtab # 🦋 ∅∪∩∋∈∉⊆ ≡ ≢ «␤ » ∴
use v6.d;
-INIT $*RAT-OVERFLOW = FatRat;
-use lib $?FILE.IO.cleanup.parent(2).add("lib");
use Test;
=begin comment
@@ -44,10 +42,9 @@ my @Test =
[ [0,0,0,0,0], [0,0,0,0,0], [0,0,1,0,0], [0,0,0,0,0], [0,0,0,0,0], ], 1,
[ [1,0,0,0,0], [0,1,0,0,0], [0,0,1,0,0], [0,0,0,1,0], [0,0,0,0,1], ], 5,
[ [1,0,0,0,0], [0,1,0,0,2], [0,0,1,0,0], [0,0,0,1,0], [0,0,0,0,1], ], 3,
- ;
+;
plan @Test ÷ 2;
-
multi task( @a where *.end == 0 -->Int) {
( 1 == @a[0].grep( 1) and @a[0].end == @a[0].grep(0) // 0 ) ?? 1 !! 0;
}
@@ -70,5 +67,3 @@ for @Test -> @in, $exp {
}
done-testing;
-
-
diff --git a/challenge-270/0rir/raku/ch-2.raku b/challenge-270/0rir/raku/ch-2.raku
index f24267dade..998b987b0f 100644
--- a/challenge-270/0rir/raku/ch-2.raku
+++ b/challenge-270/0rir/raku/ch-2.raku
@@ -1,8 +1,6 @@
#!/usr/bin/env raku
# :vim ft=raku sw=4 expandtab # 🦋 ∅∪∩∋∈∉⊆ ≡ ≢ «␤ » ∴
use v6.d;
-INIT $*RAT-OVERFLOW = FatRat;
-use lib $?FILE.IO.cleanup.parent(2).add("lib");
use Test;
=begin comment
@@ -57,7 +55,6 @@ Level 1: i=3, so $ints[3] += 1
We performed operation Level 1, 1 time and Level 2, 4 times.
So the total cost would be (1 x $x) + (4 x $y) => (1 x 2) + (4 x 1) => 6
-
=end comment
my @Test =
@@ -71,7 +68,6 @@ my @Test =
0, 0, 1, (2,3,3,3,5),
-4, 0, -1, (2,3,3,3,5),
-
1, 1, 0, (2,3,3,3,5),
9, 1, 2, (2,3,3,3,5),
9, 1, 3, (2,3,3,3,5),
@@ -111,8 +107,6 @@ multi task( @int, Nat $x, Nat $y where * > $x × 2 ) { Xx( @int, $x ) }
multi task( @int, Neg $x, $y where * ≥ $x × 2 ) { Xx( @int, $x, $y) }
multi task( @int, Neg $x, $y where * < $x × 2 ) { Yx( @int, $x, $y) }
-
-
only task-B( @int, $x, $y --> Int) {
if ( @int ~~ [,] ) { return Int }
@@ -163,10 +157,9 @@ sub Yx( @int, $x, $y) {
$cost
}
-
for @Test -> $exp, $x, $y, @int {
- is task( @int, $x, $y), $exp, ($exp // "Int") ~ " <- " ~ $x ~ ' ∘ ' ~ $y~" ∘ @int.raku()";
- is task-B( @int, $x, $y), $exp, ($exp // "Int") ~ " <- " ~ $x ~ ' ∘ ' ~ $y~" ∘ @int.raku()";
+ is task( @int, $x, $y), $exp, ($exp // "Int") ~ " <- $x ∘ $y ∘ @int.raku()";
+ is task-B( @int, $x, $y), $exp, ($exp // "Int") ~ " <- $x ∘ $y ∘ @int.raku()";
}
done-testing;