Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go over Operator Precedence #811

Open
rocky opened this issue Mar 12, 2023 · 0 comments
Open

Go over Operator Precedence #811

rocky opened this issue Mar 12, 2023 · 0 comments

Comments

@rocky
Copy link
Member

rocky commented Mar 12, 2023

Description

Go over Operator precedence. Possibly this is an activity in mathics scanner where we create new operator tables which include: Precedence[], and the actual precedence, taking into account affix and arity of the operator. See also https://wltools.github.io/LanguageSpec/Specification/Syntax/OperatorTableHTML/

How to Reproduce

In WMA, the right value for the precedence would be exactly the same as Times (400):

In[1]:= Times[b, PrecedenceForm[3 A ,400]]                                                                                                                                    

Out[1]= b (3 A)

In[2]:= Times[b, PrecedenceForm[3 A ,401]]                                                                                                                                    

Out[2]= b 3 A

In Mathics, this does not works in the same way:

In[1]:= Times[b, PrecedenceForm[3 A ,400]]                                                                                                                                    

Out[1]= b (3 A)

In[2]:= Times[b, PrecedenceForm[3 A ,401]]                                                                                                                                    

Out[2]= b (3 A)

In[2]:= Times[b, PrecedenceForm[3 A ,399]]                                                                                                                                    

Out[2]= b (3 A)

but

In[1]:= Times[b, PrecedenceForm[A ,400]]                                                                                                                                    

Out[1]= b A

In[2]:= Times[b, PrecedenceForm[3 A ,401]]                                                                                                                                    

Out[2]= b A

In[2]:= Times[b, PrecedenceForm[3 A ,399]]                                                                                                                                    

Out[2]= b (A)

Additional context

The above example is extracted from #809 (comment) and #810

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant