comparison between 2 vectors (equal (vector 2 3 4) (vector 2 3 4)) = NIL
common-lisp
Solution
From the Common Lisp Hyperspec:
For conses, equal is defined recursively as the two cars being equal and the two cdrs being equal.
Two arrays are equal only if they are eq, with one exception: strings and bit vectors are compared element-by-element (using eql).
`vector` creates an array, but it's not a string or bit vector. Since the two arrays are not `eq`, they aren't `equal`.
If you want a comparison predicate that treats arrays as equivalent if they have all the same elements, use `equalp`
Problem
in common lisp, we have: ``` (equal (vector 2 3 4) (vector 2 3 4)) = NIL (equal (cons 1 2) (cons 1 2)) => T ``` Why first one is false and second is true?