![[index]](../icons/index.gif)
Next: Printed Results
Up: Interface Essentials
Previous: Errors
DrScheme supports five languages:
- Beginner is a small version
of Scheme that is tailored for beginning computer science
students.
- Intermediate extends
Beginner with programmer-defined datatypes and lexically-scoped
bindings.
- Advanced extends
Intermediate with mutable state.
- MzScheme is a practical
dialect of Scheme that is described in PLT MzScheme: Language Manual.
- MrEd extends MzScheme with a GUI
toolbox that is described in PLT MrEd: Graphical Toolbox Manual.
Programs written in standard Scheme generally require the Advanced,
MzScheme, or MrEd language.
DrScheme always shows the current evaluation language in the top of
the interactions window. To choose a different language, select the
Language|Configure Language... menu item. After changing
the language, click Execute to reset the language in the
interactions window.
The following table summarizes the syntactic
forms and procedures built into each language.
Beg Int Adv MzS MrEd
=================================================================
define (*), define-struct X X X X X
lambda (**) X X X X X
cond, if, and, or X X X X X
nand, nor X X X a a
quote'd symbols X X X X X
MrSpidey annotations X X X b b
quote'd lists, quasiquote, unquote X X X X
let (*), let* (*), letrec (*) X X X X
local X X a a
set! (*), fluid-let X X X
begin, begin0, implicit begin X X X
when, unless, if without else X X X
Named let, delay, do, case X X X
recur, rec, evcase X a a
Turtles, split, split*, tprompt X c
require-library X X X X X
define-macro, begin-elaboration-time X X X X X
time X X X X
let/cc, parameterize, with-handlers X X X
Other MzScheme syntax X X
=================================================================
Scheme and MzScheme procedures X X X X X
MzLib core library procedures X X X d d
MrEd GUI classes X
=================================================================
Case-sensitive identifiers and symbols X X X
Procedures must take at least 1 argument X X
Identifier required at function-call position X X
Top-level required at function-call position X
quote works only on symbols X
Unmatched cond/case is an error X X X
Conditional values must be #t or #f X X
eq? compares only symbols X X
=, ..., +, *, and / take at least 2 arguments X X X
and, or, nand, nor require at least 2 exprs X X X
Improper lists disallowed X X X
=================================================================
Constructor-style output X X X
write output X X
Abbreviate cons constructor with list X X
Show sharing in values X
Print inexact numbers with #i X X X
=================================================================
*: including -values forms
**: including case-lambda
a: Use (require-library "macro.ss")
b: Use (require-library "spidey.ss")
c: Use (require-library "turtle.ss" "graphics")
d: Use (require-library "core.ss")
Most lines in the table specify the syntactic forms and procedures
that each language provides. Lines in the next-to-last section
specify deviations from the standard Scheme language:
- Case-sensitive identifiers and symbols
-- In a case-sensntive language, the variable names x
and X are distinct, and the symbols 'x and 'X
arealso distinct. In a case-insensitive language, x and
X are equivalent and 'x and 'X represent the
same value.
- Procedures must take at least 1 argument -- In the Beginner and Advanced languages, defined
procedures must consume at least one argument. Since the
languages have no side-effects, zero-argument functions are not
useful, and rejecting such function definitions helps detect
confusing synatic mistakes.
- Identifier required at function call position -- In the Beginner and Advanced languages, procedure
calls must be of the form (identifier ...). This
restriction helps detect confusing misuses of parentheses, such
as (1) or ((+ 3 4)), which is a common mistake
among beginners who are used to the optional parentheses of
algebra.
- Top-level required at function call position -- In the Beginner language, procedure calls must be
of the form (top-level-identifier ...). This
restriction helps detect confusing misuses of parentheses, such
as (x) where x is a function
argument. DrScheme can detect such mistakes syntatically
because Beginner does not support higher-order procedures.
- quote works only on symbols --
In the Beginner and Advanced languages, quote and '
can specify only symbols. This restriction avoids the need to
explain to beginners why 1 and '1 are equivalent in
standard Scheme.
- Unmatched cond/case is an error -- In the Beginner, Intermediate, and Advanced
languages, falling through a cond or case
expression without matching a clause signals a run-time
error. This convention helps detect syntactic and logical
errors in programs.
- Conditional values must be #t or #f -- In the Beginner and Advanced languages, an
expression whose value is treated as a Boolean must return
#t or #f. This restriction, which applies to
if, cond, and, or, nand, and
nor expressions, helps detect errors where a Boolean
function application is omitted.
- eq? compares only symbols --
In the Beginner and Advanced
languages, the eq? function operates only on
symbols. This restriction avoids the need to explain low-level
details of Scheme's implementation in order to define eq?
on other types of data. Since beginners should use eq?
only for symbols, the restriction of eq? to symbols helps
detect various syntactic and logical errors.
- =, <=, <, >, >=, +, *, and / take at least two arguments --
In the Beginner, Intermediate, and Advanced languages,
mathematical operators that are infix in algebra notation
require at least two arguments in DrScheme. This restriction
helps detect missing arguments to an operator.
- and, or, nand, and nor require at least 2 expressions -- In the Beginner,
Intermediate, and Advanced languages, the Boolean combination
forms require at least two sub-expressions. This restriction
helps detect missing or ill-formed sub-expressions in a Boolean
expression.
- Improper lists disallowed -- A
proper list is either an empty list or a list created
by consing onto a proper list. In the Beginner and
Advanced languages, cons
constructs only proper lists, signalling an error if
the second argument is not a proper list. Since beginning
students do not need improper lists, this restriction help
detect logical errors in recursive functions.
Lines in the last section specify deviations from a traditional Scheme
read-eval-print interface in the way that DrScheme
prints interaction results:
The Language|Configure Language... dialog contains a
Show Details button that lets you configure certain details of
the language specification. (Each option corresponds to one of the
lines in the language table, but only a few of the lines in the
figure have an option in the dialog.) Whenever the selected options
do not match the default language specification, a Custom
indicator appears next to the language-selection control at the top
of the dialog.
![[index]](../icons/index.gif)
Next: Printed Results
Up: Interface Essentials
Previous: Errors
PLT