aboutsummaryrefslogtreecommitdiff
path: root/challenge-163/conor-hoekstra/apl/ch-2.apl
blob: 834ff7f4a55a11a817b52cf0e0056c94e7916f64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
      summations  {⊖⌽1↑⍕¨¨¨1{,⊂+\1↓⊃}()}
      
      ⍝ Tests
      summations 1 2 3 4 5
┌──┬──┬──┬──┬──┐
1 2 3 4 5 
├──┼──┼──┼──┼──┤
  2 5 9 14
├──┼──┼──┼──┼──┤
    5 1428
├──┼──┼──┼──┼──┤
      1442
├──┼──┼──┼──┼──┤
        42
└──┴──┴──┴──┴──┘
      summations 1 3 5 7 9
┌──┬──┬──┬──┬──┐
1 3 5 7 9 
├──┼──┼──┼──┼──┤
  3 8 1524
├──┼──┼──┼──┼──┤
    8 2347
├──┼──┼──┼──┼──┤
      2370
├──┼──┼──┼──┼──┤
        70
└──┴──┴──┴──┴──┘