Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Format a symbol as a ResourceFunction in outputs
ResourceFunction["FormatAsResourceFunction"][symbol] formats symbol as a ResourceFunction of the same name. | |
ResourceFunction["FormatAsResourceFunction"][symbol,"name"] formats symbol as a ResourceFunction with the name "name". | |
ResourceFunction["FormatAsResourceFunction"][symbol,"name",id] formats using an Interpretation giving ResourceFunction[id]. |
Format a symbol as a ResourceFunction when it appears in output:
In[1]:= |
Out[3]= |
Format using a different name:
In[4]:= |
Out[5]= |
Format with an interpretation as a specific resource:
In[6]:= |
Out[7]= |
Copy and paste the output above:
In[8]:= |
Out[8]= |
This is the same as:
In[9]:= |
Out[9]= |
Here is a function that has an unevaluated operator form:
In[10]:= |
In[11]:= |
Out[11]= |
In[12]:= |
Out[12]= |
Although it works correctly as a ResourceFunction, the operator form is represented by the internal symbol:
In[13]:= |
Out[13]= |
In[14]:= |
Out[14]= |
In[15]:= |
Out[15]= |
Format the symbol so it will appear nicely in output:
In[16]:= |
Out[17]= |
Now the operator formats as a ResourceFunction:
In[18]:= |
Out[18]= |
In[19]:= |
Out[19]= |
Copy the output from above and paste into a Hold to see the interpretation:
In[20]:= |
Out[20]= |
Attempting to copy and paste the formatted symbol before the ResourceFunction exists will result in an error:
In[21]:= |
Out[23]= |
Copy and paste the output from above:
In[24]:= |
Out[24]= |
Paste the same again, but this time define the ResourceFunction first and it will work:
In[25]:= |
Out[26]= |
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License