The offence
There seem to be a significant amount of new people posting code that looks like this
a = (E^(-2 Abs[\[Gamma] - z Cos[\[Theta]]]^2) \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(j = 0\), \(m\)]\(
\*UnderoverscriptBox[\(\[Sum]\), \(l = 0\), \(m\)]
\*FractionBox[\(1\), \(\(j!\)\ \(l!\)\)] Binomial[m, j]\ Binomial[m, l]\
\*SuperscriptBox[\(Conjugate[ z\ Sin[\[Theta]]\ Tan[\[Theta]]]\), \(j\)]\
Examples: 268606 268222 268172 267133
This String Based Input of Notebook Boxes, is normally created by using a palette or control keys. This form is interpreted by the Front-End without problems, but it is very hard to parse for humans. I call it unreadable.
The solution
A solution exists in the answer posted by @m_goldberg, back in 2015. The code that looks good is well-indented raw input form.
How to copy code from Mathematica so it looks good on this site
Basically:
Choose Convert To > Raw InputForm from the Cell menu or from the contextual (right mouse click) menu. Then Copy & Paste
Previous discussion
This Q&A addresses what formats are acceptable
What kind of Input and Output Code Styles are acceptable in SE?
The answer by moderator @rm-rf calls for
- One should be able to copy-paste-evaluate the code block in Mathematica.
- The code block should be as noise-free as possible.
- Do not use fancy typesetting in your code.
- Try to use sane and reasonable indenting/formatting.
- Also, try to avoid the code block scrolling sideways.
- Keep the code and variables minimal and simple
Strictly speaking, the form I'm complaining about does comply with point 1, and may comply with 5 and 6, but definitely fails in points 2, 3 and 4.
Opinions
Personally, I think it is NOT acceptable to share code that it's not human readable. Questions featuring such code should be corrected or closed.
Some people may disagree, and argue that such code can be interpreted directly by the Mathematica Kernel by pasting it into a Mathematica Notebook.
After the latter, I would offer the counterargument that before deciding to copy&paste code one needs to assess if the question deserves one's attention, and unreadable code doesn't allow that. The burden on the community is too high.
The question
The previous discussion defines the ideal formatting but doesn't conclude what to do with the questions that are not in an ideal form. I am not aware of any consensus on where is the threshold that divides acceptable forms from not acceptable.
I'm looking for a community consensus on whether this form of code is:
- Acceptable and should be answered without complaints.
- Unacceptable and questions of this style should be either edited or closed.
- Some other alternatives.
Is unreadable valid code acceptable in Mathematica Stack Exchange?
Subscript
for variables (even though this comes from the docs forNDSolve
); data links for whichdata = Import[url, type]
does not work; no semicolons fordata = {{...40 lines...}}
or none at the ends of lines whose output is irrelevant; irrelevant*Plot
or other solver commands.