Getting the name of a Clojure struct type?

Posted by j-g-faustus on Stack Overflow See other posts from Stack Overflow or by j-g-faustus
Published on 2010-06-11T05:56:39Z Indexed on 2010/06/11 6:03 UTC
Read the original article Hit count: 391

Filed under:
|

When defining a struct type and instance, I can print the value and get the "struct" implementation type:

(defstruct person :name :age)
(def p (struct person "peter" 30))

user=> p
{:name "peter", :age 30}
user=> (type p)
clojure.lang.PersistentStructMap

But is it possible to tell whether p is an instance of the struct type "person"?

© Stack Overflow or respective owner

Related posts about struct

Related posts about clojure