Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,8 @@
|
|||
fcn SMA(P){
|
||||
fcn(n,ns,P){
|
||||
sz:=ns.append(n.toFloat()).len();
|
||||
if(P>sz) return(0.0);
|
||||
if(P<sz) ns.del(0);
|
||||
ns.sum(0.0)/P;
|
||||
}.fp1(List.createLong(P+1),P) // pre-allocate a list of length P+1
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
T(1,2,3,4,5,5,4,3,2,1).apply(SMA(3)).println();
|
||||
T(1,2,3,4,5,5,4,3,2,1).apply(SMA(5)).println();
|
||||
Loading…
Add table
Add a link
Reference in a new issue