On 17 February 2010 22:24, metaperl <[email protected]> wrote:
> Hi, the ref manual <http://clojure.org/special_forms> introduces :keys
> which I understand. It then says:
>
> """There are similar :strs and :syms directives for matching string
> and symbol keys."""
>
> but no example is given. Could someone supply an example for each of
> these directives please? I simply am finding the manual too terse
> here.


user=> (let [{:keys [fred]} {:fred "I'm fred"}] fred)
"I'm fred"
user=> (let [{:strs [fred]} {"fred" "I'm fred"}] fred)
"I'm fred"
user=> (let [{:syms [fred]} {'fred "I'm fred"}] fred)
"I'm fred"


:keys    binds   fred   to  the value in the map found with key :fred
:strs     binds   fred   to the value in the map found with key "fred"
:syms   binds   fred   to the value in the map found with key which is
a symbol fred

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to