Mark Fredrickson <mark.m.fredrick...@gmail.com> writes: > Is the following behavior correct or a bug: > > user> (defrecord Example [data] clojure.lang.IFn (invoke [this] this) > (invoke [this n] (repeat n this))) > user.Example > user> (def e (Example. "I am e")) > #'user/e > user> (e 2) > (#:user.Example{:data "I am e"} #:user.Example{:data "I am e"}) > user> (def some-es (e 5)) > ; Throws java.lang.AbstractMethodError > > I can't tell if I am doing something wrong with respect to the IFn > definition, or if I am encountering a bug.
I think you need to implement applyTo for a properly working IFn implementation: (defrecord Example [data] clojure.lang.IFn (invoke [this] this) (invoke [this n] (repeat n this)) (applyTo [this args] (clojure.lang.AFn/applyToHelper this args))) -- 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