# Internal Representation of ?name and ??name

## Code

FullForm[Hold[?name]]

Syntax::bktmcp: Expression "Hold[?name]]" has no closing "]".

Syntax::sntxi: Incomplete expression; more input is needed .


## Question

This is exercise 3.2 (page 47) of Power Programming w/ Mathematica

"determine the internal representation of the expressions ?name and ??name"

The above is what I tried. It failed. How do I win?

• @term-rewritica - you have Wagner's book? You lucky thing - mine was borrowed by someone years ago and never seen again. – Verbeia Jul 10 '12 at 7:28
• @Verbeia: It's a most intense reading. Reminds me of the first time I read SICP. – user1602 Jul 10 '12 at 8:21
• @Verbeia I do have a copy of that one too (ironically, bought from Amazon fo $40 in 2004, when I just started learning Mathematica as a programming language - and I had no idea about the usefulness of the book at the time, it was a blind purchase). I was lucky to not give it to anyone (well, no one asked). – Leonid Shifrin Jul 10 '12 at 10:16 • @term-rewritica Actually, Roman Maeder's books are more intense reading to me. I think, Wagner wrote his book on just the right level, for someone who knows some Mathematica and wants to bring their M skills to the next level. Can be a little hard to read for a complete beginner, but at least you don't have to read between the lines ( which is what happens all the time with Maeder's books - which is why they are great for experienced users). Wagner's book is still my favorite book on M programming. – Leonid Shifrin Jul 10 '12 at 10:22 • @term-rewritica Yes, best books for it you have to hunt for. Part of the fun :) – Leonid Shifrin Jul 10 '12 at 20:59 ## 2 Answers To programmatically find the internal representation of the shortforms, you can use MakeExpression, which gives the result wrapped in HoldComplete. Here's an example: MakeExpression@"?name" (* HoldComplete[Information["name", LongForm -> False]] *) MakeExpression@"??name" (* HoldComplete[Information["name", LongForm -> True]] *)  Here are a couple of alternatives to R.M's method for seeing what Mathematica makes of input. The input forms of every line entered are stored in the DownValues of In. Starting with a new session or after using Quit[], evaluating each in a separate Cell: ?Mod ??Plus DownValues[In]  {HoldPattern[In[1]] :> Information["Mod", LongForm -> False], HoldPattern[In[2]] :> Information["Plus", LongForm -> True], HoldPattern[In[3]] :> DownValues[In]}  Alternatively you could set a $Pre function to echo input:

\$Pre = Function[, Print@Unevaluated@#; #, HoldAll];

?Plus

Information["Plus", LongForm -> False]


x+y+z represents a sum of terms.  >>