Talk:Averages/Simple moving average: Difference between revisions
Talk:Averages/Simple moving average (view source)
Revision as of 14:16, 30 January 2014
, 10 years agoJ: remove some ambiguity
Walterpachl (talk | contribs) (→PL/I and problem description: please add framework and output) |
m (J: remove some ambiguity) |
||
Line 28:
:: Please add the framework (Proc Options(main)) to show how this could be used.--[[User:Walterpachl|Walterpachl]] ([[User talk:Walterpachl|talk]]) 09:54, 30 January 2014 (UTC)
== J ALternate Implementation ==
Here is a
<lang J>lex =: conjunction define(dyad define)
Line 41:
)</lang>
The "inner" (most indented) definition is a verb which takes two arguments: A number (<code>y</code>) and a namespace (<code>x</code>). In the inner definition <code>n__x=.1|.!.y n__x</code> shifts the number <code>y</code> into the list named <code>n</code> in the <code>x</code> namespace. Then, <code>(+/%#)(#~1-128!:5)n__x</code> removes all NaN values from the list and finds the average of the values that remain.
The "outer" definition here is a conjunction which takes two arguments: A number (<code>m</code>) and
--[[User:Rdm|Rdm]] 18:04, 7 June 2010 (UTC)
|