I am a little confused with this two functions: AppendTo
adds and resets the variable while Reap
and Sow
have the attribute Hold
and do not return unless finished:
t = Flatten[Reap[For[i = 1, i < 40, i++, Drop[t,{3}]; Print[t]; Sow[i]]][[2]]]
This will print just t
40 times, not iteratively.
How can I construct a list so that it would update variable in a process of creation as some operations needs to be performed on it meanwhile? This is straightforward with AppendTo
but not so with Reap
or anything else.
Thanks.