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:
PLT | R5RS |
mcons | cons |
cons | |
list | list |
first | car |
rest | cdr |
empty | '() or (list) |
empty? | null? |
cons? | pair? |
list? | list? |
set-first! | set-car! |
set-rest! | set-cdr! |
second | cadr |
third | caddr |
fourth | cadddr |
R5RS does not have structures (define-struct, etc.). You must emulate structures with lists.
In PLT, a function application (e1 e2 e3 ... en) proceeds as follows:
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.
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.