diff options
| -rw-r--r-- | challenge-270/0rir/raku/ch-1.raku | 7 | ||||
| -rw-r--r-- | challenge-270/0rir/raku/ch-2.raku | 11 |
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; |
