Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: Head logic

  • To: mathgroup at smc.vnet.net
  • Subject: [mg97050] Re: [mg97033] Head logic
  • From: Sseziwa Mukasa <mukasa at jeol.com>
  • Date: Wed, 4 Mar 2009 07:09:55 -0500 (EST)
  • References: <200903031055.FAA02912@smc.vnet.net>

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