aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-086/wambash/raku/ch-1.raku3
1 files changed, 2 insertions, 1 deletions
diff --git a/challenge-086/wambash/raku/ch-1.raku b/challenge-086/wambash/raku/ch-1.raku
index fe798ce7b1..5e20c27832 100644
--- a/challenge-086/wambash/raku/ch-1.raku
+++ b/challenge-086/wambash/raku/ch-1.raku
@@ -4,12 +4,13 @@
sub pair-difference ( $a, +@n ) {
@n
andthen .combinations(2)
- andthen .first: {abs( .[0] - .[1] ) == $a}
+ andthen .first: { abs( .[0] - .[1] ) == abs $a }
}
multi MAIN (Bool :$test) {
use Test;
is pair-difference( 7, (10, 8, 12, 15, 5)), (8, 15);
+ is pair-difference(-7, (10, 8, 12, 15, 5)), (8, 15);
is pair-difference( 6, (1, 5, 2, 9, 7)), (1, 7);
is pair-difference(15, (10, 30, 20, 50, 40)), Nil;
}