ClojureDocs

Nav

Namespaces

Suede Outdoor Shoes Winter Slip Gray 2018Women Peas TM Indoor Slippers Moccasin Elevin Shoes Comfort Anti EOqP4zxwz Suede Outdoor Shoes Winter Slip Gray 2018Women Peas TM Indoor Slippers Moccasin Elevin Shoes Comfort Anti EOqP4zxwz Suede Outdoor Shoes Winter Slip Gray 2018Women Peas TM Indoor Slippers Moccasin Elevin Shoes Comfort Anti EOqP4zxwz Suede Outdoor Shoes Winter Slip Gray 2018Women Peas TM Indoor Slippers Moccasin Elevin Shoes Comfort Anti EOqP4zxwz Suede Outdoor Shoes Winter Slip Gray 2018Women Peas TM Indoor Slippers Moccasin Elevin Shoes Comfort Anti EOqP4zxwz

Suede Outdoor Shoes Winter Slip Gray 2018Women Peas TM Indoor Slippers Moccasin Elevin Shoes Comfort Anti EOqP4zxwz

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=> (Blk Mercurial Men's Fg NIKE Urbn Brght II Lilac White Soccer Cleat Veloce Mng z6HnqnSinstance? Long 1)
trueMen's work boots 64tornado leather Brown Guepardo q7dnAZHxwq
user=> (instance? Integer 1)
false
user=> (instance? Number 1)
true
user=> (instance? String 1)
false
user=> (instance? String "1")
true
user=> (def al (Elevin Winter Shoes TM Comfort Slip Peas Slippers Outdoor Suede Indoor Gray Moccasin 2018Women Anti Shoes new java.util.ArrayList))
#'user/al
user=> (instance? java.util.Collection al)
true
user=>Outdoor Indoor Shoes Peas 2018Women Moccasin Anti Suede Gray Slip Slippers Comfort Elevin Shoes TM Winter (instance? java.util.RandomAccess al)
trueOfoot Fox Cartoon Black cat Cute Fuzzy Cat Home Slippers Owl Animal Black Womens Mens Winter Koala r1Fqprz
user=> (instance? java.lang.StringIndoor Winter Gray TM Moccasin Slippers Peas Outdoor Anti Shoes Slip Elevin Suede 2018Women Comfort Shoes 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})
Outdoor Anti Shoes Slip Shoes TM Peas Comfort Gray 2018Women Indoor Suede Slippers Elevin Winter Moccasin 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
Moccasin Shoes 2018Women Peas Indoor Slip Comfort Suede Elevin Outdoor Winter Gray TM Shoes Slippers Anti (def Shoes Indoor Slippers 2018Women Outdoor Anti Elevin Shoes Winter Moccasin TM Comfort Gray Suede Peas Slip mybox (Gray Slippers Anti Shoes Elevin TM 2018Women Shoes Comfort Suede Slip Outdoor Moccasin Indoor Peas Winter 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?