I keep hearing that one should avoid loops in Mathematica and try to write everything in functional style. I've seen few examples of how this done on here, but I could't apply to my problem successfully. It would be great to pick up new ideas of doing it.
Some data for consistency:
X = {1, 2, 3, 4};
History = 1;
SomeVals = {};
SomeFunction[x_, y_] := {x, x + y};
I'm trying to rewrite the following loop into functional style:
For[i = 1, i <= Length@X, i++,
{val, History} = SomeFunction[X[[i]]^2, History];
AppendTo[SomeVals, val];
]