< quote href = 
http://www.jsoftware.com/help/jforc/loopless_code_i_verbs_have_r.htm#_Toc141157987

consider the new verb monad +/, which creates the total of the items
of its operand (just think of it as 'monad SumItems'):

  +/ 1 2 3

6

The result was 1 + 2 + 3, as expected.

</ quote>

To be honest, it would be nice if this result were fleshed out because
all the prior examples in this section were based on operands of
rank-2. This rank-1 example can be tricky to a beginner because the
items of a 1-cell are not arrays, but atoms. Here is my fleshing out
of this example:

+/ i. 3

The verb rank is 0 and the noun rank is 1, therefore, r is 1 and so we
will be applying the verb to 1-cells. The frame f is empty.

Think of the operand as an empty array of 1-cells [??? sounds weird]
So the operand is a single 1-cell: 0 1 2
It is not an array of anything in this case.

The verb is applied to each cell, and we only have a single 1-cell:
+/ 0 1 2

Since +/ creates a total of the _items_ of it operand, we must find
the _items_ of our operand. The items of a 1-cell are 0-cells. So the
members of the 1-cell are our _items_.
And +/ will create the total of them, yielding 3



I am thankful for for Figure 1 on this page:
http://www.jsoftware.com/help/jforc/loopless_code_i_verbs_have_r.htm#_Toc141157986
because I simply imitated the step-by-step thought process there to
come up with the fleshing out that I attempted above.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to