Skip to content

Equality

Given a file named “main.scm” with:

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

When I successfully run stak main.scm

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

lhs rhs output
’() ’() A
#f #f A
#t #t A
’() #f B
#f #t B
#t ’() B
42 42 A
42 0 B

Given a file named “main.scm” with:

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

When I successfully run stak main.scm

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

lhs rhs output
’() ’() A
#f #f A
#t #t A
’() #f B
#f #t B
#t ’() B
42 42 A
42 0 B
#\A #\A A
#\A #\B B

Use an equal? procedure with scalar values

Section titled “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 stak main.scm

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

lhs rhs output
’() ’() A
#f #f A
#t #t A
’() #f B
#f #t B
#t ’() B
42 42 A
42 0 B
#\A #\A A
#\A #\B B

Given a file named “main.scm” with:

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

When I successfully run stak main.scm

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

lhs rhs output
’() ’() 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