[Date Index]
[Thread Index]
[Author Index]
Precedence of the \\ and ; operators and RowBoxes generated by the front end
*To*: mathgroup at smc.vnet.net
*Subject*: [mg87495] Precedence of the \\ and ; operators and RowBoxes generated by the front end
*From*: "Andrew Moylan" <andrew.j.moylan at gmail.com>
*Date*: Fri, 11 Apr 2008 05:57:25 -0400 (EDT)
1. A bug. In a notebook:
Print[1]; Print[2]; // Hold
>> 1
>> Hold[Print[2];]
Apparently // has higher precedence than ;. But,
ToExpression["Print[1];Print[2];//Hold"]
>> Hold[Print[1]; Print[2];]
Thus, at least in InputForm, ; has higher precedence than //.
This discrepancy causes Auto Save Package .m files to execute differently
from the original .nb file. For example, put the above code into an Auto
Save Package.
2. A question. The boxes generated by typing "Print[1]; Print[2]; // Hold"
into a notebook are:
RowBox[{
RowBox[{"Print", "[", "1", "]"}], ";",
RowBox[{
RowBox[{"Print", "[", "2", "]"}], ";", "//", "Hold"}]}]
Motivated by this, compare:
ToExpression[RowBox[{"Print[1];", RowBox[{"Print[2];//Hold"}]}]]
>> 1
>> Hold[Print[2];]
ToExpression[RowBox[{"Print[1];Print[2];//Hold"}]]
>> Hold[Print[1]; Print[2];]
ToExpression[RowBox[{"5 ", RowBox[{"1+1"}]}]]
>> 10
ToExpression[RowBox[{"5 1+1"}]]
>> 6
Thus, in StandardForm, the positioning of RowBoxes appears to override
normal operator precedence. Is this intended behaviour?
1. In light of this, the bug above appears to be that the front end thinks
\\ has a higher precedence than ;, but the kernel thinks the opposite.
Prev by Date:
**Re: Frametick Orientation (2 Questions)**
Next by Date:
**Ranks for an array of triplets**
Previous by thread:
**Re: Tilted decimals on the x-axis to avoid overlapping**
Next by thread:
**Ranks for an array of triplets**
| |