Re: undocumented behavior of sum(), prod() and type()
Le 11/02/2020 à 02:37, Federico Miyara
a écrit :
This certainly clarifies how  behaves. But is there a
rationale for sum()==0 and yet cumsum()==?
For sum()==0 :
IMO this is OK. Personnaly, i expect from
sum(A) + sum(B) + .. sum(Z) not to be killed just because one of
the arguments is . So, to me, this case is somewhat distinct
from the A +. A +  works element-wise.
Because a vector is expected from sum(,"r"), that then
would be added in an element-wise way, --> sum(,"r") ans =  is also OK.
I would give the same rationale for prod()==1.
By the way, it would be useful to include
cumsum and cumprod among the examples,