How is Racket different from Scheme?

Racket is ultimately based on R5RS, and not R6RS and not a strict superset of either. I don’t think it can be called ‘Scheme’ because it’s not backwards compatible with any Scheme standard.

Most implementations offer extensions, but are otherwise backwards compatible, of course, the compiler that comes with Racket can also run in R5RS or R6RS mode. Valid R5/6RS Scheme that runs in racket mode may either be rejected, cause runtime errors, or behave differently than it should. With that said, the main points where it is not backwards compatible are:

  • Racket has no set-cdr! and set-car!, rather set-mcar! which only works on pairs specifically created as mutable.
  • What Racket calls letrec is called letrec* in R6RS and doesn’t exist in R5RS, what R5RS and R6RS call letrec doesn’t exist in Racket.
  • In Racket, a lot of things are self-evaluating which would raise an error in R5RS, most importantly the empty list.
  • Racket is case sensitive, though R6RS is also case sensitive
  • Racket treats ( ... ) and [ ... ] as equivalent, R5RS does not, but R6RS does.

There are probably more, but on most other parts racket is a superset of Scheme.

Leave a Comment