Following the comments on the answer here I would like to know if there is a way to deduce from the documentation if a built-in expression is a function or simply "a variable that stores something".
For the motivation you can look here: without knowing if object are wrapper or not it would have been impossible for me to know that First[ContourPlot] gives the good variable to provide to Epilog for instance.
For instance, looking at the docs for graphics, it is not possible to understand that "primitives" and "options" are not parameter to provide to the function "Graphics" but actually what is stored in a Graphics type variable.
I find the documentation extremly confusing to learn, which is why I ask my question.
Thus, my question is precisely:
- Is there a way from the documentation to know if the expression is a function or a variable storing something
- If not, can I use some way in Mathematica to know it
Graphics
function which constructs the graphics. That's what the documentation is saying by writing it asGraphics[primitives, options]
. Usually the parameters are italicized and lowercase in the documentation, while the function names and directives start uppercased and are hyperlinked / blue. TheGraphics
doesn't store anything. It's a function that takes a bunch of primitives, directives and options, and it takes that recipe to render the graphics. $\endgroup$ – flinty Oct 1 '20 at 22:37Graphics
is an inert wrapper and not so much a function (the rendering is technically also not really done byGraphics
and more byMakeBoxes
and the FE). If you look at the linked question, you can see that OP is asking how one can tell that a symbol is such an inert wrapper, and that it is therefore possible to extract the primitives simply by applyingFirst
. $\endgroup$ – Lukas Lang Oct 2 '20 at 6:07Epilog
it is expecting primitives. It says in the documentation for things likePolygon
andLine
(expand the details and options section) that xxx can be used as a geometric region or a graphics primitive. If you dox = ContourPlot[...]; Head[x]
you get aGraphics
. So you knowx
is a graphics and the form ofGraphics
isGraphics[primitives, options]
, so you know theFirst
argument is a list of primitives. If a functionf
is like a wrapper thing, then itsHead
doesn't change when the function is used, e.gHead[f[2]] === f
$\endgroup$ – flinty Oct 2 '20 at 13:40Head[Graphics[{Red, Disk[]}]]
is still aGraphics
. By the way, if you want a list of primitives, expand the details and options section in theGraphics
documentation where it says The following graphics primitives can be used:... . Primitives are things likeArrow
,AASTriangle
,Disk
,BezierCurve
etc... $\endgroup$ – flinty Oct 2 '20 at 13:44