functions inside Module
- To: mathgroup at smc.vnet.net
- Subject: [mg38234] functions inside Module
- From: Gianluca Gorni <gorni at dimi.uniud.it>
- Date: Tue, 10 Dec 2002 04:09:24 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Hello!
I am confused by this result:
In: Module[{a}, a = x; g[x_] = a]; g[y]
Out: x
Somehow I would expect the same output as
In: Module[{}, a = x; g[x_] = a]; g[y]
Out: y
In the first case ?g gives g[x$_] = x,
while in the second it gives g[x_] = x.
The difference is a dollar sign.
Can anyone explain why the dollar is inserted in one case
but not in the other? The x was not a local variable
in either case.
My version is 4.1 for PowerMac.
Gianluca Gorni
--
+---------------------------------+
| Gianluca Gorni |
| Universita` di Udine |
| Dipartimento di Matematica |
| e Informatica |
| via delle Scienze 208 |
| I-33100 Udine UD |
| Italy |
+---------------------------------+
| Ph.: (39) 0432-558422 |
| Fax: (39) 0432-558499 |
| mailto:gorni at dimi.uniud.it |
| http://www.dimi.uniud.it/~gorni |
+---------------------------------+