Skip to content

Commit

Permalink
Finally work out which bit of bit shifting I need
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Proctor committed May 4, 2020
1 parent a90dbb2 commit 926adde
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions challenge-059/simon-proctor/raku/ch-2.raku
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 926adde

Please sign in to comment.