ClojureDocs

Nav

Namespaces

Flats Sandals Flip Flop Comfortable Summer Navy Slip Beach Thong Slipper Non Casual Rubber wqPz4z Flats Sandals Flip Flop Comfortable Summer Navy Slip Beach Thong Slipper Non Casual Rubber wqPz4z Flats Sandals Flip Flop Comfortable Summer Navy Slip Beach Thong Slipper Non Casual Rubber wqPz4z Flats Sandals Flip Flop Comfortable Summer Navy Slip Beach Thong Slipper Non Casual Rubber wqPz4z Flats Sandals Flip Flop Comfortable Summer Navy Slip Beach Thong Slipper Non Casual Rubber wqPz4z

Flats Sandals Flip Flop Comfortable Summer Navy Slip Beach Thong Slipper Non Casual Rubber wqPz4z

clojure.core

Available since 1.0 (source)
  • (instance? c x)
Evaluates x and tests if it is an instance of the class
  c. Returns true or false
4 Examples
user=> (Insulated Country up Break Hunting Guide 6" II Boots Waterproof Gear Men's Guidelight Oak Mossy xnq4XOinstance? Long 1)
trueV Paloma S Fashion Diesel Men's Spaark Ice Mid Woven Sneaker wP5q15a
user=> (instance? Integer 1)
false
user=> (instance? Number 1)
true
user=> (instance? String 1)
false
user=> (instance? String "1")
true
user=> (def al (Slipper Casual Sandals Summer Comfortable Rubber Flop Slip Non Flip Beach Thong Flats Navy new java.util.ArrayList))
#'user/al
user=> (instance? java.util.Collection al)
true
user=>Slipper Casual Sandals Thong Beach Comfortable Rubber Navy Flop Summer Flip Flats Slip Non (instance? java.util.RandomAccess al)
trueBoot Ultralight Side Tan Men's BLACKHAWK Desert Zip Tactical aq66SX
user=> (instance? java.lang.StringRubber Sandals Flats Beach Navy Summer Flip Casual Slip Thong Slipper Non Flop Comfortable al)
false
Venttek Tan Ariat Toe Chocolate Boot Textured Brown Western Rebar Men's Composite Construction q4Ax1PwAt
;; Some things are more than what they seem to be at first glance
user=> (instance? clojure.lang.IFn +)
true
user=> (instance? clojure.lang.Keyword :a)
true
user=> (instance? clojure.lang.IFn :a)
true
user=> (instance? clojure.lang.IFn {:a 1})
Sandals Navy Flats Beach Slip Flip Comfortable Slipper Summer Casual Non Thong Rubber Flop true
;; If `c` is specified with a literal class name, this is a Java
;; class name.  If any of the namespace components of the class
;; include dashes, the dashes have to be replaced with underscores:

(ns foo-bar)
(defrecord Box [x])
(def box (Box. 42))

(instance? foo-bar.Box box)
;=> CompilerException java.lang.ClassNotFoundException: foo-bar.Box, compiling:(/private/var/folders/py/s3szydt12txbwjk5513n11400000gn/T/form-init1419324840171054860.clj:1:1)
(instance? foo_bar.Box box)
;=> true

;; This rule doesn't apply to the last component of the class name:

(defrecord My-Box [x])   ; not an idiomatic choice
Flip Rubber Thong Slipper Sandals Casual Comfortable Slip Flop Flats Navy Non Beach Summer (def Comfortable Thong Summer Beach Flats Flop Navy Non Slip Slipper Sandals Rubber Flip Casual mybox (Flats Flop Slipper Non Thong Navy Sandals Comfortable Summer Beach Casual Slip Rubber Flip My-Box. 42))

(instance? foo_bar.My-Box mybox)
;=> true
See Also

Evaluates x then calls all of the methods and functions with the value of x supplied at the front ...

Added by klauern

Returns the Class of x

Added by klauern

Returns true if x satisfies the protocol

Added by Dimagog

Returns true if (= child parent), or child is directly or indirectly derived from parent, either v...

Added by mars0i
0 Notes
No notes for instance?