clojure - Extend "name" for custom record type -
i have record includes :name
. there way tell clojure.core/name
how extract :name
out of record?
if you're able change defrecord
declaration, implement clojure.lang.named
interface there.
(defrecord myrecord [name] clojure.lang.named (getname [this] (:name this))) (name (myrecord. "dan")) ;;=> "dan""
Comments
Post a Comment