I've occasionally done the inverse of this: given data, i.e. from a database
table, indexed by two columns, build the 2-D array conceptually represented
by the normalized form.

So, starting with the database form as "detbl", re-table it:

  detbl=. ('id';'cat';'val'),(ax0#~(#dat)%#ax0),.(ax1$~#dat),.dat
  ]retbl=. (}.2{"1 detbl) (<"1 |:(] i.~ ~.)&><"1]0 1{|:}.detbl)}4 5$<''
+--+--+--+--+--+
|0 |1 |2 |3 |4 |
+--+--+--+--+--+
|5 |6 |7 |8 |9 |
+--+--+--+--+--+
|10|11|12|13|14|
+--+--+--+--+--+
|15|16|17|18|19|
+--+--+--+--+--+


On 2/7/07, Chris Burke <[EMAIL PROTECTED]> wrote:

Why is this a common operation? Anyway:

...
--
Devon McCormick
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to