0

In terms of structural equality,

Why would (equal? (list 'a 'b)) evaluate to true but (equal? (list 2 'b) '(2 'b)) evaulates to false?

User9193
  • 57
  • 1
  • 11

1 Answers1

1

'(2 'b) is equivalent to (list 2 (list 'quote 'b)) - a list whose first element is a number and whose second element is another list.

It does not compare equal to (list 2 'b) because (list 2 'b)'s second element is a symbol and symbols are not considered equal to lists.

sepp2k
  • 363,768
  • 54
  • 674
  • 675