Re: What does FullForm[ ] actually do?

*To*: mathgroup at smc.vnet.net*Subject*: [mg90561] Re: What does FullForm[ ] actually do?*From*: Bill Rowe <readnews at sbcglobal.net>*Date*: Sun, 13 Jul 2008 15:47:19 -0400 (EDT)

On 7/12/08 at 5:33 AM, siegman at stanford.edu (AES) wrote: >In article <g56t9n$3qv$1 at smc.vnet.net>, >Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com> wrote: >>The documentation for FullForm reads, "FullForm acts as a >>'wrapper', which affects display, but *not* evaluation." [1] >>The key point is, "[...] affects display, but *not* evaluation." >>In other words, the standard evaluation process *occurs* as usual >>-- as if FullForm was not there -- since FullForm has no specific >>attributes that tell it not to do so (HoldFirst, HoldRest, etc.). >>(Note that you can see the attributes attached to a symbol thanks >>to Attributes[].) >Thank you -- agreed -- that's what I've now learned from you and >others is how FF operates: To say this (I think) more precisely: This isn't just an attribute of FullForm. What is being described is how Mathematica standardly evaluates any expression, not just FullForm. See tutorial/Evaluation >"FullForm[expr] **first evaluates the expression expr** and then >displays **the internal form of the _result_ produced by this >evaluation of the expression**.> >But what I suggest ought to be of considerable concern to WRI, and >to M users, is the number of occasions where the documentation has >the opportunity to make this point in clear and unambiguous terms >and, as in so many other places in M's documentation, totally fails >to do so. The tutorial on how Mathematica evaluates expressions is fairly detailed and does describe what happens. The only thing WRI hasn't done in the documentation is explicitly repeat this information in the documentation for each individual built-in symbol. While I can see that repeating this information would make things easier for users that only look at the documentation for specific commands and do not look at other parts of the documentation, I don't see how you can make a valid argument that not repeating the information is a failure on WRI's part. >Any argument that FullForm[expr] must evaluate expr because most (or >at least some) other symbols having an argument [expr] do evaluate >that argument is a very weak one. Starting a discussion with "FullForm[expr] must evaluate expr" starts with an implicit assumption that is erroneous. It isn' FullForm doing the evaluation. It is Mathematica evaluating the expression "FullForm[expr]" which it does in the same manner as is done for other expressions. That is, evaluate all parts of the expression until things don't change and display the result. >First of all, not all symbols of the form Symbol[expr] in fact >evaluate expr, at least not immediately. And in addition, the >presumed purpose of FullForm[expr] is not to do some evaluation or >calculation using expr; it's to give the user useful information >about expr -- which the user may well want to get _without_ >evaluating expr. It would not be surprising -- it might even be >expected -- if FullForm[expr] did *not* evaluate expression. The above is a failure on your part to understand the documentation or perhaps a failure to read all of the applicable documentation combined with your expectations for FullForm rather than WRI's intent for FullForm. Note, since I do not work for WRI and had no part in coding Mathematica, I've no way to discern WRI's intent other than as explicitly stated in the documentation. I do note I often use FullForm with the expectation all parts of the inner expression have been evaluated. I prefer having output displayed in TraditionalForm by default. I find this much easier to read. But this means specialized functions that Mathematica knows about are displayed in a manner that do not make their nature immediately obvious to users unfamiliar with them. Nor does the display provide a form that makes it easy to look up information for these functions in the documentation For example, if you evaluate {LegendreP[n,x],Subscript[P,n][x]}//TraditionalForm You get a list that appears to be a list of two identical elements. If you did not know it was traditional to use Subscript[P,n] to mean a nth order Legendre polynomial you would not have sufficient information to look up information on Legendre polynomials. But by applying FullForm to this list, it becomes readily apparent the two elements are different and you have enough information to start to find more information about Legendre polynomials. >More broadly, when one sees the term expr in M documentation, does >that always and only mean the **evaluated result** of evaluating >expr? Or does it sometimes mean the expr itself, in some external >or internal form, *before* evaluation. If I see something in the documentation of the form function[expr] I expect expr to refer to the either the result I got from some other computation I did in Mathematica or something I specifically typed. I do not expect it to be the evaluated result of fuction[expr]. But clearly, for Mathematica to display the evaluated result of function[expr] is must evaluate function[expr]. And this means unless I do something expr gets evaluated first by Mathematica. If I don't want expr to be evaluated before function is applied to it, then I expect use Hold to prevent Mathematica from evaluating expr. >I believe that M documentation's lack of clarity on these points is >typical of many other cases where it uses terms like this, and that >this is a primary cause of most of the difficulties and frustrations >encountered by M users. I disagree with your characterization of the issue as lack of documentation or clarity. I do agree issues like this are a cause of difficulty and confusion for new users. There is definitely a steep learning curve that needs to be overcome before becoming truly proficient with Mathematica. And in large part this is due to the richness of the environment created by Mathematica. Simply put, you really do have to master the basics before becoming proficient. And reading only part of the documentation simply isn't enough. But the information is there. There are many others like myself that do not work for WRI and have no more information about how Mathematica works than you that have become proficient and do not get trapped by issues like this.