A nasty combination of too much recent programming in loopy languages
combined with advancing age has dulled my memory of how to properly grow a
rate adjusted series without looping. The following solves my immediate
problem but my sense of J aesthetics is appalled.

Would anyone care to provide a more J'ey solution.

AccumulateSeries2=:4 : 0


NB.*AccumulateSeries2 v-- accumulate rate adjusted current and

NB. future series credits and charges.

NB.

NB. dyad: nl =. ia AccumulateSeries2 ntSeriesGrowth

NB.

NB. sr=. ((5#100),0 0 _80 0 0 200 200) ,: (6#1),6$1.001667 0.98 1

NB. (3 AccumulateSeries2 sr) ,: 0{sr


'sv gr'=. y


NB. forward last actuals and accumulate rate adjusted

pv=. x {. sv

cv=. (_1 {. pv) , x }. sv

cg=. (_1 {. x {. gr) , x }. gr


for_j. i.<:#cv do.

cv=. (((>:j){cv) + (j{cg) * j{cv) (>:j)} cv

end.


pv , }. cv

)


-- 
John D. Baker
[email protected]
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to