What about
wmean1=: # %&(+/) [
mean1=: # %&(+/)~ [
1 1 1 (me...@],wmean1) 3 5 8
5.3333333 5.3333333
1 1 2 (me...@],wmean1) 3 5 8
5.3333333 6
R.E. Boss
-----Oorspronkelijk bericht-----
Van: [email protected]
[mailto:[email protected]] Namens Brian Schott
Verzonden: donderdag 5 februari 2009 20:56
Aan: Programming forum
Onderwerp: Re: [Jprogramming] Examples of dyadic forks
To be more specific about weighted means and means
consider the following to definitions.
mean =: +/ % #
wmean =: * %&(+/)[ NB. weighted mean
1 1 1 (m...@],wmean) 3 5 8
5.33333 5.33333
1 1 2 (m...@],wmean) 3 5 8
5.33333 6
On Wed, Feb 4, 2009 at 6:52 PM, Fraser Jackson
<[email protected]> wrote:
> This thread seems to have concentrated on forks using the primitives.
That
> may have been part of John's specification, but one of the joys of J is
its
> ability to express alternative approaches to a problem simply. I think
most
> of the cases of real interest arise with defined functions.
>
> If mean is a dyadic function with weights on the left and values on the
> right, and sd is also dyadic with similar arguments, and both functions
are
> ambivalent with the monadic case weights of 1
>
--
(B=)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm