prints as a version of expr suitable for input to the Wolfram Language.
Details and Options
- InputForm always produces one-dimensional output, suitable to be typed as lines of Wolfram Language input.
- The typeset form of InputForm[expr] is interpreted the same as expr when used in input. »
- When an input evaluates to InputForm[expr], InputForm does not appear in the output. »
- Put (>>) produces InputForm by default.
- Short[InputForm[expr]] can be used, but may generate skeleton objects that cannot be given as Wolfram Language input.
- The option NumberMarks can be used to specify whether ` marks should be used to indicate type, precision, or accuracy of approximate numbers. »
Examplesopen allclose all
Basic Objects (2)
Special Input Forms (4)
Special Output Forms (2)
Some objects use a special output representation:
Some objects use an elided output representation:
The elided parts are visible using InputForm:
Properties & Relations (4)
The typeset form of InputForm[expr] is interpreted the same as expr when used in input:
Copy the output and paste it into an input cell. The x^2 is interpreted as x2:
When an input evaluates to InputForm[expr], InputForm does not appear in the output:
Out is assigned the value x2, not InputForm[x^2]:
InputForm has a linear formatting:
FullForm has linear formatting without special syntax:
OutputForm, StandardForm, and TraditionalForm all provide two-dimensional formatting:
Use ToString to generate a string in input form:
Possible Issues (1)
Even when an output omits InputForm from the top level, it is not stripped from subexpressions:
The output does not have InputForm in it:
However, the variable e does have InputForm in it, which may affect subsequent evaluations:
The product is not evaluated due to the intervening InputForm:
Assign variables first and then apply InputForm to the result to maintain computability:
Wolfram Research (1988), InputForm, Wolfram Language function, https://reference.wolfram.com/language/ref/InputForm.html (updated 1996).
Wolfram Language. 1988. "InputForm." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 1996. https://reference.wolfram.com/language/ref/InputForm.html.
Wolfram Language. (1988). InputForm. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/InputForm.html