diff options
| author | Simon Proctor <simon.proctor@zoopla.co.uk> | 2020-05-04 10:05:53 +0100 |
|---|---|---|
| committer | Simon Proctor <simon.proctor@zoopla.co.uk> | 2020-05-04 10:05:53 +0100 |
| commit | 926addea943c4d8b64fa8c5476a931d55379593c (patch) | |
| tree | a9d9653d16b29975ae7844e68461e4350a502458 /challenge-059/simon-proctor | |
| parent | a90dbb2e870a8c05e561017ff001454842ffcce2 (diff) | |
| download | perlweeklychallenge-club-926addea943c4d8b64fa8c5476a931d55379593c.tar.gz perlweeklychallenge-club-926addea943c4d8b64fa8c5476a931d55379593c.tar.bz2 perlweeklychallenge-club-926addea943c4d8b64fa8c5476a931d55379593c.zip | |
Finally work out which bit of bit shifting I need
Diffstat (limited to 'challenge-059/simon-proctor')
| -rw-r--r-- | challenge-059/simon-proctor/raku/ch-2.raku | 4 |
1 files changed, 1 insertions, 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 |
