We define the following lists:
list = {x, x^2, x^3};
rules = {x -> 1, x -> 2, x -> 3};
And then we can run
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]
- After a lot of trial and error
smthng = {#1 /. #4, #2 /. #5, #3 /. #6} & @@ (## & @@@ {##}) &;
smthng[list, rules]
All of the above give
{1, 4, 27}