Re: function arguments as subscripts
- To: mathgroup at smc.vnet.net
- Subject: [mg19151] Re: function arguments as subscripts
- From: Bruno Daniel <bruno.daniel at hadiko.de>
- Date: Thu, 5 Aug 1999 23:58:52 -0400
- Organization: University of Karlsruhe
- References: <7obcis$3tc@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi Henrik > In[16]:= > \!\(foo\_\(k_, l_\) = k l\) The FullForm of this is: Set[Subscript[foo,Pattern[k,Blank[]],Pattern[l,Blank[]]],kl] (You can get this by wrapping the expression with FullForm[Hold[..]]) Now it's apparent that you should define an upvalue for foo rather than a downvalue for Subscript. So in order to define it in a package, just insert a ^ in front of "=" or ":=" or put "foo /:" in front of the definition: \!\(foo\_\(k_, l_\) ^= kl\) or \!\(foo\ /: \ \ foo\_\(k_, l_\) = kl\) You can then check the definition by issuing ??foo: ??foo "Global`foo" (* or whatever package you choose *) Subscript[foo, k_, l_] ^= kl You can then set the usage string of foo: foo::usage = "xxx" ??foo xxx Subscript[foo, k_, l_] ^= kl Yours sincerely Bruno