Friday, 16 August 2013

How to compare a symbol with a symbol taken from a list

How to compare a symbol with a symbol taken from a list

If I compare two symbols using equal? I get different results depending on
whether one of the symbols is from a list and one is not.
This is demonstrated below:
; The following returns #t
(equal? (list-ref '('a 'b) 1) (list-ref '('a 'b) 1))
; But this return #f
(equal? 'b (list-ref '('a 'b) 1))
What is the best way to compare two symbols when one is from a list and
one is not?

No comments:

Post a Comment