Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Explore the low-level structure of Wolfram Language expressions with an easy-to-read concise representation
ResourceFunction["ShortInputForm"][expr] produces terse version of expr intended for inspecting its low-level structure. |
Display the structure of a Graph expression's input form:
In[1]:= | ![]() |
Out[1]= | ![]() |
Explore the low-level structure of a graphics object produced by Plot. Try selecting subexpressions with the mouse, navigating with keyboard shortcuts, copying and editing code:
In[2]:= | ![]() |
Out[2]= | ![]() |
Copy a subexpression from above and use it in Graphics:
In[3]:= | ![]() |
Out[3]= | ![]() |
Compare the internal structure of similar objects generated in different ways:
In[4]:= | ![]() |
Out[4]= | ![]() |
In[5]:= | ![]() |
Out[5]= | ![]() |
Check the result of applying Normal to a graphics object:
In[6]:= | ![]() |
Out[8]= | ![]() |
In[9]:= | ![]() |
Out[9]= | ![]() |
InputForm always produces a one-dimensional representation of the expression in the form of pure text, suitable to be typed as Wolfram Language input via text-based interface. Within the notebook interface, semantic selection and code highlighting aren't available with InputForm expressions:
In[10]:= | ![]() |
Out[10]= | ![]() |
In[11]:= | ![]() |
Out[11]= | ![]() |
ShortInputForm produces shortened two-dimensional output, suitable to be used as input within the notebook interface. Semantic selection and code highlighting are turned on by default:
In[12]:= | ![]() |
Out[12]= | ![]() |
Special forms like NumericArray by default are kept untouched for readability, but can also be converted by applying ShortInputForm to them separately:
In[13]:= | ![]() |
Out[13]= | ![]() |
In[14]:= | ![]() |
Out[14]= | ![]() |
Such forms usually can be converted to normal expressions by applying Normal:
In[15]:= | ![]() |
Out[15]= | ![]() |
By default ShortInputForm[expr] keeps untouched compound-type atomic objects when they are part of the supplied expression:
In[16]:= | ![]() |
Out[17]= | ![]() |
In[18]:= | ![]() |
Out[18]= | ![]() |
Use ShortInputForm[expr, Unevaluated] to convert most of them into actual input expressions revealing their low-level structure:
In[19]:= | ![]() |
Out[19]= | ![]() |
Alternatively, apply ShortInputForm to the atomic objects directly:
In[20]:= | ![]() |
Out[20]= | ![]() |
Explore box structures generated by ToBoxes taking advantage of the easy-to-read representation generated by ShortInputForm:
In[21]:= | ![]() |
Out[21]= | ![]() |
Create an auxiliary function that exports a supplied expression to "PDF" and then immediately imports the results as vector graphics:
In[22]:= | ![]() |
Out[22]= | ![]() |
Inspect the internal contents of returned graphics with ShortInputForm:
In[23]:= | ![]() |
Out[24]= | ![]() |
In[25]:= | ![]() |
Out[25]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License