Le 11/02/2020 à 02:37, Federico Miyara a écrit :

Thanks, Samuel.

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,

Right

Regards
Samuel


_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

Reply via email to