Some Differences Between the PLT Student Languages and R5RS Scheme

Lexical rules

The teaching languages are case-sensitive. R5RS is not.

In the teaching languages, square brackets can be used in place of round brackets. In R5RS, you must use round brackets.


In R5RS, you must use #t and #f for true and false. The PLT true and false are not available.

The PLT special form cond is available in R5RS. In addition, both languages have an if special form, although this is not covered in CS 135/136. The expression (if test true-part false-part) is equivalent to (cond (test true-part) (else false-part)).

In PLT, the special form if must have both the true-part and the false-part. In R5RS, the false-part may be omitted; in this case, if the test is #f, the value produced by the if form is unspecified. Hence, this feature is only useful if the value produced by the if form is not needed, i.e., if it is only being evaluated for its side-effects.

In R5RS, the test above does not have to be a boolean expression. There is an implicit conversion from all types to boolean type, so that any value can be used as a boolean test. The conversion is simple: anything that is not #f is treated as #t. In particular, note that 0 is treated as #t.


In the most recent versions of the Racket language, cons produces immutable pairs. Mutable pairs in Racket are available via the function mcons. In R5RS, all pairs are mutable. cons produces a mutable pair, and there is no mcons.

Use the following table to determine the R5RS equivalents of the more familiar PLT list-handling functions:
empty'() or (list)


R5RS does not have structures (define-struct, etc.). You must emulate structures with lists.

Evaluation Strategy

In PLT, a function application (e1 e2 e3 ... en) proceeds as follows:

In R5RS, the evaluation strategy is different: Therefore, it is bad style to write programs whose behaviour depends on the order of evaluation of function arguments. This leads to programs whose semantics are compiler-dependent and non-portable.

On the other hand, the special forms and and or have the same behaviour (short-circuiting, left-to-right) in R5RS as they do in PLT.

Equality Predicates

Most, but not all, of the familiar equality predicates from PLT are available in R5RS. In particular, note that symbol=? is not available in R5RS; use eqv? instead. See course notes, Chapter 3 for more details.

Local Definitions

The PLT special form local is not available. Instead, R5RS provides the special forms let, let*, and letrec, whose behaviour is similar, but whose syntax is different. See course notes Chapter 3 for more details.

Nested defines are available in R5RS.