Consider the following definition:

Piecewise[{{(*comment*)-1, x > 0}, {0, True}}]

This is interpreted as intended, with the comment being simply removed, leaving only -1 in the cell.

But if I enter it via \[Piecewise] followed by Ctrl+, to get the following result, it's interpreted in a wrong way:


Basically, the (*comment*) part is replaced with Null instead of being, as comments are to be, removed completely.

Interestingly, this only happens since Mathematica 8.0 (and is still present in 11.2.0), i.e. I don't reproduce it in 7.0.

So, what's going on here? Has the language or something changed? Or is it simply a front-end bug?

  • $\begingroup$ I could reproduce it in 11.2, but not in 12.0. $\endgroup$ – Szabolcs Mar 15 '20 at 19:01
  • $\begingroup$ Looks like a in how Piecewise tag is interpreted. Here is a quick test: InputForm@ MakeExpression@ StripBoxes@ TagBox[GridBox[{{"\[Piecewise]", GridBox[{{RowBox[{RowBox[{"(**)"}], RowBox[{"-", "1"}]}]}}]}}], "Piecewise"] $\endgroup$ – Kuba Mar 16 '20 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.