Re: Head logic
- To: mathgroup at smc.vnet.net
- Subject: [mg97074] Re: Head logic
- From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
- Date: Wed, 4 Mar 2009 07:14:52 -0500 (EST)
- References: <email@example.com>
It's the same for every comparison of heads, e.g. Times == Plus return unevaluated as well. Not sure why this is so, but I guess it would be difficult to provein general that two functions are exactly functional equivalent or not. You can force evaluation by using === or =!=. Those functions check whether the comparants are literally the same. For testing of heads you could use expressions described in tutorial/PuttingConstraintsOnPatterns and tutorial/SpecifyingTypesOfExpressionInPatterns Cheers -- Sjoerd On Mar 3, 12:55 pm, car... 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?