Jump to content

Anyone know about Common Lisp comparisons?

- - - - -

  • Please log in to reply
No replies to this topic

#1
DarkLordofthePenguins

DarkLordofthePenguins

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 409 posts
I've been trying to figure out how EQ differs from EQL. The book I was reading said that EQ is only true if two symbols are identical (they refer to the same object) while EQL is also true for numerical or letter objects that have the same value. I have made countless comparisons with both EQ and EQL, comparing everything from symbols to bindings to expressions, everything I can think of, and I haven't found a single instance where the return value of EQ is different from EQL. They appear to be exactly the same. Am I missing something here? Is there any situation where they won't both return the same result?

Here are the comparisons I made, just for reference:
Different symbols with equal numerical values - both T
Different symbols with different values - both NIL
Different symbols with equal letter values - both T
Same symbols standing for themselves - both T
Different symbols standing for themselves - both NIL
An integer and a ratio with equal numerical values - both T
An integer and a float with equal numerical values - both NIL
Two addition expressions with the same return value - both T
A variable compared to its own value - both T
A variable compared to a symbol for its value - both T
Two variables bound to the same value - both T

Programming is a journey, not a destination.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users