| … | |
… | |
| 46 | $prec = Context()->operators->get(',')->{precedence} + .25; |
46 | $prec = Context()->operators->get(',')->{precedence} + .25; |
| 47 | |
47 | |
| 48 | Context()->operators->add( |
48 | Context()->operators->add( |
| 49 | '=' => { |
49 | '=' => { |
| 50 | class => 'Equality', |
50 | class => 'Equality', |
| 51 | precedence => $prec, # just below addition |
51 | precedence => $prec, # just above comma |
| 52 | associativity => 'left', # computed left to right |
52 | associativity => 'left', # computed left to right |
| 53 | type => 'bin', # binary operator |
53 | type => 'bin', # binary operator |
| 54 | string => '=', # output string for it |
54 | string => '=', # output string for it |
| 55 | perl => '==', # perl string |
55 | perl => '==', # perl string |
| 56 | } |
56 | } |
| 57 | ); |
57 | ); |
| 58 | |
58 | |
| 59 | # |
59 | # |
| 60 | # Something about Context() requires this to be loaded here (FIXME) |
60 | # Something about Context() requires this to be loaded here (FIXME) |
| … | |
… | |
| 65 | # |
65 | # |
| 66 | # The problem text |
66 | # The problem text |
| 67 | # |
67 | # |
| 68 | BEGIN_TEXT |
68 | BEGIN_TEXT |
| 69 | |
69 | |
| 70 | In this problem, we have added a new operator to the Parser: ${BTT} a = b${ETT}, |
70 | In this problem, we have added a new operator to the Parser: ${BTT} a |
| 71 | which returns \(n\choose r\). |
71 | = b${ETT}, for equality. |
| 72 | $PAR |
72 | $PAR |
| 73 | |
73 | |
| 74 | \{ParserTable( |
74 | \{ParserTable( |
| 75 | 'Formula("x + y = 0")', |
75 | 'Formula("x + y = 0")', |
| 76 | 'Formula("x + y = 0")->{tree}->class', |
76 | 'Formula("x + y = 0")->{tree}->class', |