MathGroup Archive 2008

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

Search the Archive

Re: ClearAll error message

  • To: mathgroup at
  • Subject: [mg92405] Re: ClearAll error message
  • From: Szabolcs Horvát <szhorvat at>
  • Date: Tue, 30 Sep 2008 21:46:51 -0400 (EDT)
  • Organization: University of Bergen
  • References: <gbnpep$pr3$> <gbqcv3$ebb$> <gbt2tq$lgc$>

carlos at wrote:
> Actually this was not a big deal.  The group working with the program was
> puzzled by the message but soon it was fixed. BTW, one student came
> with an elegant one-liner to create a nxn symmetric array:
>   S=Table[rootname[Min[i,j],Max[i,j]],{i,n},{j,n}]
> The Clear behavior seems largely a question of esthetics.

It is not just a question of esthetics ...

In[1]:= Unprotect[Clear]
Out[1]= {"Clear"}

In[2]:= ClearAttributes[Clear, HoldAll]

In[3]:= x = 1
Out[3]= 1

In[4]:= Clear[x]

During evaluation of In[4]:= Clear::ssym: 1 is not a symbol or a \
string. >>

> One of the basic
> rules of functional programming is function composition equivalence:
>         y:=f(x); z:=g(y)    equiv    z:=g(f(x))
> Since   name=Symbol["A"]; ClearAll[name] is not equivalent
> to   ClearAll[Symbol["A"]] the rule is violated here, and likewise
> for any function with HoldAll attribute.  Correct?

Note that the ClearAll "function" is not really a function.  Evaluating 
it has side effects, but it has no return value, so it violates an even 
more important principle.  A "real" function just takes a value, and 
returns another value, but nothing special happens just because the 
return value was computed.

  • Prev by Date: Re: Comparison between Mathematica and other symbolic systems
  • Next by Date: Re: help with new symbols (or pointers)
  • Previous by thread: Re: ClearAll error message
  • Next by thread: Re: ClearAll error message