Preview
Sign inSign up
Forms and builtinsEquality and booleans

Forms and builtins

Equality and booleans

6 builtins. Every example below ran on the evaluator, and the result shown is what it returned.

not

arity 1
(not x)

#t if the argument is #f, else #f.

(list (not #f) (not 0))

=>(#t #f)

boolean?

arity 1
(boolean? x)

Is the argument #t or #f?

(list (boolean? #f) (boolean? '()))

=>(#t #f)

eq?

arity 2
(eq? a b)

Are the arguments the same value? Compares by value, like equal?.

(eq? 'a 'a)

=>#t

eqv?

arity 2
(eqv? a b)

Are the arguments the same value? Compares by value, like equal?.

(list (eqv? 2 2) (eqv? 2 2.0))

=>(#t #f)

equal?

arity 2
(equal? a b)

Are the arguments structurally equal? (equal? 2 2.0) is #f.

(equal? '(1 (2 3)) '(1 (2 3)))

=>#t

procedure?

arity 1
(procedure? x)

Is the argument a procedure?

(list (procedure? car) (procedure? 'car))

=>(#t #f)

esc