Re: how to avoid this evaluation?
- To: mathgroup at smc.vnet.net
- Subject: [mg37622] Re: how to avoid this evaluation?
- From: arrayan137 at yahoo.com (elcofres)
- Date: Wed, 6 Nov 2002 06:58:16 -0500 (EST)
- References: <ap5g9b$4l1$1@smc.vnet.net> <apv60v$r3t$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Thanks a lot, OwnValues did what I wanted,
Cheers,
Elcofres
Jens-Peer Kuska <kuska at informatik.uni-leipzig.de> wrote in message news:<apv60v$r3t$1 at smc.vnet.net>...
> Hi,
>
> a=x^2
>
> is *not* a function, it is a value.
> The value of a symbol is stored in
> OwnValue[someSymbol]
>
> For a you will get
>
> {HoldPattern[a] :> x^2}
>
> and you have to work with this form
> and not with an assigment a=x^2, i.e.
>
> SetAttributes[OwnValueString, HoldAll]
>
> OwnValueString[from_Symbol] :=
> Module[{own, st},
> own = OwnValues[Unevaluated[from]] ;
> st = ToString[Unevaluated[from]];
> StringReplace[
> ToString[own /. HoldPattern[from] :> st /.
> Verbatim[HoldPattern][any_] :> any, InputForm], {":>" -> "=",
> "\"" -> ""}]
> ]
>
> will return the string "{a=x^2}"
>
> Regards
> Jens
>