aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-105/mark-anderson/raku/ch-1.raku13
1 files changed, 5 insertions, 8 deletions
diff --git a/challenge-105/mark-anderson/raku/ch-1.raku b/challenge-105/mark-anderson/raku/ch-1.raku
index 9e999f44b4..40ed417fbb 100644
--- a/challenge-105/mark-anderson/raku/ch-1.raku
+++ b/challenge-105/mark-anderson/raku/ch-1.raku
@@ -1,5 +1,9 @@
#!/usr/bin/env raku
+#
+# With help from the solutions by Luca and E Choroba.
+#
+
use Test;
plan 2;
@@ -8,12 +12,5 @@ is nth-root(5, 34), 2.02;
sub nth-root($n, $k)
{
- my $x = .narrow given $k ** (1/$n);
-
- unless $x ~~ UInt
- {
- $x .= fmt("%.2f");
- }
-
- $x;
+ $k.roots($n).first.fmt("%.2f") + 0;
}