From bbd71ad749ca5dd0e81a0a5e0a156017b2083338 Mon Sep 17 00:00:00 2001 From: Stephen Lynn Date: Tue, 6 Jun 2023 16:43:52 +0800 Subject: ch-2.p6 fix --- challenge-220/steve-g-lynn/raku/ch-2.p6 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/challenge-220/steve-g-lynn/raku/ch-2.p6 b/challenge-220/steve-g-lynn/raku/ch-2.p6 index 712e9eb8e8..edeea0a7ac 100755 --- a/challenge-220/steve-g-lynn/raku/ch-2.p6 +++ b/challenge-220/steve-g-lynn/raku/ch-2.p6 @@ -9,9 +9,9 @@ multi sub is_perfect_square( @ints ) { } sub squareful (@ints where @ints.elems==3) { - @ints.permutations.grep( {$_.&is_perfect_square} ) + @ints.permutations.grep( {$_.&is_perfect_square} ).unique( :with(&[eqv]) ); } say &squareful((1,17,8)); #(1,8,17),(17,8,1) -say &squareful((2,2,2)); #((2 2 2) (2 2 2) (2 2 2) (2 2 2) (2 2 2) (2 2 2)) .permutations treats each element of @ints as unique, so all 6 permutations are returned. +say &squareful((2,2,2)); #((2 2 2) -- cgit