i1 : 2+
3+
4
o1 = 9
|
parsing binary unary
precedence binding binding operators
strength strength
2 2 -*end of file*-
4 4 -*end of cell*-
6 ) ] }
8 7 ;
10 10 10 ,
12 12 do else list then
14 13 -> := <- = => >>
16 16 from in of to when
18 18 18 <<
20 19 20 |-
22 21 ===>
22 21 22 <===
24 23 <==>
26 25 ==>
26 25 26 <==
28 27 or
30 29 and
32 32 not
34 33 != =!= == ===
34 33 34 < <= > >= ?
36 36 ||
38 37 :
40 40 |
42 42 ^^
44 44 &
46 46 .. ..<
48 48 ++
48 48 48 + -
50 50 **
52 6 [
54 53 \ \\
54 54 % / //
54 54 54 *
56 55 @
58 -*...symbols...*-
58 6 ( {
58 12 break catch continue elapsedTime elapsedTiming if return shield step throw time timing try while
58 16 for new
58 70 global local symbol threadVariable
58 57 SPACE
60 (*)
62 62 @@
64 ^* _* ~
66 66 #? . .? ^ ^** _
66 66 57 #
68 !
|
One of the most unusual aspects of the parsing precedence table above is that [ is assigned a precedence several steps lower than the precedence of symbols and adjacency, and also lower than the precedence of /. This was done so expressions like R/I[x] would be parsed according to mathematical custom, but it implies that expressions like f g [x] will be parsed in a surprising way, with f g being evaluated first, even if f and g are both functions. Suitably placed parentheses can help, as illustrated in the next example.
i2 : f = x -> (print x; print) o2 = f o2 : FunctionClosure |
i3 : f f [1,2,3] f [1, 2, 3] |
i4 : f f ([1,2,3]) [1, 2, 3] print o4 = print o4 : FunctionClosure |
i5 : f (f [1,2,3]) [1, 2, 3] print o5 = print o5 : FunctionClosure |