Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread Mond Ray
Thanks for the demo ... the next part of my code will decide if the key is in an atom feed so I will be testing for false in the results too - FTW indeed :D On Saturday, 25 May 2013 21:01:31 UTC+2, atkaaz wrote: > > => (doall (map #(remove :dh-uuid %) > '(({:a2p-id "1", :dh-uuid "ab

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread atkaaz
=> (doall (map #(remove :dh-uuid %) '(({:a2p-id "1", :dh-uuid "abc-def-ghi-klm"} {:a2p-id "2", :dh-uuid "def-ghi-klm-opq"} {:a2p-id "3", :dh-uuid nil}) ({:a2p-id "1", :dh-uuid "abc-def-ghi-klm"} {:a2p-id "2", :dh-uuid "def-ghi-klm-opq"} {:a2p-id "3", :dh-uuid *false*})) )) (

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread Mond Ray
This is my latest working invocation: (doall (map #(remove :dh-uuid %) (map find-records query-parts))) (({:a2p-id "3", :dh-uuid nil}) ({:a2p-id "3", :dh-uuid nil})) The list of maps is retained which might be useful later. Thanks On Saturday, 25 May 2013 20:15:19 UTC+2, sdegutis wrote: > > Wou

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread Mond Ray
It's as I presented it - a list of a list of maps On Saturday, 25 May 2013 13:27:45 UTC+2, atkaaz wrote: > > can you tell what this returns? > (map find-records query-parts) > > > On Sat, May 25, 2013 at 2:21 PM, Mond Ray > > wrote: > >> I am missing something obvious... I get a list of maps bac

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread Mond Ray
On the other hand ... does that mean that the sequence being filtered is not lazy? On Saturday, 25 May 2013 20:09:05 UTC+2, Mond Ray wrote: > > Bingo: > > user=> (filter (complement :dh-uuid) (apply concat (map find-records > query-parts))) > ({:a2p-id "3", :dh-uuid nil} {:a2p-id "3", :dh-uuid n

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread Steven Degutis
Wouldn't (remove :dh-uuid (apply concat (map find-records query-parts))) be better? On Sat, May 25, 2013 at 1:09 PM, Mond Ray wrote: > Bingo: > > user=> (filter (complement :dh-uuid) (apply concat (map find-records > query-parts))) > ({:a2p-id "3", :dh-uuid nil} {:a2p-id "3", :dh-uuid nil}) > >

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread Mond Ray
Bingo: user=> (filter (complement :dh-uuid) (apply concat (map find-records query-parts))) ({:a2p-id "3", :dh-uuid nil} {:a2p-id "3", :dh-uuid nil}) Thanks everyone! On Saturday, 25 May 2013 19:29:55 UTC+2, Andy Fingerhut wrote: > > Woops, and here I wasn't being careful enough... You have a

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread Andy Fingerhut
Woops, and here I wasn't being careful enough... You have a list (or sequence) of two elements, both of which are lists (or sequences) of maps. You can use (apply concat (map find-records query-parts)) to return a single list containing nothing but maps. Andy On Sat, May 25, 2013 at 10:27 AM, A

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread Andy Fingerhut
If (map find-records query-parts) is returning this expression: (({:a2p-id "1", :dh-uuid "abc-def-ghi-klm"} {:a2p-id "2", :dh-uuid "def-ghi-klm-opq"} {:a2p-id "3", :dh-uuid nil}) ({:a2p-id "1", :dh-uuid "abc-def-ghi-klm"} {:a2p-id "2", :dh-uuid "def-ghi-klm-opq"} {:a2p-id "3", :dh-uuid nil})) the

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread Steven Degutis
Cedric's answer is best: either (filter :dh-uuid some-list) or (remove :dh-uuid some-list) depending on which list you want. On Sat, May 25, 2013 at 7:10 AM, Cedric Greevey wrote: > Why not just (filter (complement :dh-uuid) seq-of-maps)? Or (remove > :dh-uuid seq-of-maps) even? > > > On Sat, M

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread Cedric Greevey
Why not just (filter (complement :dh-uuid) seq-of-maps)? Or (remove :dh-uuid seq-of-maps) even? On Sat, May 25, 2013 at 7:41 AM, sdegutis wrote: > (def some-list > [{:a2p-id "1", :dh-uuid "abc-def-ghi-klm"} >{:a2p-id "2", :dh-uuid "def-ghi-klm-opq"} >{:a2p-id "3", :dh-uuid nil}]) > >

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread sdegutis
(def some-list [{:a2p-id "1", :dh-uuid "abc-def-ghi-klm"} {:a2p-id "2", :dh-uuid "def-ghi-klm-opq"} {:a2p-id "3", :dh-uuid nil}]) If you want to filter out only nil: (filter (comp (complement nil?) :dh-uuid) some-list) If you want to filter out nil or false: (filter (comp identity :dh-uui

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread atkaaz
can you tell what this returns? (map find-records query-parts) On Sat, May 25, 2013 at 2:21 PM, Mond Ray wrote: > I am missing something obvious... I get a list of maps back from a > function and I want to find the elements with nil > > (({:a2p-id "1", :dh-uuid "abc-def-ghi-klm"} {:a2p-id "2",

Re: filter on sets ... [reward: me face palming]

2013-05-25 Thread atkaaz
without giving this much thought is the % actualy a vector like [:dh-uuid "abc-def-ghi-klm"] ? On Sat, May 25, 2013 at 2:21 PM, Mond Ray wrote: > I am missing something obvious... I get a list of maps back from a > function and I want to find the elements with nil > > (({:a2p-id "1", :dh-uuid "