Index   <<   >>

That’s the key!
/.

Suppose we have a two-row table of account numbers and costs

   Table
  1004  1006  1004   1005 1005  1006 1006  1001  1002  1002
102.41 90.89 88.93 103.22 76.5 97.84 98.1 99.83 78.76 75.47

The key adverb (/.) permits applying a function by keys. To summarize (+/) the amounts in the bottom row by the account number keys (/.) in the top row, using the insert adverb (/) to provide the left and right arguments, write

   (SumAmounts=.+//./) Table
191.34 286.83 179.72 99.83 154.23

The set of account numbers, in the order in which they appear in the top row ({.), and the counts by account, using nub (~.) laminated (,:) on count by key (#/.~) on the top row ({.):

   (AccountsCounts=.(~. ,: #/.~)@{.) Table
1004 1006 1005 1001 1002
   2    3    2    1    2

Display the information in a transposed (|:) format, with the rows sorted (/:~) by account, and a verb for the finished report

   Report=.Form@(AccountsCounts,SumAmounts)
   Report Table
1001 1  99.83
1002 2 154.23
1004 2 191.34
1005 2 179.72
1006 3 286.83