We define
list = {x, x^2, x^3};
rules = {x -> 1, x -> 2, x -> 3};
and then
Inner[ReplaceAll, list, rules, List]
ReplaceAll @@@ Thread[{list, rules}]
Table[list[[i]] /. rules[[i]], {i, Length@rules}]
fnctn = #1 /. #2 & @@@ Transpose@({##}) &;
fnctn[list, rules]
MapIndexed[#^# &, Range@Length@list]
Last /@ Power[List @@@ rules, Range[Length@rules]]
- Anyone likes
While
? I don't but it works
Module[{return = {}, i = 1, end = Length@list},
While[i <= end,
AppendTo[return, list[[i]] /. rules[[i]]]; i++]; return]
- (I hate myself) using
For
because...why not?
Module[{return = {}}, For[
i = 1, i <= Length@list, i++,
AppendTo[return, list[[i]] /. rules[[i]]]];
return]
all of the above give
{1, 4, 27}