I have following problem. I have a set with different objects (maps). Normally the maps contains only a key with a value which is a number or a collection. For example like this:
(def testset #{ {:a 3 :b 5 :c 6} {:a 3 :b 5 :c 7} {:a 3 :b 5 :c 8} {:a 3 :b 5 :g #{1 2 3 4 5}}}}) If I now use contains? with the map as key I get true, even when the order of the number in the set is not the same as the order I used during the "creation" of the map. => (contains? testset {:a 3 :b 5 :g #{1 2 3 4 5}}) true => (contains? testset {:a 3 :b 5 :g #{1 2 3 5 4}}) true But if the map contains a function like in the following example It doe not find the map. => (def testset #{ {:a 3 :b 5 :c 6} {:a 3 :b 5 :c 7} {:a 3 :b 5 :c 8} {:a 3 :b 5 :g #{1 2 3 4 5}} {:a 3 :h 5 :c #(+ 1 1)}}) => (contains? testset {:a 3 :h 5 :c #(+ 1 1)}) false I knew that => (= #(+ 1 1) #(+ 1 1)) false because these functions are different objects, as I see on the hash values => (hash #(+ 1 1)) (hash #(+ 1 1)) 1965115675 784046647 Now I wonder if it is possible to find a map in a set, which contains a function as value. Is this possible? I tried it with ' too. (def testset #{ {:a 3 :b 5 :c 6} {:a 3 :b 5 :c 7} {:a 3 :b 5 :c 8} {:a 3 :b 5 :g #{1 2 3 4 5}} {:a 3 :h 5 :c '#(+ 1 1)}}) And could use the contains? function => (contains? testset {:a 3 :h 5 :c '#(+ 1 1)}) true But when I tried to access the value I got an Exception =>(c: {:a 3 :h 5 :c '#(+ 1 1)}) RuntimeException Invalid token: c: clojure.lang.Util.runtimeException (Util.java:219) {:a 3, :c (fn* [] (+ 1 1)), :h 5} The same with get => (get {:a 3 :h 5 :c '#(+ 1 1)} c:) RuntimeException Invalid token: c: clojure.lang.Util.runtimeException (Util.java:219) RuntimeException Unmatched delimiter: ) clojure.lang.Util.runtimeException (Util.java:219) -- -- 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 Note that posts from new members are moderated - please be patient with your first post. 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.