aboutsummaryrefslogtreecommitdiff
path: root/challenge-059/richard-park/apl/ch-2.aplf
blob: b29788237ac8a53d1ca623c2901b0c1e1d0609af (plain)
1
2
3
4
5
6
7
8
 BitSum{
⍝ ⍵: List of positive integers
⍝ ←: Sum of differing bits between binary
⍝      representations of all unique pairs in ⍵
     BSP{+2¯1 }   ⍝ Bit Sum of Pairs
     bs+/,∘.BSP          ⍝ The bit sum of all pairs in ⍵
     bs÷2                   ⍝ Outer product ∘.f double counts
 }