Created
December 16, 2015 08:02
-
-
Save lokori/be67c0d81f5ce39868a8 to your computer and use it in GitHub Desktop.
clojure function arity reflector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn no-args? | |
"Returns true if f is a sym/var of a function with no arguments. False otherwise." | |
[f] | |
(cond (and | |
(seq? f) | |
(= 'fn* (first f))) | |
(empty? (second f)) | |
(symbol? f) | |
(= '([]) (:arglists (meta (resolve f)))) | |
(var? f) | |
(= '([]) (:arglists (meta f))) | |
(clojure.test/function? f) | |
(= ('[]) (:arglists (meta f)))) | |
(true? true) false)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment