Operators, their names and properties #73
Replies: 4 comments 4 replies
-
The names Mathematica gives to a few of the operators are problematic in a small number of cases. Some operators don't have official names (typically "pseudo operators"), but in some cases the name Mathematica gives is actually the name of a related function that has different semantics. Examples include what I call |
Beta Was this translation helpful? Give feedback.
-
Thanks for putting this all together. The amount of done and level of detail is amazing.
Some comments reading this. The first link in the body of the text "Generalizing PEMDAS: What is an operator?" is broken. And the title of that article, "PEMDAS" is not a term I think most people know, although it is in wikipedia in an another category. And even here, there are other acronyms in use: BODMA, DOMDAS, BIDMAS and BEDMAS. Nowhere in that article with PEMDAS in the title is PEMDAS defined. Also, under Data Sources, the alignment of the text between "Source" and "Description" doesn't quite line up in my browser. So I have a hard time knowing when one description ends and the next starts. A suggestion is to just turn these in to subsections or add some line space between entries. Finally, when I read about WolframLanguageData, I was at a loss to know exactly how to use that because the necessary parameters are not specified. An example would be nice and I think I added that to the YAML documentation in mathics_scanner. However somewhere else in the article it is mentioned how to get the specific information from WolframLanguageData. |
Beta Was this translation helpful? Give feedback.
-
A comment on reading Part 2. After "Two synonyms of the same operator:" there is some code that does not render properly as it does in Part 1. The article would read easier if this were fixed. |
Beta Was this translation helpful? Give feedback.
-
The difference between associativity "Non" and associativity "None".I am afraid I have added to the confusion by stubbornly choosing to use the terms in nonstandard ways. In retrospect, I should have used the terms in the same way other authors use them. I use the terms in my operator tables and blog as follows. Non Associative: An operator is non associative if the concept of associativity simply does not apply to the operator at all. This occurs primarily in the case of "parenthesizing" operators ("matchfix" operators) and operators that take no argument ("nullary" operators). For these operators, there is never any ambiguity about how to parse repeated/adjacent uses of the operator. Note that there are a handful of operators that are neither matchfix nor nullary operators that are nontheless non associative under this definition. For example when Associativity of Usage in the literatureAs I said, I'm using these terms in nonstandard ways. There is a third case that is very common in other languages but that generally doesn't occur in Mathematica, namely when adjacent/repeated appearances of an operator is an error of syntax. In the literature, usually the phrase non associative means this third case: adjacent uses is a syntax error. The reason this doesn't happen in Mathematica is because Mathematica allows implicit multiplication, and so nonsensical instances of adjacent operators are just promoted to multiplication by default. There is no single standard term in the literature for when the concept of associativity does not apply. While the phrases "parenthesizing" and "nullary" are common, they are specific cases of associativity being inapplicable and do not describe the general case. As far as I know there is no standard term for what I refer to as an associativity of |
Beta Was this translation helpful? Give feedback.
-
I've been corresponding with @rocky about his work with the operators. I have a few comments that might be helpful to have on GitHub but that aren't really attached to a single issue or pull request. For background, I am the author of this collection of information about Wolfram Language.
A few comments that might be helpful.
Therefore
andBecause
have their precedence swapped between notebook and command line.Out
andSlot
operators. (I seem to recall theGet
/Put
and?
operators are treated specially in some contexts as well, I suspect more for historical than technical reasons.)Precedence
function is not to be trusted. It often returns670
for operators it doesn't know about, but it's wrong in other ways, too. Other sources of data about operators have their own problems. The column "actual precedence" are numbers I assigned by just counting by 10s.I determined operator information empirically, that is, by giving Mathematica code and observing how Mathematica interprets the code. This can be automated to some extent. I just uploaded a repository containing some of the code I have used for this project if you want to reproduce my results or, say, check results for different versions of Mathematica. In particular, you will find code in that repo that can automatically determine the relative precedence of two operators programmatically.
I no longer have a full Mathematica license, so right now I can only use the free Wolfram Engine to check things.
Beta Was this translation helpful? Give feedback.
All reactions