Given a function x in clojure how can I programatically get a count of the number of arguments?
eg:
(fn a [b c] ...) has has two arguments (fn a [] ...)
You could construct a function taking all arguments, putting them in a list and returning the count like so:
(defn arg-count [& rest] (count rest)) (arg-count) ;; 0 (arg-count 1 2 3) ;; 3