sum (insert) and count apply to items.  The items are the rows.

+/ 3 2 $ 1 2 3

6 6

the result is a list.  If there is just 1 column (one result), it is still a 
list.




On Wednesday, April 15, 2020, 01:33:35 p.m. EDT, Thomas Bulka 
<[email protected]> wrote: 





Hello everyone,

I do have some difficulties in understanding a certain behavior. Let's 
assume, I define the classical mean verb, a row vector and a column 
vector:

mean =: +/ % #
rvec =: 1 2 3
cvec =: 3 1 $ 1 2 3

When I apply mean to rvec I get the result 2 (as expected), which 
happens to be a scalar ($$ mean rvec yields 0). When I apply mean to 
cvec the result is a vector ($$ mean cvec yields 1). I'd like to 
understand, why this behavior has been chosen. Do you have any hints for 
me?

Regards,

Thomas

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

Reply via email to