Prev: JLink NaN Support
Next: SyntaxInformation Question
From: Bill Rowe on 8 Jul 2010 03:12 On 7/7/10 at 7:43 AM, dave(a)removedbailey.co.uk (David Bailey) wrote: >I have always thought WRI could usefully change the wording that >appears in the documentation of all these wrapper functions: >"InputForm acts as a "wrapper", which affects display, but not >evaluation." >Of course, they DO affect evaluation! I don't see this as any more correct that the current documentation. The problem with saying evaluation is or is not affected in your statement above or the documentation, is neither specifies what is being evaluated. What would be more complete is to say InputForm and similar functions affect the display of their arguments but not the evaluation of their arguments. They do output a different expression than what would exist had they not been used. That is, evaluation of the argument to InputForm is not changed. Subsequent evaluation of what is returned is affected by usage of InputForm.
From: Andrzej Kozlowski on 8 Jul 2010 03:14 On 7 Jul 2010, at 20:42, AES wrote: > > 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? It does nothing. You could have checked it yourself: In[69]:== Unevaluated[1] Out[69]== Unevaluated[1] > > (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"? No. > > If the cell contains 1 + Unevaluated[expr] as above, does that make the > Unevaluated[expr] an argument to a function -- or not? 1+Unevaluated[1] is actually Plus[1,Unevaluated[1]] so Unevaluated1] is here an argument to a function. Also here In[71]:== Identity[Unevaluated[1]] Out[71]== 1 Unevaluated[1] is again an argument to an explicit function. In my opinion the documentation is perfectly clear and correct in this particular case. Of course it is always possible to misunderstand or fail to understand anything, however clear, if one tries hard enough. Andrzej Kozlowski
From: Albert Retey on 8 Jul 2010 03:12
Hi, > >> 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"? it is about the only case that you can have where it is not an 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.) Of course it is, 1+Unevaluated[expr]===Plus[1,Unevaluated[expr]] and I doubt that anyone familiar with Mathematica would argue another way... > 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? Well, if you really want to understand Mathematica at the level you want the Mathematica documentation to be precise, you should at least have learnt and the following: 1) Mathematica rewrites expressions according to pattern matching rules. 2) for Mathematica everything is an expression. 3) Mathematica thinks in FullForm 4) An expression is a head with any numbers of arguments. actually that could be argued to be almost all you have to know about Mathematica, and I have the feeling that I can get my things done with these rules in mind (and I am not particularly good in keeping many thing in mind). That does not mean I don't think the documentation could be improved (from my experience every documentation of every language/system always could and should be substantially improved and it never will happen :-) or that I think Mathematica is perfect as it is in every detail. It is just my impression that your repetitive complaints about the documentation and various Mathematica "gotchas" are mostly a sign of your unwillingness or inability to accept and learn Mathematica as it is. If you want to use Mathematica as a tool to get your things done, it would be smart to not work and think against it. If you are interested in ideological arguments about how Mathematica actually should do things, you can join RJF and keep complaining. But be warned: To my impression Stephen Wolfram isn't exactly the person that you would convince to change his system by sending posts to this group, so your efforts could well be called fruitless... hth, albert |