Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jrosti
Created September 26, 2012 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrosti/3788541 to your computer and use it in GitHub Desktop.
Save jrosti/3788541 to your computer and use it in GitHub Desktop.
(defn get-val [ex-id term]
(if (not (contains? @inverted-index term))
#{ex-id}
(clojure.set/union (get @inverted-index term) #{ex-id})))
(defn insert-term [ex-id term]
(swap! @inverted-index assoc term (get-val ex-id term)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment