From d8cd2a64a6b98129b0f33dfcf5de55d3f3aeed54 Mon Sep 17 00:00:00 2001 From: Mark A Date: Mon, 22 Mar 2021 12:04:57 -0600 Subject: initial --- challenge-105/mark-anderson/raku/ch-1.raku | 13 +++++-------- 1 file 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; } -- cgit