The following makes sense to me:
In[1] = f[a, b] /. f[x__] -> x
Out[1] = Sequence[a, b]
In[2] = f[a, b] /. f[x__] -> {x}
Out[2] = {a, b}
However, the following don't make sense:
In[3] = f[a, b] /. f[x__] -> Length[{x}]
Out[3] = 1
In[4] = f[a, b] /. f[x__] -> Total[{x}]
Out[4] = Sequence[a,b]
I was expecting the following: Out[3] = 2 and Out[4] = a + b, especially considering the value of Out[2]. Am I missing something here? Is there some subtle nuance of BlankSequence that I have missed?
I'm using Mathematica desktop 13.2.1.0 on Debian 11.
f[a, b] /. f[x__] :> Length[{x}]would give2. – Syed Mar 04 '23 at 14:09In[4]? – xzczd Mar 04 '23 at 14:17