Hello,
a = {6, 5, 4, 3, 2, 1}; {{1, 2, 3}, {4, 5, 6}} /. {d_, b_, c_} -> {a[[d]], a[[b]], a[[c]]}
would get errors:
Part::pkspec1: The expression d cannot be used as a part specification. Part::pkspec1: The expression b cannot be used as a part specification. Part::pkspec1: The expression c cannot be used as a part specification. General::stop: Further output of Part::pkspec1 will be suppressed during this calculation.
Is there a way to use them at the same time?
Thanks.
Try this:
a = {6, 5, 4, 3, 2, 1}; {{1, 2, 3}, {4, 5, 6}} /. x_Integer :> a[[x]]
Or
{{1, 2, 3}, {4, 5, 6}} /. {d_, b_, c_} :> {a[[d]], a[[b]], a[[c]]}
Thanks. This works. I don't why it would work.