aboutsummaryrefslogtreecommitdiff
path: root/challenge-083/conor-hoekstra/apl/ch-2.apl
blob: f71f9c1cbae9a0efd14d16ebbd73b1036078ad3d (plain)
1
2
3
4
5
6
7
8
9
 flipArray  {
    m  2(¯1)¯1+2*≢ ⍝ mask
    s  +/x(×1)1-2×m    ⍝ sums
    /(+/m)/⍨s=⌊/s/⍨0s
 }

⍝ Tests
flipArray 2 10 12 ⍝ 1
flipArray 3 10 8  ⍝ 1