MathGroup Archive 2009

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

Search the Archive

Re: Head logic


On Mar 3, 2009, at 5:55 AM, carlos at colorado.edu wrote:

> Entering
>
>    ClearAll[r];
>    Head[r]
>    Head[r]!=Symbol
>    Head[r]==Symbol
>
> give Symbol, False and True as expected. But
>
>    Head[r]==Integer
>
> evaluates to Symbol==Integer. Why not False?
> Head[r] is certainly not Integer. Likewise
>
>   r=4;
>   Head[r]==Integer
>   Head[r]!=Symbol
>   Head[r]==Symbol
>
> give True (correct) but  Integer!=Symbol and Integer==Symbol.
> Why not True and False?
>

== only evaluates to False for comparisons between certain types of  
raw data according to the help documentation, == apparently doesn't  
evaluate to False for Symbols of different value.  You can use ===  
and =!= if this is a problem.

Regards,

Sseziwa


  • Prev by Date: Re: Head logic
  • Next by Date: Huge memory consumption of GIF.exe
  • Previous by thread: Re: Head logic
  • Next by thread: Re: Head logic