MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: ClearAll error message


carlos at colorado.edu wrote:
> Just out of curiosity.  The following ClearAll works as expected.
> 
>   name=Symbol["A"]; ClearAll[name];
> 
> But this elicits an error message:
> 
>   ClearAll[Symbol["A"]];
> 
> Why?  A non-standard argument evaluation?

Yes, since Clear needs to work with symbols which have a value, it has
attribute HoldAll:

Attributes[Clear]

This should work, provided there is no OwnValue for A:

ClearAll[Evaluate[Symbol["A"]]]

if you want to be on the save side, you should make it work even if
there is an OwnValue for A, which is more elaborate:

Apply[ClearAll,ToExpression["A", InputForm, Hold]]

hth,

albert


  • Prev by Date: Graph Theory / Cycle Matrix
  • Next by Date: Re: Redirecting input
  • Previous by thread: Re: ClearAll error message
  • Next by thread: Re: ClearAll error message