Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: Problem overloading a System function
Replies: 1   Last Post: Jan 10, 2013 2:19 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Ken Levasseur

Posts: 20
Registered: 6/13/05
Problem overloading a System function
Posted: Jan 8, 2013 11:39 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Background to my question: Al Hibbard and I have developed the AbstractAlgebra package (https://sites.google.com/site/eaamhl/home ) and over the years, some of our names have been usurped by Wolfram for System functions. In V9, there is a new function called Symmetric which conflicts with our function for the symmetric group. Starting in V8, Wolfram used SymmetricGroup for the group, which was one of our alternate names for the Symmetric. In that case we changed our alternate name to SymmetricGroupAA.

Our solution this time has been to overload Symmetric since the System function acts on lists and ours has an integer argument. Overloading works fine except for one minor detail. Wolfram's Symmetric has no options, but ours does have a few. So when you type a valid expression like this

Symmetric[4,Mode->Textual]

The second argument appears in red because Mathematica knows that it doesn't fit the pattern of arguments for Wolfram's definition of Symmetric. It evaluates perfectly well, but it's annoying to see it in red. I had expected that since one of our definitions looked like this:

Symmetric[n_Integer?Positive,opts___?OptionQ] :=
Module[{mymode, G, po,sc,il}, etc. ]

the two argument pattern would not be flagged in red... but it is. Anyone know how to fix this?

Ken Levasseur
UMass Lowell





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.