When I run this code:
S={a,b};
G=Subsets[S];
R=Table[SymmetricDifference[G[[i]],G[[j]]],{i,1,Length@G},{j,1,Length@G}];
TableForm[R/.({#1->1,#2->2,#3->3,#4->4}&@@G)]
It works as desired, ie: It outputs:
But when I do this with T being a list with the Slot[i] -> i:
S={a,b};
G=Subsets[S];
R=Table[SymmetricDifference[G[[i]],G[[j]]],{i,1,Length@G},{j,1,Length@G}];
T=Table[Slot[i]->i,{i,Length@G}];
TableForm[R/.(T&@@G)]
I get:
I don't understand why this change of behavior happens. Can you help me?
![>[![enter image description here][1]][1]](../../images/214a41bfe33d8bcf29b428a1050d154d.webp)

FunctionisHoldAll. UseTableForm[R /. (Evaluate[T] & @@ G)]. – Domen Nov 10 '23 at 15:02expr = #; {expr &@aaaaaa, Evaluate[expr] &@aaaaa}– xzczd Nov 10 '23 at 15:03TableForm[Map[First@FirstPosition[G, #] &, R, {2}]]. Or, since we know the elements ofGare unique,TableForm[Map[First@Position[G, #] &, R, {2}]]. When I saw{#1 -> 1, #2 -> 2, #3 -> 3, #4 -> 4} & @@ G, I asked myself "isn't that just mapping each element to its position?". – lericr Nov 10 '23 at 17:21