ataggart ( sean): Thanks! I over-looked that in my haste to
respond.
lambdatronic: That's a very slick use of and in the outer some! I
quite like that.
Thanks to all again.
On Dec 11, 5:20 pm, lambdatronic gwjoh...@uvm.edu wrote:
This shaves 7 characters off Sean's solution and short
This shaves 7 characters off Sean's solution and short circuits just
as fast:
(some #(and (some #{rabble} (val %)) (key %)) players)
Happy hacking!
On Dec 10, 3:29 pm, Sean Devlin francoisdev...@gmail.com wrote:
Oops! Slight mistake
(ffirst (filter (comp (partial some #{rabble}) val)
Thanks for the suggestions.
I think since the original version short circuits when it finds a
result (using some), that's probably what I have to stick with.
One thing I didn't mention in the original problem statement is that
my players map can be large.
Again, thanks for the ideas.
Kyle
--
On Dec 11, 10:44 am, mudphone kyle...@gmail.com wrote:
Thanks for the suggestions.
I think since the original version short circuits when it finds a
result (using some), that's probably what I have to stick with.
Sean's solution does as well.
--
You received this message because you are
Hi Folks,
So, I have a search string, for example rabble. And a map which
contains keyword keys, and vectors of strings as values:
(def players
{
:amit [a b c]
:roger [rabble x y]
})
Is there an idiomatic way to search for rabble in the vector values,
then return the keyword that matches it?
Try this...
(second (first (filter (comp (partial some #{rabble}) val)
players)))
On Dec 10, 2:40 pm, mudphone kyle...@gmail.com wrote:
Hi Folks,
So, I have a search string, for example rabble. And a map which
contains keyword keys, and vectors of strings as values:
(def players
{
:amit
Oops! Slight mistake
(ffirst (filter (comp (partial some #{rabble}) val) players))
On Dec 10, 3:27 pm, Sean Devlin francoisdev...@gmail.com wrote:
Try this...
(second (first (filter (comp (partial some #{rabble}) val)
players)))
On Dec 10, 2:40 pm, mudphone kyle...@gmail.com wrote:
Hi
Hi,
Am 10.12.2009 um 20:40 schrieb mudphone:
So, I have a search string, for example rabble. And a map which
contains keyword keys, and vectors of strings as values:
(def players
{
:amit [a b c]
:roger [rabble x y]
})
(defn key-from-match [search-str]
(let [key-of-str? (fn