Skip to content

Instantly share code, notes, and snippets.

@orb orb/winner.clj
Created Apr 26, 2014

Embed
What would you like to do?
(def matches
{:a {:a "foo" :b "bar"}
:b {:a "blue" :b {:a "fred" :b "bob"}}})
(defn winner [node]
(if (map? node)
(:winner node)
node))
(defn select-winner [node aorb]
(assoc node :winner (winner (aorb node))))
(-> matches
(update-in [:b :b] select-winner :a)
(update-in [:b] select-winner :b)
(update-in [:a] select-winner :a)
(select-winner :a))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.