MathGroup Archive 2008

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

Search the Archive

Re: ClearAll error message

  • To: mathgroup at smc.vnet.net
  • Subject: [mg92363] Re: ClearAll error message
  • From: Albert Retey <awnl at gmx-topmail.de>
  • Date: Mon, 29 Sep 2008 07:06:57 -0400 (EDT)
  • References: <gbnpep$pr3$1@smc.vnet.net>

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