a. The monad { computes a generalized Cartesian 
product.  For example:

   {0 1 2;3 4 5 6
+---+---+---+---+
|0 3|0 4|0 5|0 6|
+---+---+---+---+
|1 3|1 4|1 5|1 6|
+---+---+---+---+
|2 3|2 4|2 5|2 6|
+---+---+---+---+

b. When using the dyad u/ to compute a function
table, it can be helpful to apply <"_2 to the
result.  For example:

   t=: 2 2&$"1 #: i.16     NB. all 2-by-2 boolean matrices
   det=: -/ .*             NB. determinant
   $t
16 2 2
   t=: (0~:det t)#t        NB. non-singular 2-by-2 boolean matrices
   $t
6 2 2
   t=: t /: (,:=0 1) i. t  NB. put identity matrix first
   <"2 t
+---+---+---+---+---+---+
|1 0|0 1|0 1|1 0|1 1|1 1|
|0 1|1 0|1 1|1 1|0 1|1 0|
+---+---+---+---+---+---+
   $ ~:/ .*"2/~ t
6 6 2 2
   <"_2 ~:/ .*"2/~ t       NB. group table
+---+---+---+---+---+---+
|1 0|1 1|1 1|0 1|1 0|0 1|
|0 1|0 1|1 0|1 1|1 1|1 0|
+---+---+---+---+---+---+
|1 0|1 1|1 1|0 1|1 0|0 1|
|1 1|1 0|0 1|1 0|0 1|1 1|
+---+---+---+---+---+---+
|0 1|0 1|1 0|1 1|1 1|1 0|
|1 1|1 0|0 1|1 0|0 1|1 1|
+---+---+---+---+---+---+
|1 1|1 0|0 1|1 0|0 1|1 1|
|1 0|1 1|1 1|0 1|1 0|0 1|
+---+---+---+---+---+---+
|1 1|1 0|0 1|1 0|0 1|1 1|
|0 1|0 1|1 0|1 1|1 1|1 0|
+---+---+---+---+---+---+
|0 1|0 1|1 0|1 1|1 1|1 0|
|1 0|1 1|1 1|0 1|1 0|0 1|
+---+---+---+---+---+---+


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to