= ( obj1 obj2 -- ? )
Factor documentation > Factor handbook > The language > Objects > Equality
Prev:eq? ( obj1 obj2 -- ? )
Next:equal? ( obj1 obj2 -- ? )


Vocabulary
kernel

Inputs and outputs
obj1an object
obj2an object
?a boolean


Word description
Tests if two objects are equal. If obj1 and obj2 point to the same object, outputs t. Otherwise, calls the equal? generic word.

Examples
USING: kernel prettyprint ; 5 5 = .
t

USING: kernel prettyprint ; 5 005 = .
t

USING: kernel prettyprint ; 5 5.0 = .
f

USING: arrays kernel prettyprint ; { "a" "b" } "a" "b" 2array = .
t

USING: arrays kernel prettyprint ; { "a" "b" } [ "a" "b" ] = .
f


Definition
USING: math.private ;

IN: kernel

: = ( obj1 obj2 -- ? )
2dup eq?
[ 2drop t ]
[ 2dup both-fixnums? [ 2drop f ] [ equal? ] if ] if ;
inline