Hi Ray,

Perhaps this?


user> (let [desired-entity-names (set (map entity-names [:model :project]))]
        (select #(desired-entity-names (:entity %))
                query-parts))
#{{:entity "Model",   :main-query "select * from model where ..."} 
  {:entity "Project", :main-query "select * from project where ..."}}


All the best,
  Tj

On Friday, May 31, 2013 10:18:09 PM UTC+2, mond wrote:
>
> Sometimes its just so frustrating when you know you are close but just 
> cannot get that last little bit ... so I am appealing again for more newbie 
> support 
>
> I have a map for some names:
>
> user=> (def entity-names {:project "Project" :model "Model"})
>
> Which I then reference in a set of maps:
>
> user=> def query-parts #{{:entity (entity-names :project )
>                     :main-query "select * from project where ..." }
>                    {:entity (entity-names :model )
>                     :main-query "select * from model where ..." }})
>
> This query-parts is actually a large set. It will form the basis of 
> execution and sometimes I want to execute a smaller set of the queries.
>
> So I want to be able to filter it based on a subset of the entity names, 
> for example just :model.
>
> user=> (select #(= (:model entity-names) (:entity %)) query-parts)
> #{{:entity "Model", :main-query "Model Query"}}
>
> So that works great.
>
> But I would like a list of entities (:model :project :foo :bar) that 
> represents a subset of the complete set of query parts.
>
> So I just (sic!) need some advice on how to run this select over a list of 
> entity names rather than just the one shown above.
>
> I'm ashamed to say that I have spent an hour on this already so this is my 
> white flag. I hope you can help.
>
> Thanks
>
> Ray
>
>

-- 
-- 
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.


Reply via email to