arg-check ^
counts the number of non-varidic argument types
v 3.0
(defn arg-check
[f num]
(or (if-let [vc (varg-count f)]
(<= vc num))
(some #(= num %) (arg-count f))
(throw (ex-info (str "Function must accomodate " num " arguments")
{:function f}))))
link
(arg-check (fn [x]) 1) => true (arg-check (fn [x & xs]) 1) => true (arg-check (fn [x & xs]) 0) => (throws Exception "Function must accomodate 0 arguments")