Hi, first time poster, new J user.
I cannot figure out how to do a certain sorta algorithm in J without a for
loop.
I have an array of data:
a1=: 10 7 8 3 5

and the other to be calculated iteratively, except for the first value which
is already known.
a2=: 6

So I need to take the 6 and pair it with 10, do some calculations append the
new number to the end of a2.
I used this function to do this

GetEWMAData =: monad : 'for_x. }.SubGroupedData do. EWMAData=:EWMAData,
(lambda*x)+((1-lambda)*({:EWMAData)) end.'

where lambda is 0.2, SubGroupedData is a1 here and EWMAData is a2, getting
updated by appending the new number to the end of the list.
Is there a way to do this without having the reassigning EWMAData itself
with something appended to it, and using a for loop?
Thanks!
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to