Handbook
Glossary
instance? ( object class -- ? )
Factor handbook
»
The language
»
Objects
»
Classes
Prev:
class-of ( object -- class )
Next:
superclass-of ( class -- super )
Vocabulary
classes
Inputs
object
an
object
class
a
class
Outputs
?
a
boolean
Word description
Tests whether the input object is a member of the class.
Definition
IN:
classes
GENERIC:
instance?
( object class -- ? )
flushable
Methods
USING:
accessors
classes
classes.algebra.private
kernel
;
M:
anonymous-complement
instance?
over
[
class>>
instance?
not
]
[
2drop
t
]
if
;
USING:
accessors
classes
classes.algebra.private
kernel
sequences
;
M:
anonymous-intersection
instance?
participants>>
[
instance?
]
with
all?
;
USING:
accessors
classes
classes.algebra.private
combinators
kernel
;
M:
anonymous-predicate
instance?
2dup
class>>
instance?
[
predicate>>
( object -- ? )
call-effect
]
[
2drop
f
]
if
;
USING:
accessors
classes
classes.algebra.private
kernel
sequences
;
M:
anonymous-union
instance?
members>>
[
instance?
]
with
any?
;
USING:
classes
classes.builtin
kernel
kernel.private
;
M:
builtin-class
instance?
[
tag
]
[
class>type
]
bi*
eq?
;
USING:
classes
classes.intersection
kernel
sequences
words
;
M:
intersection-class
instance?
"participants"
word-prop
[
instance?
]
with
all?
;
USING:
accessors
classes
classes.maybe
kernel
;
M:
maybe
instance?
over
[
class>>
instance?
]
[
2drop
t
]
if
;
USING:
classes
classes.predicate
combinators
kernel
words
;
M:
predicate-class
instance?
2dup
superclass-of
instance?
[
"predicate-definition"
word-prop
( object -- ? )
call-effect
]
[
2drop
f
]
if
;
USING:
classes
classes.singleton
kernel
;
M:
singleton-class
instance?
eq?
;
USING:
classes
classes.tuple
classes.tuple.private
kernel
;
M:
tuple-class
instance?
dup
echelon-of
layout-class-offset
tuple-instance?
;
USING:
classes
classes.union
kernel
sequences
words
;
M:
union-class
instance?
"members"
word-prop
[
instance?
]
with
any?
;