Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #13074 > unrolled thread

Problem overloading a System function

Started byklevasseur@mac.com
First post2013-01-09 04:39 +0000
Last post2013-01-10 07:19 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Problem overloading a System function klevasseur@mac.com - 2013-01-09 04:39 +0000
    Re: Problem overloading a System function "Nasser M. Abbasi" <nma@12000.org> - 2013-01-10 07:19 +0000

#13074 — Problem overloading a System function

Fromklevasseur@mac.com
Date2013-01-09 04:39 +0000
SubjectProblem overloading a System function
Message-ID<kcisat$41h$1@smc.vnet.net>
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

[toc] | [next] | [standalone]


#13083

From"Nasser M. Abbasi" <nma@12000.org>
Date2013-01-10 07:19 +0000
Message-ID<kclq2f$9l6$1@smc.vnet.net>
In reply to#13074
On 1/8/2013 10:39 PM, klevasseur@mac.com wrote:
> 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.

Hi;

Thanks for your package. But you really should not have used UpperCase
first letter for names of your functions or variables, since this can
cause conflict with Mathematica's  own names, as your example shows.

It is well known that Mathematica uses UpperCase for all its system functions
and symbols. Any one writing a package, even though the package has its own
context, should really consider using only lowerCase starting letter in
the name.

--Nasser

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web