Clearing a symbol known only through a definition
- To: mathgroup at smc.vnet.net
- Subject: [mg66658] Clearing a symbol known only through a definition
- From: Andrew Moylan <andrew.moylan at anu.edu.au>
- Date: Fri, 26 May 2006 04:17:17 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Suppose I have a symbol "a" that is defined to be equal to another symbol. (E.g. It might be that a := b.) How can I clear the value of the symbol 'pointed to' by "a", without knowing explicity what symbol that is? Clear[a] won't do, of course. Clear[Evaluate[a]] won't do, because that will evaluate to Clear[Evaluate[b]], which will in turn (in general) evalulate to Clear["whatever b evalulates to"]. ---- Alternatively, here is the particular problem I want to solve: For any expression e, either e is a symbol, or Head[e] is, or Head[Head[e]] is, etc. Call this the "topmost symbol" in the expression. Thus, the topmost symbol in f[x][y][z] is f. I want to write a function that takes an expression and calls Clear[] on its topmost symbol. Can anyone think of a simple way to write such a function?
- Follow-Ups:
- Re: Clearing a symbol known only through a definition
- From: Andrzej Kozlowski <akoz@mimuw.edu.pl>
- Re: Clearing a symbol known only through a definition
- From: "Carl K. Woll" <carlw@wolfram.com>
- Re: Clearing a symbol known only through a definition
- From: "Fred Simons" <f.h.simons@tue.nl>
- Re: Clearing a symbol known only through a definition
- From: Sseziwa Mukasa <mukasa@jeol.com>
- Re: Clearing a symbol known only through a definition