I don't know how to use filter and unfortunately the Help Documentation of filter is not useful enough for me. I'd like to use filter to code the following recursive formula
x(i+1) = a(i)*x(i), i = 1, 2 , ..., n,
where a(i) is some function of i. Assume x(1) = 2. I don't want to use a for loop for possibly faster implementations.