Re: The side-effects of mixing TraditionalForm inside
- To: mathgroup at smc.vnet.net
- Subject: [mg110826] Re: The side-effects of mixing TraditionalForm inside
- From: Leonid Shifrin <lshifr at gmail.com>
- Date: Thu, 8 Jul 2010 03:13:02 -0400 (EDT)
The statement from the Help regarding Unevaluated may be incomplete, but at least it is precise. To understand what the "argument of the function" part means, one has to study main evaluation loop in greater detail than is appropriate for the majority of users. To omit this part however would mean to give imprecise information. What really happens is that Unevaluated wrappers are temporarily discarded during evaluation for those parts of expression which evaluator reaches in the course of evaluation, but then, if no rules were applied to those parts or their subparts, they are restored at the end of this evaluation (Unevaluated wrappers are not stripped as a result). This is what happens, in particular, when Unevaluated[something] is not an argument to a function. And no, Unevaluated[expr] does not have to always be an argument of a function - it can be a stand-alone expression. The trade - off that documentation writers face in this and similar cases is between giving too many details (the above sketchy explanation would become clear only in the context of a detailed discussion of the entire evaluation loop), and making precise statements which may sound unclear to some users, since the context in which they can be easily understood is not supplied. This trade-off IMO simply reflects the nature of Mathematica as being a very powerful system with multiple but overlapping target audiences. Perhaps, in time the documentation may evolve to have a layered structure reflecting this, with briefer layers giving references to more in-depth descriptions. We actually do see this starting to happen already with the "More information" sections - it just needs time. Meanwhile, it looks like in this particular case (with respect to this particular topic) you were unlucky to be in such an overlap group of users - the users who do pay attention to this detail of the documentation (most don't), but are not aware of its meaning. If you are particularly interested in this specific topic, two good accounts are a book of David Wagner and a technical report of David Withoff named "Mathematica internals" (the latter available free online). Given the kinds of topics you usually are willing to discuss on the group, I think you would find these sources particularly useful. Hope this helps. Regards, Leonid On Wed, Jul 7, 2010 at 3:42 PM, AES <siegman at stanford.edu> wrote: > In article <i0urh5$6l9$1 at smc.vnet.net>, > Andrzej Kozlowski <akozlowski at gmail.com> wrote: > > > 1 + Unevaluated[1] > > > > 2 > > Fascinating. I'd call this one more classic Mathematica gotcha, and one > more example of fairly poor quality of Mathematica documentation -- or > at least of the very arcane character of Mathematica for "ordinary > users", once you get to any depth within it. > > Help Browser says: > > Unevaluated[expr] > represents the unevaluated form of expr when it appears as > the argument to a function. > > So, what does Unevaluated[expr] do when it is NOT the argument to a > function? > > (The previous statement I'd say clearly implies that there are times > when Unevaluated[expr] does appear as an arg to function, and therefore > times when it does not -- and both need to be defined.) > > So, if Unevaluated[expr] is entered all by itself in a cell, is it then > "the argument to a function"? > > If the cell contains 1 + Unevaluated[expr] as above, does that make the > Unevaluated[expr] an argument to a function -- or not? (I can see > arguing that above queries either way -- and digging further down into > the Help Browser examples is not very helpful.) > > How would one find out from Mathematica documentation what "argument to > a function" means, precisely? Is there any significance to "argument > to" rather than the (I think) more common usage "argument of"? > > Is Unevaluated[expr] used in a syntactically acceptable way _always_ the > argument to a function? > >