4
$\begingroup$

I defined a binary operator in as the first statement in a new Mathematica notebook.

{x1_, y1_} ⊕ {x2_, y2_} := Module[{}, Print["do anything"];]

where the code in the Module is somewhat more meaningful. My questions:

  1. Why does this not show up in a ?Global`* query?

  2. How can I set the Attributes for this operation to be Flat so it is associative?

  3. Do I need to use the Notations Package to do this "properly"?

$\endgroup$
7
$\begingroup$
  1. Why does this not show up in a ?Global`* query?

    Because you set a definition to CirclePlus which is in the System` context

  2. How can I set the Attributes for this operation to be Flat so it is associative?

    SetAttributes[CirclePlus, Flat]
    

    But now redefine your function so it can take any number of arguments

    CirclePlus[stuff___] := Print@{stuff}
    
  3. Do I need to use the Notations Package to do this "properly"?

    I don't see why, no

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.