• (fn? x)
Returns true if x implements Fn, i.e. is an object created via fn.

2 Examples top

  • user=> (fn? 5)
    false
    user=> (fn? inc)
    true
    user=> (fn? (fn []))
    true
    user=> (fn? #(5))
    true
  • ;; Even though maps, sets, vectors and keywords behave as functions:
    user=> ({:a 1} :a)
    1
    
    ;; fn? still returns false for them because they are not created using fn:
    user=> (fn? {:a 1})
    false
    
Log in to add / edit an example.

See Also top

  • 0
    clojure.core/ifn?

    Returns true if x implements IFn. Note that many data structures (e

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:5478 top

(defn fn?
  "Returns true if x implements Fn, i.e. is an object created via fn."
  {:added "1.0"
   :static true}
  [x] (instance? clojure.lang.Fn x))
Vars in clojure.core/fn?:
Used in 0 other vars

Comments top

No comments for fn?. Log in to add a comment.