[Jprogramming] Sum of empty vector
Anssi Seppälä
anssi.seppala at enease.fi
Mon Jul 10 02:00:54 HKT 2006
Thanks, also the _. indeterminate could be the scalar. This seems to
be a convention of long history and better to get used to it.
At 19:33 9.7.2006, you wrote:
>Anssi Seppälä:
> > (+/ % #) 0$0 NB. mean of empty sample is also zero !
> > 0
> >
> > I wonder why (+/0$0) could not be 0$0 instead of 0 ?
>Because it must be scalar and there is no such thing as empty scalar.
>
>You can use (+/ % $) 0$0
>In this case result will be 1-element vector in case of non-empty list
>argument
>and empty vector in case of empty list argument.
>
>nsg
>----------------------------------------------------------------------
>For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list