Yes, as you've noticed, lists are implemented differently in #lang r5rs
vs #lang scheme/base
. If it's possible to write the tests in your foo-tests.scm
in r5rs, that would help to eliminate the possible confusion.
You should be able to do this by having this at the top of your foo-tests.scm
file.
#lang r5rs
(#%require schemeunit)
(#%require "foo.scm")
;; Now you can add your tests here:
(check-equal? a-list (list 1 2 3))
If the test suite is written in the same language, then the constructs --- and in particular, the representation for lists --- should match up. The test above should hopefully pass.
To elaborate on the difference between the r5rs
lists and the one in #lang scheme
(and #lang racket
): Racket uses immutable cons pairs to represent lists. Immutable cons pairs do not support the set-car!
and set-cdr!
functions of r5rs, so it wouldn't be faithful to the standard for the #lang r5rs
language to use the built-in immutable pairs. To support the r5rs standard, Racket includes a separate mutable pairs data type, and uses it consistently within r5rs. But it means that the standard pairs in Racket and the mutable pairs do not compare equally.