Skip to content

Equality

Use an eq? procedure

Given a file named “main.scm” with:

(import (scheme base))
(write-u8 (if (eq? <lhs> <rhs>) 65 66))

When I successfully run scheme main.scm

Then the stdout should contain exactly “<output>”.

Examples

lhsrhsoutput
’()’()A
#f#fA
#t#tA
’()#fB
#f#tB
#t’()B
4242A
420B

Use an eqv? procedure

Given a file named “main.scm” with:

(import (scheme base))
(write-u8 (if (eqv? <lhs> <rhs>) 65 66))

When I successfully run scheme main.scm

Then the stdout should contain exactly “<output>”.

Examples

lhsrhsoutput
’()’()A
#f#fA
#t#tA
’()#fB
#f#tB
#t’()B
4242A
420B
#\A#\AA
#\A#\BB

Use an equal? procedure with scalar values

Given a file named “main.scm” with:

(import (scheme base))
(write-u8 (if (equal? <lhs> <rhs>) 65 66))

When I successfully run scheme main.scm

Then the stdout should contain exactly “<output>”.

Examples

lhsrhsoutput
’()’()A
#f#fA
#t#tA
’()#fB
#f#tB
#t’()B
4242A
420B
#\A#\AA
#\A#\BB

Use an equal? procedure with collections

Given a file named “main.scm” with:

(import (scheme base))
(write-u8 (if (equal? <lhs> <rhs>) 65 66))

When I successfully run scheme main.scm

Then the stdout should contain exactly “<output>”.

Examples

lhsrhsoutput
’()’()A
’(1)‘(1)A
’(1 2)‘(1 2)A
’(1 2 3)‘(1 2 3)A
’(1 2 3)‘(1 2 3 4)B
#()#()A
#(1)#(1)A
#(1 2)#(1 2)A
#(1 2 3)#(1 2 3)A
#(1 2 3)#(1 2 3 4)B