2011/1/27 OGINO Masanori <masanori.og...@gmail.com>

> Hello.
>
> Well, record lacks some features in struct for now, I see.
> And "defstructs implement IFn" means that we can use struct in the
> places need callbacks but record can't, right?
>
> Thank you.
>
> --
> Name:  OGINO Masanori (荻野 雅紀)
> E-mail: masanori.og...@gmail.com

Extending your record to IFn is easy, just add the invoke method.

(defrecord Foo []
   clojure.lang.IFn
   (invoke [this k] (get this k))

(def x (Foo.))

((assoc x :test 1) :test) ;; 1

David

-- 
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