I noticed that core doesn't have a "children" function for
hierarchies, although it has "parents", "descendants", and
"ancestors". Here's one:
(defn children
([tag]
(set (filter (fn [t] (contains? (parents t) tag))
(descendants tag))))
([h tag]
(set (filter (fn [t] (contains? (parents h t) tag))
(descendants h tag)))))
The repetition is necessary because clojure.core/global-hierarchy is
private.
-Stuart Sierra
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---