Skip to content

Instantly share code, notes, and snippets.

What would you like to do?

List of all Clojure Predicate functions

A predicate function returns a boolean true or false, and it's name ends with a ?. Ran against Clojure 1.10.0.

({:ns clojure.string,
  ({:fn ends-with?, :arglists ([s substr])}
   {:fn starts-with?, :arglists ([s substr])}
   {:fn includes?, :arglists ([s substr])}
   {:fn blank?, :arglists ([s])})}

{:ns clojure.core,
  ({:fn decimal?, :arglists ([n])}
   {:fn contains?, :arglists ([coll key])}
   {:fn every?, :arglists ([pred coll])}
   {:fn qualified-keyword?, :arglists ([x])}
   {:fn satisfies?, :arglists ([protocol x])}
   {:fn seq?, :arglists ([x])}
   {:fn fn?, :arglists ([x])}
   {:fn vector?, :arglists ([x])}
   {:fn thread-bound?, :arglists ([& vars])}
   {:fn any?, :arglists ([x])}
   {:fn isa?, :arglists ([child parent] [h child parent])}
   {:fn boolean?, :arglists ([x])}
   {:fn char?, :arglists ([x])}
   {:fn some?, :arglists ([x])}
   {:fn inst?, :arglists ([x])}
   {:fn future-done?, :arglists ([f])}
   {:fn simple-symbol?, :arglists ([x])}
   {:fn pos?, :arglists ([num])}
   {:fn sequential?, :arglists ([coll])}
   {:fn neg?, :arglists ([num])}
   {:fn reduced?, :arglists ([x])}
   {:fn float?, :arglists ([n])}
   {:fn set?, :arglists ([x])}
   {:fn reversible?, :arglists ([coll])}
   {:fn bound?, :arglists ([& vars])}
   {:fn map?, :arglists ([x])}
   {:fn volatile?, :arglists ([x])}
   {:fn var?, :arglists ([v])}
   {:fn empty?, :arglists ([coll])}
   {:fn string?, :arglists ([x])}
   {:fn uri?, :arglists ([x])}
   {:fn double?, :arglists ([x])}
   {:fn map-entry?, :arglists ([x])}
   {:fn int?, :arglists ([x])}
   {:fn associative?, :arglists ([coll])}
   {:fn keyword?, :arglists ([x])}
   {:fn even?, :arglists ([n])}
   {:fn tagged-literal?, :arglists ([value])}
   {:fn extends?, :arglists ([protocol atype])}
   {:fn indexed?, :arglists ([coll])}
   {:fn counted?, :arglists ([coll])}
   {:fn future?, :arglists ([x])}
   {:fn zero?, :arglists ([num])}
   {:fn simple-keyword?, :arglists ([x])}
   {:fn not-every?, :arglists ([pred coll])}
   {:fn class?, :arglists ([x])}
   {:fn future-cancelled?, :arglists ([f])}
   {:fn neg-int?, :arglists ([x])}
   {:fn sorted?, :arglists ([coll])}
   {:fn nil?, :arglists ([x])}
   {:fn instance?, :arglists ([c x])}
   {:fn bytes?, :arglists ([x])}
   {:fn record?, :arglists ([x])}
   {:fn identical?, :arglists ([x y])}
   {:fn ident?, :arglists ([x])}
   {:fn qualified-ident?, :arglists ([x])}
   {:fn true?, :arglists ([x])}
   {:fn reader-conditional?, :arglists ([value])}
   {:fn integer?, :arglists ([n])}
   {:fn special-symbol?, :arglists ([s])}
   {:fn ratio?, :arglists ([n])}
   {:fn delay?, :arglists ([x])}
   {:fn ifn?, :arglists ([x])}
   {:fn nat-int?, :arglists ([x])}
   {:fn chunked-seq?, :arglists ([s])}
   {:fn distinct?, :arglists ([x] [x y] [x y & more])}
   {:fn pos-int?, :arglists ([x])}
   {:fn odd?, :arglists ([n])}
   {:fn uuid?, :arglists ([x])}
   {:fn false?, :arglists ([x])}
   {:fn list?, :arglists ([x])}
   {:fn simple-ident?, :arglists ([x])}
   {:fn rational?, :arglists ([n])}
   {:fn realized?, :arglists ([x])}
   {:fn number?, :arglists ([x])}
   {:fn not-any?, :arglists ([pred coll])}
   {:fn qualified-symbol?, :arglists ([x])}
   {:fn seqable?, :arglists ([x])}
   {:fn symbol?, :arglists ([x])}
   {:fn coll?, :arglists ([x])})}

{:ns clojure.core.specs.alpha,
  ({:fn even-number-of-forms?, :arglists ([forms])})}

{:ns clojure.spec.alpha,
  ({:fn inst-in-range?, :arglists ([start end inst])}
   {:fn valid?, :arglists ([spec x] [spec x form])}
   {:fn regex?, :arglists ([x])}
   {:fn int-in-range?, :arglists ([start end val])}
   {:fn spec?, :arglists ([x])}
   {:fn ?, :arglists ([pred-form])}
   {:fn invalid?, :arglists ([ret])}
   {:fn check-asserts?, :arglists ([])})})
(ns predicate-functions.main
[clojure.string :refer [ends-with?]]
[clojure.pprint :refer [pprint]]))
(defn ns-predicates [namespace]
(keys (ns-publics namespace))
(filter #(ends-with? % "?"))
(map #(hash-map
:fn %
:arglists (:arglists (meta (ns-resolve namespace %)))))))
(defn all-predicates []
(->> (all-ns)
(map ns-name)
(map #(hash-map
:ns %
:predicates (ns-predicates %)))
(filter #(seq (:predicates %)))))
(defn -main [& args]
(pprint (all-predicates)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.