
Help understanding scan adverb
Hi,
I understand how scan works with a diadyc function such as (+) or (*), and hence implemented my version of a exponential moving average like that :fun_ema:{[lambda; liste];
({[lambda; x; y]; (lambda*y)+ (x*1lambda)}[lambda]\) liste
}
In the book I am reading, their operation over 1million lines is almost 2.5 times faster with this structure:
expma1:{[lambda;vector]
/ lambda — memory
/ vector — data
{[x;y;z] (x*y)+z}\[ first vector; 1 – lambda; vector * lambda]
};
Can someone explain how it works ?
Thank you very much
Log in to reply.