TransWikia.com

Whole 2 line code, producing a bug (infix operator)

Mathematica Asked on May 30, 2021

Copy the following code, and create new 0 byte file, and paste the code and save it to TEST.nb

Notebook[{
Cell[BoxData[
 RowBox[{"a", "[CircleMinus]", "b", "[CircleMinus]", "c", "[CircleMinus]", 
  "d"}]], "Input",
 CellLabel->"In[1]:=",ExpressionUUID->"dd7bd8a7-440c-445a-8fd1-5a45ab09d900"],

Cell[BoxData[
 RowBox[{"a", "[CircleMinus]", 
  RowBox[{"b", "[CircleMinus]", 
   RowBox[{"c", "[CircleMinus]", "d"}]}]}]], "Input",
 CellLabel->"In[2]:=",ExpressionUUID->"765feda5-1dfc-460d-9708-11c014613ad9"]
},
WindowSize->{937, 778},
WindowMargins->{{221, Automatic}, {Automatic, 21}},
FrontEndVersion->"11.3 for Microsoft Windows (64-bit) (March 6, 2018)",
StyleDefinitions->"Default.nb"
]

enter image description here

Execute the TEST.nb, then you will see pic1.

After running (=produce output) 1st input, you will see pic2.

After running 2nd input, you will see pic 3.

Surprisingly, the output is different from that of pic2!

You see parentheses not seen in pic 2.

Run 1st input again, and 2nd input again, see pic 4.

There are no changes for each input.

Now select the last character of the 2nd input code, see pic 5.

You see ‘d’ is highlightened with blue color.

Press ‘d’ of your keyboard, see pic 6.

You might think this procedure is completely meaningless.
(select ‘d’ and press ‘d’ of the keyboard? that surely is a nothing!)

Run 2nd input again, see pic 7.

Surprisingly, the output has changed now!
Now the output for 2nd input is the same as that of 1st input.

Can you explain this phenomenon? a bug ?

I got the code while creating custom operators.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP