I need a Math. function to convert two lists like {0, r}{s, 0} in one list {0->"s","r"->0}; I.e. the letters must be enclosed in " ", but the numbers not. I have one solution:
l2L = Function[{list1, list2}, MapThread[ Rule[If[NumericQ[#1], #1, "\"" <> ToString[#1] <> "\""], If[NumericQ[#2], #2, "\"" <> ToString[#2] <> "\""]] &, {list1, list2}]];
which works
l2L[{0, r, r, i, i, s, s, s}, {s, 0, s, 0, r, 0, r, i}]
but it beeps on 13.3, saying "Assuming a list of rules. Use as a list instead" Can you provide a better version?
For a more challenging example, I need to convert
l1={0, 2 r, 2 r, i + r, i + r, r + s, r + s, r + s}; l2={s, r, r + s, r, 2 r, r, 2 r, i + r};
Here a variation of the answer of @Ajerbajzdanl2L = Replace[Thread[#1 -> #2], x_Symbol :> ToString[x], {2, 3}] &;l2L[l1, l2]
works, but beeps. And if I put just {2} or {3} some letters are not enclosed in " "