Message Boards Message Boards

0
|
3983 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

How do you create a new operator such as ///. ?

In my thread A rule such that x+x^2/.x->0 gives x^2 , I came to the part where I wanted to create an Infix operator to work like ReplaceAll orr ReplaceRepeated, thinking that the next logical operator would be ///.

It turns out that this is not possible because ///. is interpreted as // /.

But in MMA 10 there are new operators <| and |>, so it must be possible to combine symbols to make a new operator. Is this something that mere mortals can do, or do you need to be a programmer at the Mathematica factory ;-) ?

Can someone provide a hint or description of where to go?

POSTED BY: Eric Johnstone
2 Replies

Thanks, Sean.

Using the notations package prompted the question. All that talk of boxes is beyond me, for now. I'll just hijack the >>> operator; the unused operators require complicated typing and don't convey the sense of the operation.

POSTED BY: Eric Johnstone

Look at the notations package:

https://reference.wolfram.com/language/Notation/guide/NotationPackage.html

I've also found the advanced typesetting tutorial here helpful:

http://library.wolfram.com/infocenter/Conferences/8010/

I should note that I think this is actually all different from how "<|" and "/." were added. You can't add new operators in the way those were added. But you can add new operators in the way mentioned in the links above. The NotationPackage and typesetting capabilities are pretty powerful . That said, they're usually used for Mathematical notation.

POSTED BY: Sean Clarke
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract