You're viewing version 1.2.0 of satisfies?. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16



  • (satisfies? protocol x)
Returns true if x satisfies the protocol

1 Example top

  • (ns foo)
    (defprotocol Foo
      (foo [this]))
    (defprotocol Bar
      (bar [this]))
    (extend java.lang.Number
      {:bar (fn [this] 42)})
    (extend java.lang.String
      {:foo (fn [this] "foo")}
      {:bar (fn [this] "forty two")})
    (satisfies? Foo "zam") ; => true
    (satisfies? Bar "zam") ; => true
    (satisfies? Foo 123)   ; => false
    (satisfies? Bar 123)   ; => true
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core_deftype.clj:457 top

(defn satisfies? 
  "Returns true if x satisfies the protocol"
  {:added "1.2"}
  [protocol x]
  (boolean (find-protocol-impl protocol x)))
Vars in clojure.core/satisfies?: boolean defn find-protocol-impl
Used in 0 other vars

Comments top

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