From 926addea943c4d8b64fa8c5476a931d55379593c Mon Sep 17 00:00:00 2001 From: Simon Proctor Date: Mon, 4 May 2020 10:05:53 +0100 Subject: Finally work out which bit of bit shifting I need --- challenge-059/simon-proctor/raku/ch-2.raku | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/challenge-059/simon-proctor/raku/ch-2.raku b/challenge-059/simon-proctor/raku/ch-2.raku index 4ed143b303..ad595b2d8c 100644 --- a/challenge-059/simon-proctor/raku/ch-2.raku +++ b/challenge-059/simon-proctor/raku/ch-2.raku @@ -2,12 +2,10 @@ use v6; -multi sub bit-diff( UInt $a, UInt $b where $a >= $b ) { +sub bit-diff( UInt $a, UInt $b ) { [+] ($a +^ $b).base(2).comb; } -multi sub bit-diff( UInt $a, UInt $b ) { bit-diff( $b, $a ) } - #| Give the sum of the differences in bits between all the combinations of inputs sub MAIN ( *@vals where { $_.all ~~ UInt } #= Integer values to combine -- cgit