In principle, what I want to use the following to generate a named pattern for later use:
In[1]:= Replace[var["x"],var[name_]:>Pattern[Apply[Symbol,name],_]]
I expected to see this result. A named pattern which I can use in subsequent rules:
Out[1]= x_
But instead, I got:
Out[1]= Pattern[Symbol @@ x,_]
The documentation says that Pattern[..] can only be used with a symbol as the first argument. Apply[Symbol, name] is not evaluated to return a symbol, so the Pattern[..] does not match.
Ho do I get a named pattern from some string name?