On 8 Jun 2011, at 15:41, Squint6 wrote:
> a=. 2 2 $ i.4
>
> b=.+/a
>
> c=.+/"1 a
>
> After executing these lines
> a contains
> 0 1
> 2 3
> b contains 2 4 and
> c contains 1 5
>
> I understand where b is coming from but c's value confuses me. Here's how my
> (faulty) reasoning about c=.+/"1 a goes. The "1 applies to the verb (+/)
> giving it a rank of 1. Therefore (+/) is applied to the 1-cells of a, which
> I believe are the lists (0 1) and (2 3). Therefore we have 0 1 + 2 3 which
> should be 2 4. Wrong, right? But why.
The 1-cells of a are indeed the lists (0 1) and (2 3).
Apply +/ to each of those 1-cells, and you obtain the
results 1 and 5, your c.
Try executing
+/"0 a
+/"1 a
+/"2 a
+/ a
and remember that / is called "insert".
-Dan
--
Dan T. Abell :: dabell at txcorp dot com :: 303.444.2452
Tech-X Corp., 5621 Arapahoe Ave, Ste A, Boulder CO 80303
http://www.txcorp.com :: 303.748.6894/c 303.448.7756/fx
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm