Talk:Averages/Simple moving average: Difference between revisions
Talk:Averages/Simple moving average (view source)
Revision as of 14:17, 30 January 2014
, 10 years ago→J Alternate Implementation
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
Here is a streaming variant of the J implementation, with a description:
Line 41:
)</lang>
The "inner" (most indented) definition is a verb which takes two arguments: A
The "outer" definition here is a conjunction which takes two arguments: A number (<code>m</code>) and the verb (<code>v</code>) defined above. In this outer definition, <code>a=.cocreate<nowiki>''</nowiki></code> defines a new, empty namespace <code>a</code>. Then, <code>n__a=.m#_.</code> populates the name <code>n</code> in that namespace with <code>m</code> NaN values. Finally, we curry the verb <code>v</code> with this namespace and return the derived verb.
|