Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How is Racket different from Scheme?

People also ask

What Is a Racket Scheme?

Definition of racketa dishonest scheme, trick, business, activity, etc.: the latest weight-reducing racket.

Can Racket run Scheme?

Racket can not only run Racket programs (i.e. . rkt files), it can also run Scheme programs without requiring any modifications to the source code. Regular Racket files require the #lang declaration at the beginning of the source file, which is not valid in Scheme.

Is a Racket a Lisp?

The Racket language is a modern dialect of Lisp and a descendant of Scheme. It is designed as a platform for programming language design and implementation.


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.


It contains immutable lists, as mentioned above. It also contains a structure system that is a bit cleaner than the R6RS record system. It has an object oriented class and object system. It has native support for design by contract. It has a unit system reminiscent of the ML module system, as well as a module system much like the R6RS module system. I'm sure I've forgotten as many things as I've mentioned.

I'm not sure that the rename was useful as anything other than a marketing gimmick, but racket is definitely a distinct dialect of scheme.


The rationale for the name-change from PLT Scheme to Racket is discussed on the Racket site.


The language specification R5RS on the Scheme programming language is based on consensus between the multiple Scheme implementors. This imply that the language is very stable. It also implies that many useful features are not part of the R5RS standard.

Racket has built upon R5RS and extended it greatly. Some extensions are defined as macros, but some features require the support of the runtime system.

Features in Racket not implementable by macros alone:

  • delimited continuations (more general than call/cc)
  • continuation marks
  • threads
  • places
  • ffi

The module and macro system are much more general than the RnRS specification. Together with #lang reader/language specification makes it possible to define custom languages (with custom syntax) and use them with normal Racket programs.

In a few cases Racket has constructs whose behaviour deviates from R5RS. The most obvious one is making cons construct an immutable pair (mcons constructs a mutable pair). One advantage of a having immutable pairs, is that length now runs in O(1) amortized time.


Racket includes a lot of really nice language constructs not included in R6RS scheme, like "match".