I'm still new at this, thanks for any help.

The following line extracts a value from a data structure:

(:value (first (filter #(= (:name %) "abc") input-attrs)))

*input-attrs* is a seq of hashes that for example looks like:

({:src "a.png", :name "abc", :value "a"} {:name "def", :src "b.gif", :value 
"b"})

This is test data; the real data will have this structure but have more 
hashes.  My goal is to return the :value value when a specific :name value 
is specified.  The first line above is how to extract the :value value when 
:name = "abc".  The problem is that I need to extract 2 :value values for 2 
distinct :name values from this one structure.  The structure is moderately 
expensive to construct, so while I have it built I'd like to pull 
everything out of it that I need at once.

It struck me that I should pass a vector of :name values to this function 
and have some sort of *for *or *map *process the vector over this 
extraction.  But I cannot seem to write that correctly.  It also struck me 
that once I can do the extractions correctly that I should probably pass a 
list of hashes back that has the result, such as:

({name "abc", :value "a"} {:name "def" :value "b"})

But then that looks curiously very similar to the original structure (minus 
unmatched hashes and some unneeded other values).  Am I just thinking about 
this "wrongly"?  Thanks for any help.

-- 
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/d/optout.

Reply via email to