views:

519

answers:

5

Racket is a descendant of Scheme. How is Racket different than R6RS? What did it add, or take away, or is just different?

I'm understanding that Racket is more than a language, it's a platform for languages. But I'm referring to the main Racket dialect.

+1  A: 

For one big example, Racket lists are immutable by default whereas Scheme's are mutable. Racket also includes a lot of standard libraries (e.g. Web Server) that other Schemes do not.

Chuck
+2  A: 

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.

deinst
I think the rename was because they didn't want to be some dialect of Scheme with a bunch of nonstandard additions — they wanted to be a Scheme-based language with a bunch more stuff standard. Classifying PLT Scheme as "just" a dialect of Scheme is like classifying Ruby as a dialect of Mirah — it's not inaccurate, but it kind of downplays the language's strengths.
Chuck
+6  A: 

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.

Lajla
Awesome. Thanks!
mudge
In Racket `()` is invalid, not self-evaluating. Also, Racket *does* have the more restricted `letrec` -- for example, the one in the `r5rs` language; it's an intentional choice to use the `letrec*`-like version in the default language.
Eli Barzilay
@ Eli, whoops, you're right, racket running in Swindle mode seems to consider `()` self evaluating, I was confused with that one.I never really got why `()` was not self-evaluating in Scheme as it is in Common Lisp though.
Lajla
+3  A: 

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

Norman Gray
A: 

I've been messing around with it for a while and I love it! In fact I may do my next several projects in it. It seems to me to combine the usefulness of CL and the cleanliness of scheme. Plus I really like the standard libraries. I also like the inclusion of object-oriented programming, but I may instead use the prometheous module for that as I come from a javascript background whose style comes from Self.

Isaiah