From 3d28909a40372830824c98434fab45198248e75e Mon Sep 17 00:00:00 2001 From: Rich Hickey Date: Sat, 5 Aug 2006 23:01:07 +0000 Subject: added equals and hashcode to arrays and seqs --- src/cli/runtime/APersistentArray.cs | 39 +++++++++++++++++++++++++++++++++++++ src/cli/runtime/ASeq.cs | 26 +++++++++++++++++++++++++ 2 files changed, 65 insertions(+) (limited to 'src/cli/runtime') diff --git a/src/cli/runtime/APersistentArray.cs b/src/cli/runtime/APersistentArray.cs index fe6a42f5..de9b548c 100644 --- a/src/cli/runtime/APersistentArray.cs +++ b/src/cli/runtime/APersistentArray.cs @@ -14,6 +14,7 @@ using System.Collections; namespace clojure.lang { public abstract class APersistentArray : Obj, IPersistentArray { +int _hash = -1; public virtual IPersistentCollection cons(Object o) { PersistentArrayList ret = new PersistentArrayList(this, this.count() + 10); @@ -31,6 +32,44 @@ public virtual IPersistentCollection cons(Object o) { return ret; } +override public bool Equals(Object obj) { + if(obj is IPersistentArray) + { + IPersistentArray ma = (IPersistentArray) obj; + if(ma.count() != count()) + return false; + for(int i=0;i