Return intermediate reference using Hold*****?
- To: mathgroup at smc.vnet.net
- Subject: [mg109536] Return intermediate reference using Hold*****?
- From: Adam <juneappal at gmail.com>
- Date: Tue, 4 May 2010 06:29:19 -0400 (EDT)
Hello - Supposing I have declared: x = 1 y = x Is there a function that can take y as an argument and return "x"? I would like to use it like this: *** GrassA = 1 GrassB = 2 GrassType = GrassA (*<---- I will toggle this for different model runs*) (*Lots of code and calculations, followed by summary printout *) Print[Row[{"GrassType = ", HOLDLIKEFUNCTION[GrassType], "\tDepth = ", h}]] ***** HoldForm[GrassType] returns "GrassType," instead of the desired "GrassA." For now, I am using: ****** Clear[GrassA, GrassB] Print[Row[{"GrassType = ", HOLDLIKEFUNCTION[GrassType], "\tDepth = ", h}]] ****** Which has the desired effect, so I am not desparate for a solution - just wonder how other people would approach this.