Skip to content

Instantly share code, notes, and snippets.

@duelinmarkers
Created May 9, 2014 22:00
Show Gist options
  • Save duelinmarkers/7c9f84cfc238e5d37a09 to your computer and use it in GitHub Desktop.
Save duelinmarkers/7c9f84cfc238e5d37a09 to your computer and use it in GitHub Desktop.
Surprising behavior w/ Clojure vs Java data structures
user=> (-> {} (assoc [1 2] "vec") (assoc (java.util.ArrayList. [1 2]) "alist"))
{[1 2] "alist"}
user=> (-> #{} (conj [1 2]) (conj (java.util.ArrayList. [1 2])))
#{[1 2]}
user=> *clojure-version*
{:major 1, :minor 5, :incremental 1, :qualifier nil}
;;;;;;;;;;;;;;;;;;;;;
user> (-> {} (assoc [1 2] "vec") (assoc (java.util.ArrayList. [1 2]) "alist"))
{[1 2] "alist"}
user> (-> #{} (conj [1 2]) (conj (java.util.ArrayList. [1 2])))
#{[1 2] [1 2]}
user> *clojure-version*
{:major 1, :minor 6, :incremental 0, :qualifier nil}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment