Bug introduced in 11.3 or earlier, persisting through 12.0 or later and fixed in 12.3.1 or earlier
[CASE:4352435] and [CASE:4354378]
In Mathematica 11.3 and 12.0,
ReplaceList[{2,2},{u_,Except[u_|1]}:>True]
incorrectly returns
{True}
In earlier versions (10.1, 10.3, 11.0, 11.1) executing the above code causes the kernel to hang, requiring it to be quit, so this appears never to have worked correctly. See also the Answer below.
In addition, in the earlier versions, the following also hangs:
ReplaceList[{2, 3}, {u_, Except[1 | u_] ..} :> True]
Using Replace
instead of ReplaceList
is fine; SequenceCases
behaves incorrectly like ReplaceList
.
The issue is also seen with orderless matches (which presumably are represented by alternatives internally); for example,
ReplaceList[{2 x, 2 x}, {2 u_, Except[2 u_]} :> True]
incorrectly returns
{True}
in 11.3 and 12.0.
-- The above has been revised as a result of feedback and further testing.
ReplaceList
andSequenceCases
work for me in version 12. $\endgroup$ReplaceList[{2, 3}, {u_, Except[1 | u_] ..} :> True]
evaluated instantly and returned{True}
in V11.3.0 running on MacOS 10.13.4 $\endgroup$