78 lines
2.8 KiB
Plaintext
78 lines
2.8 KiB
Plaintext
Racket v5.0 is the first release under the name "Racket". The Racket
|
|
core was formerly named "MzScheme" and the overall package was
|
|
formerly named "PLT Scheme".
|
|
|
|
The Racket language is slightly different from the PLT Scheme language
|
|
of v4.x:
|
|
|
|
* The preferred form for creating new structure types is now
|
|
`struct', the `struct' form is like `define-struct', but it does
|
|
not bind a constructor with a `make-' prefix; instead, the
|
|
structure-type name doubles as its constructor:
|
|
|
|
> (struct a (x y))
|
|
> (a 1 2)
|
|
#<a>
|
|
|
|
* The default printing mode now tries print values as expressions
|
|
that would produce the value, instead of text for which `read'
|
|
would produce the value.
|
|
|
|
For transparent structures, the printed form looks like a use of
|
|
the constructor. For symbols, lists, vectors, prefab structure
|
|
types, etc., the printed form uses a quote mark if possible or
|
|
constructors like `list' otherwise. Opaque values, such as
|
|
procedures, print using #<...> notation in either quoted or
|
|
unquoted positions.
|
|
|
|
> (list 1 2 3)
|
|
'(1 2 3)
|
|
> (lambda (x) x)
|
|
#<procedure>
|
|
> (list (lambda (x) x))
|
|
'(#<procedure>)
|
|
|
|
> (struct a (x y))
|
|
> (a 1 2)
|
|
#<a>
|
|
> (list (a 1 2) (a 3 4))
|
|
'(#<a> #<a>)
|
|
|
|
> (struct b (x y) #:transparent)
|
|
> (b 1 2)
|
|
(b 1 2)
|
|
> (list (b 1 2) (b 3 4))
|
|
(list (b 1 2) (b 3 4))
|
|
|
|
* The `pretty-print' function is like `print', and so it may use the
|
|
printing style above. A new `pretty-write' function behaves
|
|
consistently like `write'. Uses of `pretty-print' that were meant
|
|
to as a pretty variant of `write' should change to `pretty-write'.
|
|
|
|
The old PLT Scheme language is still provided by the libraries
|
|
`scheme', `scheme/base, etc. The new Racket language is provided by
|
|
`racket', `racket/base', etc. The `mzscheme' executable starts
|
|
`racket' with `scheme/init' as the start-up language instead of
|
|
`racket/init'.
|
|
|
|
To improve compatibility between Racket and v4.x programs and libraries,
|
|
|
|
* the `racket' language includes the old `define-struct' form, and
|
|
|
|
* the `define-struct' form of `scheme' binds the type name as a
|
|
constructor, in addition to binding a `make-' prefixed name.
|
|
|
|
Beware, however, that `scheme/unit' (and therefore `scheme') exports a
|
|
`struct' form for use in signatures that is different from the
|
|
`struct' now exported by `racket'.
|
|
|
|
The `slideshow' and `scribble/base' languages are now derived from
|
|
`racket' and `racket/base' instead of `scheme' and `scheme/base'.
|
|
|
|
The preferred file extension for Racket sources is ".rkt". To smooth
|
|
the transition to the new file extension, a ".ss" file extension in a
|
|
module reference is automatically converted to ".rkt". At the same
|
|
time, when loading a module through a path that ends in ".rkt", a
|
|
".ss" file is substituted if it exists while the ".rkt" version
|
|
doesn't exist.
|