Skip to content

Instantly share code, notes, and snippets.

@dfuenzalida
Created August 4, 2020 06:34
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 dfuenzalida/6bff139ccafee03cce0172ce82f0bee4 to your computer and use it in GitHub Desktop.
Save dfuenzalida/6bff139ccafee03cce0172ce82f0bee4 to your computer and use it in GitHub Desktop.
ClojureScript defrecord and keyword lookups?
(defrecord Attr [has-default default])
cljs.user/Attr
cljs.user=> (def attr (->Attr true 1))
#'cljs.user/attr
cljs.user=> attr
#cljs.user.Attr{:has-default true, :default 1}
cljs.user=> (map? attr)
true
cljs.user=> (keys attr)
(:has-default :default)
cljs.user=> (get attr :has-default)
true
cljs.user=> (:has-default attr)
true
cljs.user=> (get attr :default)
1
cljs.user=> (:default attr)
nil ;; HUH?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment