I don't quite have all the details worked out, but I am thinking in the
following direction.

   data=:  0 : 0   NB. notice this is different from June's data
0 p1 4
2 p1 6
3 p1 10
13 p1 15
0 p2 3
1 p2 5
7 p2 10
10 p2 11
14 p2 12
1 p3 9
5 p3 10
9 p3 20
7 p4 10
)
   $dd =.  ".@(-.&'p') ;._2 data


Now I want to use scarce arrays $. on dd, but cannot figure out how
exactly. I thought I would study the following example from the Vocabulary
page, but I don't remember how to rewrite dd as a sparse array.

  ] d=: (?. 3 4$2) * ?. 3 4$100
 0  0  0 0
85  0  0 0
 0 59 33 0
   ] s=: $. d
1 0 │ 85
2 1 │ 59
2 2 │ 33

In other words I don't know how to manually create an artificial version of
the noun s above. I know it can be done. And if that is done with my noun
dd, then it should be simple to create your result.


-- 
(B=)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to