Re: usage messages in packages
- To: mathgroup at smc.vnet.net
- Subject: [mg58097] Re: [mg58064] usage messages in packages
- From: Andrzej Kozlowski <andrzej at akikoz.net>
- Date: Sat, 18 Jun 2005 06:07:50 -0400 (EDT)
- References: <NDBBJGNHKLMPLILOIPPOOEOBEIAA.djmp@earthlink.net>
- Sender: owner-wri-mathgroup at wolfram.com
Very nice. Now if only someone could tell about this the authors of the Combinatorica package .... Andrzej Kozlowski On 17 Jun 2005, at 23:04, David Park wrote: > > Andrzej, > > There is a method of appending to an existing usage message in a > package. > Here is an example (from the Algebra`ExpressionManipulation` > package at my > web site). > > $NewMessage[Extract, "usage"]; > Extract::usage = > Extract::usage <> > " The positions in Extract can be extended positions such as \n \ > eP[{1},{2,4}] which is the position of a+c in f[1+a+b+c]." > > Then when a user types ?Extract he gets... > > Extract[expr, list] extracts the part of expr at the position > specified by > list. Extract[expr, {list1, list2, ... }] extracts a list of parts > of expr. > Extract[expr, ... , h] extracts parts of expr, wrapping each of > them with > head h before evaluation. The positions in Extract can be extended > positions > such as eP[{1},{2,4}] which is the position of a+c in f[1+a+b+c]. > > David Park > djmp at earthlink.net > http://home.earthlink.net/~djmp/ > > > > From: Andrzej Kozlowski [mailto:andrzej at akikoz.net] To: mathgroup at smc.vnet.net > > > One aspect of Mathematica packages that seems to me to be poorly > designed is the way package usage messages can cover up a built in > usage messages without any warning. A particularly irritating > instance of this is when a package overloads the definition of a > built in functions so that user receives no information at all about > what happened. As an example compare: > > > ?Normal > > Normal[expr] converts expr to a normal expression, from a > variety of special forms. > > load the Combinatorica package: > > > <<discretemath`combinatorica` > > > ?Normal > > Normal is a value that options VertexStyle, EdgeStyle, and \ > PlotRange can take on in ShowGraph. > > Another curious thing. Quit the Kernel and now try again loading the > Combinatorica package in a different way > > In[1]:= > <<discretemath` > > This time the usage message was not covered up: > > In[2]:= > ?Normal > > Normal[expr] converts expr to a normal expression, from a \ > variety of special forms. > > I had never realised that one could load directories of packages by > using only small letters as in the above example until I saw Maxim > doing it. This also works: > > << discretemath`combinatorica` > > > Actually, this is consistent with the documentation which says: > > > <<dir` , initialize all packages from directory dir, > <<dir`package` , read in a package from the named directory > > but I had always assumed that "dir" and "package" actually meant > "Dir" and "Package". > > > Andrzej Kozlowski > Chiba, Japan > http://www.akikoz.net/andrzej/index.html > http://www.mimuw.edu.pl/~akoz/ > > > >