# Elimination of “1” in HoldComplete [duplicate]

HoldComplete[2 3 3] will return HoldComplete[2 3 3]. HoldComplete[b a] will return HoldComplete[b a].

Everything works fine here, no replacement rules called, no evaluation done, the Flat attribute didn't apply.

but things get weird when we evaluate HoldComplete[a 2 1 2]:

The desired result shall be HoldComplete[a 2 1 2] as no modification should be done here, however, the result is HoldComplete[a 2 2], it seems that the 1 is magically omitted as it's not important here in multiplication!

How could this happen? Is this a bug? How can I solve this problem?

Thanks!

## marked as duplicate by Daniel Lichtblau, MarcoB, Mr.Wizard♦May 28 '17 at 6:51

• Check the FullForm. The 1 is not displayed, but it is in fact there. – Szabolcs May 27 '17 at 14:32
• Nope~ It's not there. Once you evaluate it, it's not there: HoldComplete[a 2 1 2] // FullForm returns HoldComplete[Times[a, 2, 1, 2]] while do the same to the evaluation result of HoldComplete[a 2 1 2] would give HoldComplete[Times[a, 2, 2]] – Wjx May 27 '17 at 14:36
• I think this makes things even wierder...... – Wjx May 27 '17 at 14:38
• You are not applying FullForm to the actual evaluation result. You are applying it to some text in the output cell. That is not the same thing. Assign the result to a variable. – Szabolcs May 27 '17 at 14:40
• Oh, good point! But how can I let it display just like the way I entered? – Wjx May 27 '17 at 14:43

What you see in the output cell is just a visualization of the actual result of the evaluation. When working with the FrontEnd the default FormatType of the output stream is StandardForm what means that FormatValues rules for StandardForm will automatically be applied to the actual output before sending it to the FrontEnd (in order to produce a typeset expression):

Options["stdout", FormatType]

{FormatType -> StandardForm}

MakeBoxes[HoldComplete[a 2 1 2], StandardForm]

RowBox[{"HoldComplete", "[",
RowBox[{"a", " ", "2", " ", "2"}], "]"}]


You can switch to purely textual InputForm display mode by wrapping your input by InputForm:

In[3]:=
HoldComplete[a 2 1 2]//InputForm

Out[3]//InputForm=
HoldComplete[a*2*1*2]


You can also check the actual result of the evaluation by requesting it from the history:

In[4]:= HoldComplete[a 2 1 2];

In[5]:= % // FullForm

Out[5]//FullForm=
HoldComplete[Times[a,2,1,2]]


Related:

• What is "stdout"? I've never seen that before. – QuantumDot May 27 '17 at 16:32
• @QuantumDot It's the name of the standard output stream. By default \$Output lists it as OutputStream["stdout", 1]. But it is possible to refer to it directly as to "stdout". – Alexey Popkov May 27 '17 at 16:45
• +1 nice explanation! – Ali Hashmi May 27 '17 at 17:10
• Nice explanation! Thanks~ – Wjx May 28 '17 at 1:21