On Sunday 30 November 2008 09:50, Rich Hickey wrote:
> On Nov 30, 2008, at 12:14 PM, Randall R Schulz wrote:
> > ...
> >
> > Critiques welcome.
>
> I like reduce for these things. It will let you perform a
> transformation and assoc conditionally if needed:
>
> (defn ns-var-metas
> "Acquire a map from Var names to their respective metadata
> maps for each public Var in the specified namespace"
> [ns]
> (reduce (fn [ret [name var]]
> (assoc ret name ^var))
> {} (ns-publics (the-ns ns))))
>
> Note that the seq of a map returns map entries that can be
> destructured with [key val], or accessed with (key e), (val e).
Excellent. I love the destructuring bind capability and it hadn't
occurred to me to apply it here.
Thanks.
> Rich
Randall Schulz
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---