On Nov 27, 6:24 am, Sunil S Nandihalli <[email protected]>
wrote:
> Hello,
> I would like to know if it is possible to find out the name of the
> structure from its instance. my attempt to use the function class is not
> giving me any useful info. It kept saying that it is a structmap and
> nothing more...
> Regards,
> Sunil
Structures created with defstruct or create-struct do not store a
name. They only store the keys.
If you look at the source of defstruct:
user=> (source defstruct)
(defmacro defstruct
"Same as (def name (create-struct keys...))"
{:added "1.0"}
[name & keys]
`(def ~name (create-struct ~...@keys)))
you can see that the name is not even passed to create-struct. Only
the keys are. So the struct type cannot tell you its name.
- Chris
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en