Hello,

I just discovered that records (created using defrecord) can't be
treated as functions (like maps) anymore. Consider this -

user=> (defrecord Bird [nom species])
user.Bird
user=> (def crow (Bird. "Crow" "Corvus corax"))
#'user/crow
user=> (:nom crow)
"Crow"
user=> (crow :nom)
java.lang.ClassCastException: user.Bird cannot be cast to
clojure.lang.IFn (NO_SOURCE_FILE:0)
user=>

The documentation says "defrecord provides a complete implementation
of a persistent map". If a record is analogous to a map, why can't we
treat it as one?

If it's not a bug, what is the rationale behind it?

Regards,
BG

-- 
Baishampayan Ghose
b.ghose at gmail.com

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to