MathGroup Archive 1995

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: help functions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg2457] Re: help functions
  • From: wagner at goober.cs.colorado.edu (Dave Wagner)
  • Date: Wed, 8 Nov 1995 23:46:41 -0500
  • Organization: University of Colorado, Boulder

In article <47mtoi$4nd at ralph.vnet.net>,
Jack Goldberg  <jackgold at math.lsa.umich.edu> wrote:
>Hi group;
>
>For starters, suppose that we try to define 
>
>	Help[x_String] := Module[ ... ]
>
>I don't know how to access the comments produced by ? from within 
>my module.  I suppose there is some trick that fools mma into thinking
>I'm using ?, but I can't think of any.  And ? doesn`t help.

Jack,

  ?symbol is just a special input form for Information[symbol]:

(Local) In[23]:=
Information[Table]
Table[expr, {imax}] generates a list of imax copies of
   expr. Table[expr, {i, imax}] generates a list of
   the values of expr when i runs from 1 to imax.
   Table[expr, {i, imin, imax}] starts with i = imin.
   Table[expr, {i, imin, imax, di}] uses steps di.
   Table[expr, {i, imin, imax}, {j, jmin, jmax}, ...]
   gives a nested list. The list associated with i is
   outermost.
Attributes[Table] = {HoldAll, Protected}

Note, however, that the information is printed, not returned, so you
can't modify it programmatically.  But why not go straight to the source
and use symbol::usage:

(Local) In[26]:=
Table::usage
(Local) Out[26]=
Table[expr, {imax}] generates a list of imax copies\
  of expr. Table[expr, {i, imax}] generates a list of\
  the values of expr when i runs from 1 to imax.\
  Table[expr, {i, imin, imax}] starts with i = imin.\
  Table[expr, {i, imin, imax, di}] uses steps di.\
  Table[expr, {i, imin, imax}, {j, jmin, jmax}, ...]\
  gives a nested list. The list associated with i is\
  outermost.

Note the "Out" label.  You can capture this string in a variable
and do whatever you want with it before printing it.

By the way, why are you trying to define Help[x_String]?  Why not
Help[x_Symbol] instead?  Give the function the HoldFirst attribute
and you should have no problems, because "::" will also hold its
argument.


		Dave Wagner
		Principia Consulting
		(303) 786-8371
		dbwagner at princon.com
		http://www.princon.com/princon


  • Prev by Date: Re: Q: ROTATING ANIMATIONS in MMA?
  • Next by Date: Re: More on KSubsets
  • Previous by thread: help functions
  • Next by thread: Re: help functions