How can I get the methods of a Java class from Clojure?

[EDIT 2] Per M Smith’s comment below, this accomplishes the same but provides sorting by method name and only returns methods: (print-table (sort-by :name (filter :exception-types (:members (r/reflect “foo”))))) [/EDIT 2] [EDIT] My original answer refers to Clojure 1.2, but things have changed with Clojure 1.3. This works without any reliance on Clojure’s contrib libraries … Read more

Clojure: rest vs. next

As the page you linked described, next is stricter than (the new behaviour of) rest because it needs to evaluate the structure of the lazy cons to know whether to return nil or a seq. rest on the other hand always returns a seq, so nothing needs to be evaluated until you actually use the … Read more

Where should I use defrecord in clojure?

I consider structs to be effectively deprecated so I don’t use them at all. When I have a fixed set of well-known keys used in many map instances, I usually create a record. The big benefits are: Performance Generated class has a type that I can switch on in multimethods or other situations With additional … Read more