Anssi Seppälä wrote:
> (+/ % #) 0$0 NB. mean of empty sample is also zero !
> 0
> I wonder why (+/0$0) could not be 0$0 instead of 0 ?
Why change the language when you can change the program?
meanAnssi=: [EMAIL PROTECTED] {. +/ %#
Of course, this has a technical quirk: the result is a list,
rather than a scalar.
In a later email you suggested:
> Thanks, also the _. indeterminate could be the scalar. This seems to
> be a convention of long history and better to get used to it.
Heading this direction,
div=: %`(_."0)@.(e.&0 [EMAIL PROTECTED]"0)
meanAnssi2=: +/ div #
Note, however, that if you plan on using _. extensively you'll
probably need to add the kind of support you are looking for
to most of the operations you plan on using. Support from the
hardware side of the fence in J's algorithms can be rather
quirky.
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm