Bug introduced in 7.0 or earlier and persisting through 11.0
While looking at A question about conditional replacement I think I discovered a bug in the Front End that affects both 7.0.1 and 10.0.1 under Windows.
If I copy and paste this line into a new Cell in a Notebook:
{g[x, y, z], h[x, y], f[]} /. (f_[t___] /; f != List) :> Plus[t]
then select ≠ (auto-converted to single character) and type over it =!= and evaluate I get:
{g[x, y, z], h[x, y], f[]}
Rather than the expected:
{x + y + z, x + y, 0}
If I use menu Cell > Convert To > InputForm the input cell is converted to:
{g[x, y, z], h[x, y], f[]} /. ((f_)[t___] /; f) =!= List :> Plus[t]
Note the parentheses: ((f_)[t___] /; f) is grouped separately from =!= List. The RHS therefore evaluates to:
True :> +t
Does this problem affect all recent versions on all platforms or is it more localized?
CelltoInputFormI just add//Holdat the end of the expression and evaluate it again. – Alexey Popkov Nov 02 '14 at 05:03=!=, or edit anything else inside the parantheses, it gives the expected output. – kglr Nov 02 '14 at 05:14=!=you can simply go left of thefand press Ctrl+. for expand selection. You see that the front-end parses it incorrectly because/;seems to have a higher precedence. Weird. Btw, M8.0.4 on OSX. – halirutan Nov 02 '14 at 05:49InputForm, in the first line there's actually a(a/*b)@*c.) This was on Mathematica 11.0. – Martin Ender Sep 23 '16 at 15:31