Skip to content

Instantly share code, notes, and snippets.

@icambron
Last active August 29, 2015 14:24
Show Gist options
  • Save icambron/5d969958b2d51899ce42 to your computer and use it in GitHub Desktop.
Save icambron/5d969958b2d51899ce42 to your computer and use it in GitHub Desktop.
WTF transients?
;; a big list of urls
(def furls ["support.google.com" "docs.google.com" "wwwapps.ups.com" "www.twitter.com" "careers.stackoverflow.com" "careers.stackoverflow.com" "careers.stackoverflow.com" "support.google.com" "docs.google.com" "support.office.com" "salesforce.com" "tryscratch.com" "gist.github.com" "gist.github.com" "gist.github.com" "www.zensight.co" "gist.github.com" "gist.github.com" "www.linkedin.com" "gist.github.com" "www.amazon.com" "gist.github.com" "gist.github.com" "www.joyofclojure.com" "gist.github.com" "gist.github.com" "www.linkedin.com" "www.joyofclojure.com" "gist.github.com" "gist.github.com" "gist.github.com" "gist.github.com" "www.linkedin.com" "www.linkedin.com" "www.linkedin.com" "gist.github.com" "clojure.org" "clojure.org" "clojure.org" "clojure.org" "gist.github.com" "gist.github.com" "gist.github.com" "www.google.com" "gist.github.com" "www.google.com" "www.google.com" "gist.github.com" "gist.github.com" "www.google.com" "gist.github.com" "careers.stackoverflow.com" "meta.stackexchange.com" "careers.stackoverflow.com" "careers.stackoverflow.com" "gist.github.com" "www.google.com" "www.google.com" "gist.github.com" "www.zensight.co" "isaaccambron.com" "www.google.com" "www.google.com" "www.google.com" "www.linkedin.com" "www.linkedin.com" "www.linkedin.com" "www.linkedin.com" "www.linkedin.com" "docs.google.com" "support.google.com" "docs.google.com" "support.google.com" "support.office.com" "salesforce.com" "tryscratch.com" "wwwapps.ups.com" "www.twitter.com" "gist.github.com" "gist.github.com" "gist.github.com" "www.linkedin.com" "gist.github.com" "gist.github.com" "gist.github.com" "gist.github.com" "gist.github.com" "gist.github.com" "gist.github.com" "gist.github.com" "gist.github.com" "gist.github.com" "www.google.com" "gist.github.com" "www.google.com" "www.google.com" "www.google.com" "www.google.com" "gist.github.com" "gist.github.com" "www.zensight.co" "gist.github.com" "gist.github.com" "gist.github.com" "www.linkedin.com" "www.amazon.com" "www.joyofclojure.com" "www.linkedin.com" "www.linkedin.com" "www.linkedin.com" "gist.github.com" "clojure.org" "clojure.org" "www.google.com" "www.google.com" "gist.github.com" "gist.github.com" "www.google.com" "gist.github.com" "careers.stackoverflow.com" "meta.stackexchange.com" "careers.stackoverflow.com" "careers.stackoverflow.com" "www.google.com" "gist.github.com" "www.zensight.co" "isaaccambron.com" "www.linkedin.com" "www.linkedin.com" "www.linkedin.com" "www.linkedin.com" "www.linkedin.com"])
;;a stupid function for uniq'ing them (ignore that this is not the best way to do this
(defn found [strs]
(let [c (transient {})]
(doseq [s strs] (assoc! c s true))
(persistent! c)))
;;calling
(keys (found furls))
;;in my repl, i get: ("support.google.com" "docs.google.com" "wwwapps.ups.com" "www.twitter.com" "careers.stackoverflow.com" "support.office.com" "salesforce.com" "tryscratch.com")
;;which is missing, say, linkedin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment