=> (pprint agenda)
{:first-topic #{:justin :scott :les :valentin :andy },
:second-topic #{:justin :scott :les :valentin :andy :gopi },
:third-topic #{:les :valentin :andy :gopi },
:fourth-topic #{:les :valentin :andy :gopi },
:fifth-topic #{:beth :les :valentin :andy :gopi },
:sixth-topic #{:beth :gopi },
:seventh-topic #{:justin :scott :beth }}
dedupe all the voters into a single set
=> (def voters (set (mapcat identity (vals agenda))))
group topics by individual voter
=> (defn voter->topics [voter agenda]
(let [topics (->> agenda (group-by (comp voter val)) voter (map first) set)]
{topics #{voter}}))
=> (defn votes-by-topics [voters agenda]
(reduce (fn [m v]
(merge-with (comp set concat) m (voter->topics v agenda)))
{} voters))
=> (pprint (votes-by-topics voters agenda))
{#{:seventh-topic :second-topic :first-topic } #{:justin :scott },
#{:seventh-topic :fifth-topic :sixth-topic } #{:beth },
#{:third-topic :second-topic :first-topic :fifth-topic :fourth-topic } #{:les :valentin :andy },
#{:third-topic :second-topic :fifth-topic :fourth-topic :sixth-topic } #{:gopi }}