I just had a few questions on list and function operations.
1) If I have a function f[] and a list list, I want to apply f[] sequentially to every element of the list, much like Scan does, but rather than Map, Apply, or even Nest does. How to do this?
2) If I have a list list and an index list ind, how can I assign values to the corresponding elements given another list of values? Map[list[[#]] &, ind] = value_list will give Set::write: Tag Map in ... is Protected error.
3) How to apply a function f[] n times and form a result list, instead of composing the function n times as the function Nest does? Is it Map[f[],Range[n]]?
EDIT
In response to the comment, here are a few simple examples all involving how to set elements with specified indices to zero in a list. There examples are supposed for illustrating purposes. Of course, there must be better options to do these tasks. I just tired these out before coming to the working one like setZeroWithIndex[list_, ind_] := Module[{}, list[[ind]] = ConstantArray[0, Length[ind]];
Return[list]];
1) setZeroWithIndex[list_, ind_] := Scan[ReplacePart[list, # -> 0] &, ind];. This does not work. Replacing Scan with Map, Apply etc. does not work either.
2)setZeroWithIndex[list_, ind_] := Map[list[[#]] &, ind] = ConstantArray[0, Length[ind]];
mylist = Range[20]; setZeroWithIndex[mylist, {2, 4, 6}]. Got the error I posted.
3) setZeroWithRandomIndex[list_] := ReplacePart[list, RandomInteger[{1,Length[list]}] -> 0]. Now I just want to apply setZeroWithRandomIndex n times instead of functionally composing it many times. NestList does not seem to work here.