On Tue, Feb 17, 2009 at 8:37 PM, Chouser <chou...@gmail.com> wrote: > Empty lazy seqs do not always compare as equal: > > user=> (= (map inc nil) ()) > false
The problem appears to be when the first seq being compared is empty but not identical to the second collection. The attached patch fixes this and is I think correct. --Chouser --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---
commit 9dd308c0151f74c262d498ac8086178e742d9eee Author: Chouser <chou...@n01se.net> Date: Tue Feb 17 20:44:52 2009 -0500 Fix LazySeq.equiv() for empty seqs. diff --git a/trunk/src/jvm/clojure/lang/LazySeq.java b/trunk/src/jvm/clojure/lang/LazySeq.java index 1769d43..fbc25cb 100644 --- a/trunk/src/jvm/clojure/lang/LazySeq.java +++ b/trunk/src/jvm/clojure/lang/LazySeq.java @@ -72,7 +72,12 @@ public class LazySeq extends AFn implements ISeq, List { public boolean equiv(Object o) { ISeq s = seq(); - return s == o || (s != null && s.equiv(o)); + if( s == o ) + return true; + if( s != null ) + return s.equiv(o); + else + return ((IPersistentCollection)o).seq() == null; } public int hashCode() {