Thanks, Alan. It is more general solution which also works for keys
that are not keywords
user=> (map {"a" 1 "b" 2 "c" 3} [ "a" "b"])
(1 2)
On Dec 1, 5:02 pm, Alan Malloy wrote:
> I usually use juxt, but a more correct/robust solution is to use map,
> with the lookup-map as the function:
>
> (map
I usually use juxt, but a more correct/robust solution is to use map,
with the lookup-map as the function:
(map {:foo 1 :bar 2 :baz 0} [:foo :bar])
On Dec 1, 12:26 pm, Ulises wrote:
> How about using juxt:
>
> sandbox> ((juxt :foo :bar) {:foo 1 :bar 2 :baz 0})
> [1 2]
> sandbox>
>
> This only wo
Thanks, works in my case.
On Dec 1, 3:26 pm, Ulises wrote:
> How about using juxt:
>
> sandbox> ((juxt :foo :bar) {:foo 1 :bar 2 :baz 0})
> [1 2]
> sandbox>
>
> This only works, however, if you use keywords for keys (as they are
> functions themselves).
>
> U
--
You received this message becaus
((juxt :foo :bar) {:foo 1 :bar 2 :baz 3})
juxt to the rescue
--
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
How about using juxt:
sandbox> ((juxt :foo :bar) {:foo 1 :bar 2 :baz 0})
[1 2]
sandbox>
This only works, however, if you use keywords for keys (as they are
functions themselves).
U
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this gro
Is there something build in for getting multiple vals out of the map?
{:keys [...]} woks in destructuring forms. It is quite easy to build
something with filter and map but I suspect these is a common problem
somebody solved already.
Desired
(get-vals [:a :b] {:a 1 :b 2 :c 3})
(1 2)
--
You receiv