Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • $\begingroup$ Have you studied the Notation package? I have no experience with it, but it seems to be the way to go. Another thing: converting a string to an expression starts by first parsing it. I don't think the parser is customizable, so I don't think it's possible to do this so that it'd work with the command line interface. What we might be able to do is customize how to get from boxes (not a string) to expressions and vice versa. If it is at all possible to alter the precedence (I don't know if it is or not!), the information about the precedence should be somehow embedded in the (contd.) $\endgroup$ Commented Jun 2, 2012 at 10:23
  • $\begingroup$ boxes. This means that it will not be possible to enter our new operator as a simple string because we'll need to somehow enter this special box information. We might be able to define a keyboard shortcut that enters everything correctly, or maybe use the auto-replacement feature (that replaces e.g. "Mathematica" by "Mathematica") to always replace `\` by the correct box structure. Just some thoughts ... $\endgroup$ Commented Jun 2, 2012 at 10:25
  • $\begingroup$ @Szabolcs: I vaguely remember encountering some file in the Mathematica folder that contains all the precedences. And also there is PrecedenceForm, though that is not really helpful here. As always, I'd rather avoid using the Notation package, as it involves a lot of overhead for such a small functionality. I really hope someone could post a simple solution for such an obvious problem, though in the meantime I try to figure out something from the Notation pkg. $\endgroup$ Commented Jun 2, 2012 at 10:29
  • 1
    $\begingroup$ This came up here on MG: groups.google.com/d/topic/comp.soft-sys.math.mathematica/… I seems to recall seeing it somewhere else as well, but I can't find it. While theoretically it's an interesting problem (and +1), there's always the concern that a personal custom notation that is not tied to a special custom function (but a built-in operation such as function application) would be a severe hindrance when sharing code. $\endgroup$ Commented Jun 2, 2012 at 10:30
  • 1
    $\begingroup$ Yes, I am aware of this aspect (non-distributability of custom notation). As a matter of fact, I really suppressed this question since long but yesterday I felt an urge of rage-posting because I got fed up jumping back and forth of the start and end of an otherwise nicely building piece of code. Also, I hope that such changes can be done in the form of oneliners, so it would be easy to distribute the operator definition with any work intended for sharing. Lastly (a dream): WRI might decide on including it in Mathematica later if they see this is viable and useful. $\endgroup$ Commented Jun 2, 2012 at 10:39