diff options
-rw-r--r-- | src/jvm/clojure/lang/RT.java | 14 | ||||
-rw-r--r-- | test/clojure/test_clojure/data_structures.clj | 22 |
2 files changed, 12 insertions, 24 deletions
diff --git a/src/jvm/clojure/lang/RT.java b/src/jvm/clojure/lang/RT.java index 6017aaf0..aad678c7 100644 --- a/src/jvm/clojure/lang/RT.java +++ b/src/jvm/clojure/lang/RT.java @@ -470,21 +470,11 @@ static ISeq seqFrom(Object coll){ } static public ISeq keys(Object coll){ - if(coll == null) - return null; - else if (coll instanceof Map) - return APersistentMap.KeySeq.create(seq(coll)); - else - throw new IllegalArgumentException("Don't know how to get keys from: " + coll.getClass().getName()); + return APersistentMap.KeySeq.create(seq(coll)); } static public ISeq vals(Object coll){ - if(coll == null) - return null; - else if (coll instanceof Map) - return APersistentMap.ValSeq.create(seq(coll)); - else - throw new IllegalArgumentException("Don't know how to get vals from: " + coll.getClass().getName()); + return APersistentMap.ValSeq.create(seq(coll)); } static public IPersistentMap meta(Object x){ diff --git a/test/clojure/test_clojure/data_structures.clj b/test/clojure/test_clojure/data_structures.clj index 08d0ee38..7679b2b6 100644 --- a/test/clojure/test_clojure/data_structures.clj +++ b/test/clojure/test_clojure/data_structures.clj @@ -440,12 +440,11 @@ (deftest test-keys - (are [x] (thrown? Exception (keys x)) - ;; other than map data structures - () - [] - #{} - "") + (are [x y] (= x y) ; other than map data structures + (keys ()) nil + (keys []) nil + (keys #{}) nil + (keys "") nil ) (are [x y] (= x y) ; (class {:a 1}) => clojure.lang.PersistentArrayMap @@ -465,12 +464,11 @@ (deftest test-vals - (are [x] (thrown? Exception (vals x)) - ;; other than map data structures - () - [] - #{} - "") + (are [x y] (= x y) ; other than map data structures + (vals ()) nil + (vals []) nil + (vals #{}) nil + (vals "") nil ) (are [x y] (= x y) ; (class {:a 1}) => clojure.lang.PersistentArrayMap |