Skip to content

Instantly share code, notes, and snippets.

@timmc
Created March 6, 2011 05:08
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 timmc/857048 to your computer and use it in GitHub Desktop.
Save timmc/857048 to your computer and use it in GitHub Desktop.
I thought defrecords were working OK
(defrecord Foo [a b])
;; => user.Foo
(def example (Foo. 3 (sorted-map :hello 5)))
;; => #'user/example
example
;; => #:user.Foo{:a 3, :b {:hello 5}}
(def serialized (binding [*print-dup* true] (pr-str example)))
;; => #'user/serialized
serialized
;; => "#=(user.Foo/create {:a 3, :b #=(clojure.lang.PersistentTreeMap/create {:hello 5})})"
(read-string serialized)
;; => java.lang.RuntimeException: java.lang.IllegalArgumentException: No matching method found: create (NO_SOURCE_FILE:0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment