diff options
| author | drbaggy <js5@sanger.ac.uk> | 2022-05-08 08:04:12 +0100 |
|---|---|---|
| committer | drbaggy <js5@sanger.ac.uk> | 2022-05-08 08:04:12 +0100 |
| commit | a5b711a0196a2bf2ff86c36757cae2f0cdd97be5 (patch) | |
| tree | 2161caa4481b0c331aa06335e050886dcdf68d30 /challenge-163 | |
| parent | 2814f8bf07f0bf1b654057526b6cdfd760057fb1 (diff) | |
| parent | 378828e25342e038d6f8aeeab4c9a5aad899c169 (diff) | |
| download | perlweeklychallenge-club-a5b711a0196a2bf2ff86c36757cae2f0cdd97be5.tar.gz perlweeklychallenge-club-a5b711a0196a2bf2ff86c36757cae2f0cdd97be5.tar.bz2 perlweeklychallenge-club-a5b711a0196a2bf2ff86c36757cae2f0cdd97be5.zip | |
Merge branch 'master' of github.com:drbaggy/perlweeklychallenge-club
Diffstat (limited to 'challenge-163')
| -rw-r--r-- | challenge-163/james-smith/README.md | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/challenge-163/james-smith/README.md b/challenge-163/james-smith/README.md index e278943aa3..8922aac730 100644 --- a/challenge-163/james-smith/README.md +++ b/challenge-163/james-smith/README.md @@ -75,11 +75,10 @@ the most natural way of executing the code - in fact it doesn't matter which way also use `pop` which is two bytes shorter.. ```perl -#--------1---------2---------3---------4---------5---------6---------7---------8---------9 -#23456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 - -sub bsm{$a=0;%^H=map{$_,1}@_;@_=map{$_+0}keys%^H;$b=pop,map{$a+=$b&$_}@_ while@_;$a} ## 84 chars -sub bsu{$a=0;@_=map{$_+0}@_;$b=pop,map{$a+=$b&$_}@_ while@_;$a} ## 63 chars +#--------1---------2---------3---------4---------5---------6---------7---------8 +#2345678901234567890123456789012345678901234567890123456789012345678901234567890 +sub bsm{$a=0;%^H=map{$_,1}@_;@_=keys%^H;$b=0+pop,map{$a+=$b&$_}@_ while@_;$a} ## 77 chars +sub bsu{$a=0;$b=pop,map{$a+=$b&$_}@_ while@_;$a} ## 48 chars ``` # Challenge 2 - Summations @@ -147,5 +146,4 @@ Below are code equivalent to the above - with all spaces removed - we use the sp ```perl #--------1---------2---------3---------4---------5 #2345678901234567890123456789012345678901234567890 - sub sum{shift,$a=0,@_=map{$a+=$_}@_ while@_>1;$a} ## 49 chars |
