Currently comparing two non identical seqs requires iterating through both seqs comparing value by value, ignoring the possibility of seq a
and b
having the same (pointer-equal) rest.
The proposed patch adds a pointer equality check on the seq tails that can make the equality short-circuit if the test returns true, which is helpful when comparing large (or possibly infinite) seqs that share a common subseq.
After this patch, comparisons like
(let [x (range)] (= x (cons 0 (rest x))))
which currently don't terminate, return true in constant time.
Patch: CLJ-1679-v3.patch