Skip to content

Instantly share code, notes, and snippets.

@lukaszkorecki
Last active Oct 8, 2019
Embed
What would you like to do?
user=> (defrecord Foo [foo bar])
user.Foo
user=> (def f (->Foo :foo :bar))
#'user/f
user=> (defrecord Qux [foo bar baz])
user.Qux
user=> (def q (map->Qux (select-keys f [:foo :bar])))
#'user/q
user=> (clojure.pprint/pprint q)
{:foo :foo, :bar :bar, :baz nil}
user=> (def q (map->Qux f))
#'user/q
user=> (clojure.pprint/pprint q)
{:foo :foo, :bar :bar, :baz nil}
nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment