Re: Find maps with embedded functions in a set

2013-07-31 Thread Marcus Lindner
Thanks. That sound good. I had played with eval, but wasn happy about this. 2013/7/31 Cedric Greevey > If you saved the original function instance, you can use it to find the > map. This should work: > > (let [f #(+ 1 1) > s #{{:a 3 :b 5 :c f}}] > (contains? s {:a 3 :b 5 :c f})) > > No

Re: Find maps with embedded functions in a set

2013-07-31 Thread Cedric Greevey
If you saved the original function instance, you can use it to find the map. This should work: (let [f #(+ 1 1) s #{{:a 3 :b 5 :c f}}] (contains? s {:a 3 :b 5 :c f})) Note that the value for the :c key is now the same *instance* of that function. Storing the function source, with ', inst

Re: Find maps with embedded functions in a set

2013-07-31 Thread Marcus Lindner
Ups. [?] Sorry. Have not seen this typo :(. 2013/7/31 Jim > On 31/07/13 11:01, Goldritter wrote: > >> 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

Re: Find maps with embedded functions in a set

2013-07-31 Thread Jim
On 31/07/13 11:19, Jim wrote: On 31/07/13 11:01, Goldritter wrote: 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

Re: Find maps with embedded functions in a set

2013-07-31 Thread Jim
On 31/07/13 11:01, Goldritter wrote: 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)

Find maps with embedded functions in a set

2013-07-31 Thread Goldritter
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}