/usr/share/doc/racket/drracket/htdp-langs.html is in racket-doc 6.1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><title>2.3 How to Design Programs Teaching Languages</title><link rel="stylesheet" type="text/css" href="../scribble.css" title="default"/><link rel="stylesheet" type="text/css" href="../racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-style.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../doc-site.css" title="default"/><script type="text/javascript" src="../scribble-common.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../doc-site.js"></script><script type="text/javascript" src="../local-redirect/local-redirect.js"></script><script type="text/javascript" src="../local-redirect/local-user-redirect.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="doc-racket-lang-org"><div class="tocset"><div class="tocview"><div class="tocviewlist tocviewlisttopspace"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_0");">►</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x">Dr<span class="mywbr"> </span>Racket:<span class="mywbr"> </span> The Racket Programming Environment</a></td></tr></table></div><div class="tocviewsublisttop" style="display: none;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1 </td><td><a href="interface-essentials.html" class="tocviewlink" data-pltdoc="x">Interface Essentials</a></td></tr><tr><td align="right">2 </td><td><a href="languages.html" class="tocviewselflink" data-pltdoc="x">Languages</a></td></tr><tr><td align="right">3 </td><td><a href="Interface_Reference.html" class="tocviewlink" data-pltdoc="x">Interface Reference</a></td></tr><tr><td align="right">4 </td><td><a href="extending-drracket.html" class="tocviewlink" data-pltdoc="x">Extending Dr<span class="mywbr"> </span>Racket</a></td></tr><tr><td align="right"></td><td><a href="doc-index.html" class="tocviewlink" data-pltdoc="x">Index</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_1");">▼</a></td><td>2 </td><td><a href="languages.html" class="tocviewlink" data-pltdoc="x">Languages</a></td></tr></table><div class="tocviewsublistbottom" style="display: block;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">2.1 </td><td><a href="module.html" class="tocviewlink" data-pltdoc="x">Language Declared in Source</a></td></tr><tr><td align="right">2.2 </td><td><a href="legacy.html" class="tocviewlink" data-pltdoc="x">Legacy Languages</a></td></tr><tr><td align="right">2.3 </td><td><a href="" class="tocviewselflink" data-pltdoc="x"><span style="font-style: italic">How to Design Programs</span> Teaching Languages</a></td></tr><tr><td align="right">2.4 </td><td><a href="experimental-langs.html" class="tocviewlink" data-pltdoc="x">Other Experimental Languages</a></td></tr><tr><td align="right">2.5 </td><td><a href="output-syntax.html" class="tocviewlink" data-pltdoc="x">Output Printing Styles</a></td></tr></table></div></div></div></div><div class="maincolumn"><div class="main"><div class="navsettop"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.1", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.1");">top</a></span><span class="navright"> <a href="legacy.html" title="backward to "2.2 Legacy Languages"" data-pltdoc="x">← prev</a> <a href="languages.html" title="up to "2 Languages"" data-pltdoc="x">up</a> <a href="experimental-langs.html" title="forward to "2.4 Other Experimental Languages"" data-pltdoc="x">next →</a></span> </div><h4 x-source-module="(lib "scribblings/drracket/drracket.scrbl")" x-part-tag=""htdp-langs"">2.3<tt> </tt><a name="(part._htdp-langs)"></a><span style="font-style: italic">How to Design Programs</span> Teaching Languages</h4><p>Five of DrRacket’s languages are specifically designed for teaching:</p><ul><li><p>The <a name="(idx._(gentag._43._(lib._scribblings/drracket/drracket..scrbl)))"></a><span class="ssansserif">Beginning Student</span> language is a small
version of Racket that is tailored for beginning computer
science students.</p></li><li><p>The <a name="(idx._(gentag._44._(lib._scribblings/drracket/drracket..scrbl)))"></a><span class="ssansserif">Beginning Student with List
Abbreviations</span> languages is an extension to Beginning Student
that prints lists with <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list</a></span> instead of <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._cons%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cons</a></span>,
and accepts <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=quasiquote.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fletstx-scheme..rkt%2529._quasiquote%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">quasiquote</a></span>d input.</p></li><li><p>The <a name="(idx._(gentag._45._(lib._scribblings/drracket/drracket..scrbl)))"></a><span class="ssansserif">Intermediate Student</span> language adds
local bindings and higher-order functions.</p></li><li><p>The <a name="(idx._(gentag._46._(lib._scribblings/drracket/drracket..scrbl)))"></a><span class="ssansserif">Intermediate Student with Lambda</span>
language adds anonymous functions.</p></li><li><p>The <a name="(idx._(gentag._47._(lib._scribblings/drracket/drracket..scrbl)))"></a><span class="ssansserif">Advanced Student</span> language adds mutable
state.</p></li></ul><p>The teaching languages are different from conventional Racket in a number
of ways:</p><ul><li><p><span style="font-style: italic">Case-sensitive identifiers and symbols</span> —<wbr></wbr> In a
case-sensitive language, the variable names <span class="RktSym">x</span> and
<span class="RktSym">X</span> are distinct, and the symbols <span class="RktVal">'</span><span class="RktVal">x</span> and
<span class="RktVal">'</span><span class="RktVal">X</span> are also distinct. In a case-insensitive language,
<span class="RktSym">x</span> and <span class="RktSym">X</span> are equivalent and <span class="RktVal">'</span><span class="RktVal">x</span> and
<span class="RktVal">'</span><span class="RktVal">X</span> represent the same value. The teaching languages
are case-sensitive by default, and other languages are usually
case-insensitive. Case-sensitivity can be adjusted through the
detail section of the language-selection dialog.</p></li><li><p><span style="font-style: italic">All numbers are exact unless <span class="RktMeta">#i</span> is
specified</span> —<wbr></wbr> In the <span class="ssansserif">Beginning Student</span> through
<span class="ssansserif">Intermediate Student with Lambda languages</span>, numbers
containing a decimal point are interpreted as exact
numbers. This interpretation allows students to use familiar
decimal notation without inadvertently triggering inexact
arithmetic. Exact numbers with decimal representations are also
printed in decimal. Inexact inputs and results are explicitly
marked with <span class="RktMeta">#i</span>.</p></li><li><p><span style="font-style: italic">Procedures must take at least one argument</span> —<wbr></wbr> In the
<span class="ssansserif">Beginning Student</span> through <span class="ssansserif">Intermediate
Student</span> 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 syntactic
mistakes.</p></li><li><p><span style="font-style: italic">Identifier required at function call position</span> —<wbr></wbr> In
the <span class="ssansserif">Beginning Student</span> through <span class="ssansserif">Intermediate
Student</span> languages, procedure calls must be of the form
<span class="RktPn">(</span><span class="RktVar">identifier</span><span class="stt"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=stx-patterns.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fstxcase-scheme..rkt%2529._......%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">...</a></span><span class="RktPn">)</span>. This restriction helps detect
confusing misuses of parentheses, such as <span class="RktPn">(</span><span class="RktVal">1</span><span class="RktPn">)</span> or
<span class="RktPn">(</span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=generic-numbers.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._%252B%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">+</a></span><span class="stt"> </span><span class="RktVal">3</span><span class="stt"> </span><span class="RktVal">4</span><span class="RktPn">)</span><span class="RktPn">)</span>, which is a common mistake among beginners
who are used to the optional parentheses of algebra.</p></li><li><p><span style="font-style: italic">Top-level required at function call position</span> —<wbr></wbr> In
the <span class="ssansserif">Beginning Student</span> languages, procedure calls must
be of the form <span class="RktPn">(</span><span class="RktVar">top-level-identifier</span><span class="stt"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=stx-patterns.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fstxcase-scheme..rkt%2529._......%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">...</a></span><span class="RktPn">)</span>, and the
number of actual arguments must match the number of formal
arguments if <span class="RktVar">top-level-identifier</span> is
<span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span>d. This restriction helps detect confusing
misuses of parentheses, such as <span class="RktPn">(</span><span class="RktSym">x</span><span class="RktPn">)</span> where <span class="RktSym">x</span>
is a function argument. DrRacket can detect such mistakes
syntactically because Beginning Student does not support
higher-order procedures.</p></li><li><p><span style="font-style: italic">Primitive and defined functions allowed only in
function call position</span> —<wbr></wbr> In <span class="ssansserif">Beginning Student</span>
languages, the name of a primitive operator or of a defined
function can be used only after the open-parenthesis of a
function call (except where teachpack extensions allow
otherwise, as in the <span class="RktSym">convert-gui</span> teachpack). Incorrect
uses of primitives trigger a syntax error. Incorrect uses of
defined names trigger a run-time error. DrRacket can detect
such mistakes because Beginning Student does not support
higher-order procedures.</p></li><li><p><span style="font-style: italic"><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span> allowed only in definitions</span> —<wbr></wbr> In
the Beginning Student through Intermediate Student languages,
<span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span> (or <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._case-lambda%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">case-lambda</a></span>) may appear only in a
definition, and only as the value of the defined variable.</p></li><li><p><span style="font-style: italic">Free variables are not allowed</span> —<wbr></wbr> In the
<span class="ssansserif">Beginning Student</span> through <span class="ssansserif">Advanced Student</span>
languages, every variable referenced in the definitions window
must be defined, pre-defined, or the name of a local function
argument.</p></li><li><p><span style="font-style: italic"><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=quote.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._quote%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">quote</a></span> works only on symbols,
<span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=quasiquote.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fletstx-scheme..rkt%2529._quasiquote%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">quasiquote</a></span> disallowed</span> —<wbr></wbr> In the <span class="ssansserif">Beginning
Student</span> language, <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=quote.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._quote%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">quote</a></span> and <span class="RktVal">’</span> can
specify only symbols. This restriction avoids the need to
explain to beginners why <span class="RktVal">1</span> and <span class="RktVal">'</span><span class="RktVal">1</span> are
equivalent in standard Racket. In addition,
<span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=quasiquote.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fletstx-scheme..rkt%2529._quasiquote%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">quasiquote</a></span>, <span class="RktInBG"><span class="hspace"></span><span class="RktIn">`</span><span class="hspace"></span></span>, <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=quasiquote.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._unquote%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">unquote</a></span>,
<span class="RktInBG"><span class="hspace"></span><span class="RktIn">,</span><span class="hspace"></span></span>, <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=quasiquote.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._unquote-splicing%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">unquote-splicing</a></span>, and <span class="RktInBG"><span class="hspace"></span><span class="RktIn">,@</span><span class="hspace"></span></span> are
disallowed.</p></li><li><p><span style="font-style: italic">Unmatched <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=if.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fletstx-scheme..rkt%2529._cond%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">cond</a></span>/<span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=case.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fmore-scheme..rkt%2529._case%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">case</a></span> is an error</span> —<wbr></wbr>
In the <span class="ssansserif">Beginning Student</span> through <span class="ssansserif">Advanced
Student</span> languages, falling through a <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=if.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fletstx-scheme..rkt%2529._cond%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">cond</a></span> or
<span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=case.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fmore-scheme..rkt%2529._case%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">case</a></span> expression without matching a clause signals a
run-time error. This convention helps detect syntactic and
logical errors in programs.</p></li><li><p><span style="font-style: italic">Conditional values must be <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528lib._racket%252Fbool..rkt%2529._true%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">true</a></span> or
<span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528lib._racket%252Fbool..rkt%2529._false%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false</a></span></span> —<wbr></wbr> In the <span class="ssansserif">Beginning Student</span> through
<span class="ssansserif">Advanced Student</span> languages, an expression whose value
is treated as a boolean must return an actual boolean,
<span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528lib._racket%252Fbool..rkt%2529._true%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">true</a></span> or <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528lib._racket%252Fbool..rkt%2529._false%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false</a></span>. This restriction, which
applies to <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=if.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._if%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">if</a></span>, <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=if.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fletstx-scheme..rkt%2529._cond%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">cond</a></span>, <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=if.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fletstx-scheme..rkt%2529._and%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">and</a></span>,
<span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=if.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fletstx-scheme..rkt%2529._or%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">or</a></span>, <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528form._%2528%2528lib._racket%252Fbool..rkt%2529._nand%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">nand</a></span>, and <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528form._%2528%2528lib._racket%252Fbool..rkt%2529._nor%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">nor</a></span> expressions, helps
detect errors where a boolean function application is omitted.</p></li><li><p><span style="font-style: italic"><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=generic-numbers.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._%252B%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">+</a></span>, <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=generic-numbers.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._%252A%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">*</a></span>, and <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=generic-numbers.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._%252F%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">/</a></span> take at least
two arguments</span> —<wbr></wbr> In the <span class="ssansserif">Beginning Student</span> through
<span class="ssansserif">Advanced Student</span> languages, mathematical operators
that are infix in algebra notation require at least two
arguments in DrRacket. This restriction helps detect missing
arguments to an operator.</p></li><li><p><span style="font-style: italic"><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=if.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fletstx-scheme..rkt%2529._and%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">and</a></span>, <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=if.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fletstx-scheme..rkt%2529._or%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">or</a></span>, <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528form._%2528%2528lib._racket%252Fbool..rkt%2529._nand%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">nand</a></span>, and
<span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528form._%2528%2528lib._racket%252Fbool..rkt%2529._nor%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">nor</a></span> require at least 2 expressions</span> —<wbr></wbr> In the
<span class="ssansserif">Beginning Student</span> through <span class="ssansserif">Advanced Student</span>
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.</p></li><li><p><span style="font-style: italic"><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=set_.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._set%2521%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">set!</a></span> disallowed on arguments</span> —<wbr></wbr> In the
<span class="ssansserif">Advanced Student</span> language, <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=set_.html%23%2528form._%2528%2528quote._%7E23%7E25kernel%2529._set%2521%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">set!</a></span> cannot be
used to mutate variables bound by <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span>. This
restriction ensures that the substitution model of function
application is consistent with DrRacket’s evaluation.</p></li><li><p><span style="font-style: italic">Improper lists disallowed</span> —<wbr></wbr> A <span style="font-style: italic">proper list</span>
is either an empty list or a list created by <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._cons%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cons</a></span>ing
onto a proper list. In the <span class="ssansserif">Beginning Student</span> through
<span class="ssansserif">Advanced Student</span> languages, <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._cons%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cons</a></span> constructs
only <span style="font-style: italic">proper lists</span>, signaling 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.</p></li><li><p><span style="font-style: italic">Dot is disallowed</span> —<wbr></wbr> In the <span class="ssansserif">Beginning
Student</span> through <span class="ssansserif">Advanced Student</span> languages, a
delimited period <span class="RktInBG"><span class="hspace"></span><span class="RktIn">.</span><span class="hspace"></span></span> is disallowed, (e.g., as an
improper-list constructor in a quoted form, or for defining
multi-arity procedures).</p></li><li><p><span style="font-style: italic">Syntactic form names disallowed as variable names</span> —<wbr></wbr>
In the <span class="ssansserif">Beginning Student</span> through <span class="ssansserif">Advanced
Student</span> languages, all syntactic form names are keywords that
cannot be used as variable names.</p></li><li><p><span style="font-style: italic">Re-definitions are disallowed</span> —<wbr></wbr> In the
<span class="ssansserif">Beginning Student</span> through <span class="ssansserif">Advanced Student</span>
languages, top-level names can never be re-defined.</p></li><li><p><span style="font-style: italic">Function definitions are allowed only in the
definitions window</span> —<wbr></wbr> In the <span class="ssansserif">Beginning Student</span>
languages, function definitions are not allowed in the
interactions window.</p></li></ul><p>The teaching languages also deviate from traditional Racket in
printing values. Different printing formats can be selected for any
language through the detail section of language-selection dialog.</p><ul><li><p><span style="font-style: italic">Constructor-style output</span> —<wbr></wbr> See
<a href="output-syntax.html" data-pltdoc="x">Output Printing Styles</a>.</p></li><li><p><span style="font-style: italic">Quasiquote-style output</span> —<wbr></wbr> See
<a href="output-syntax.html" data-pltdoc="x">Output Printing Styles</a>.</p></li><li><p><span style="font-style: italic">Rational number printing</span> – In the teaching
languages, all numbers that have a finite decimal expansion are
printed in decimal form. For those numbers that do not have a
finite decimal expansion (such as <span class="RktVal">4/3</span>) DrRacket offers a
choice. It either prints them as mixed fractions or as repeating
decimals, where the repeating portion of the decimal expansion is
shown with an overbar. In addition, DrRacket only shows the first
25 digits of the number’s decimal expansion. If there are more
digits, the number appears with an ellipses at the end. Click the
ellipses to see the next 25 digits of the expansion.</p><p>This setting controls only the initial display of a number.
Right-clicking or Control-clicking (Mac OS X) on the number lets
you change from the fraction representation to the decimal
representation.</p></li><li><p><span style="font-style: italic"><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Writing.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._write%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">write</a></span> output</span> —<wbr></wbr> Prints values with
<span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Writing.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._write%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">write</a></span>.</p></li><li><p><span style="font-style: italic">Show sharing in values</span> —<wbr></wbr> Prints interaction results
using the <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=shared.html%23%2528form._%2528%2528lib._racket%252Fshared..rkt%2529._shared%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">shared</a></span> syntax, which exposes shared
structure within a value. For example, the list created by
<span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=let.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fletstx-scheme..rkt%2529._let%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">let</a></span><span class="stt"> </span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">lt</span><span class="stt"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list</a></span><span class="stt"> </span><span class="RktVal">0</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="stt"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list</a></span><span class="stt"> </span><span class="RktSym">lt</span><span class="stt"> </span><span class="RktSym">lt</span><span class="RktPn">)</span><span class="RktPn">)</span> prints as</p><blockquote class="SCodeFlow"><p><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=shared.html%23%2528form._%2528%2528lib._racket%252Fshared..rkt%2529._shared%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">shared</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">(</span><span class="RktSym"><span class="nobreak">-1</span>-</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list</a></span><span class="hspace"> </span><span class="RktVal">0</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list</a></span><span class="hspace"> </span><span class="RktSym"><span class="nobreak">-1</span>-</span><span class="hspace"> </span><span class="RktSym"><span class="nobreak">-1</span>-</span><span class="RktPn">)</span><span class="RktPn">)</span></p></blockquote><p>instead of</p><blockquote class="SCodeFlow"><p><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list</a></span><span class="hspace"> </span><span class="RktVal">0</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list</a></span><span class="hspace"> </span><span class="RktVal">0</span><span class="RktPn">)</span><span class="RktPn">)</span></p></blockquote></li></ul><p>A program in the teaching languages should be tested using the check forms —<wbr></wbr>
<span class="RktPn">(</span><span class="RktSym">check-expect</span><span class="stt"> </span><span class="RktSym">value</span><span class="stt"> </span><span class="RktSym">value</span><span class="RktPn">)</span>, <span class="RktPn">(</span><span class="RktSym">check-within</span><span class="stt"> </span><span class="RktSym">value</span><span class="stt"> </span><span class="RktSym">value</span><span class="stt"> </span><span class="RktSym">value</span><span class="RktPn">)</span>, or
<span class="RktPn">(</span><span class="RktSym">check-error</span><span class="stt"> </span><span class="RktSym">value</span><span class="stt"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string</a></span><span class="RktPn">)</span>. Tests are evaluated when running the program:
when there are no tests, a warning appears in the interactions window;
when all tests succeed, an acknowledgement appears in the interactions window;
otherwise, a testing window appears to report the results. See <a href="Menus.html#%28part._menu~3aview%29" data-pltdoc="x"><span class="ssansserif">View</span></a>
for details on configuring the report behavior.</p><p>Tests can be disabled if necessary, see <a href="Menus.html#%28part._menu~3aracket%29" data-pltdoc="x"><span class="ssansserif">Racket</span></a> for details.</p><p>One final difference between these teaching languages and other languages is the way
they save files. That is, when DrRacket saves a file and the current language
is one of these five teaching languages, it inserts three lines of metadata that
record the precise language (including any options set) and the teachpacks.
This has two benefits: opening the file later restores the settings and the metadata
is formulated in such a way as to be executable code so running <span class="stt">racket</span> or
<span class="stt">gracket</span> on the file in a shell will run the program in the appropriate language.</p><p>This meta data always consists of exactly three lines, and so can be stripped out
by three calls to <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Byte_and_String_Input.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._read-line%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">read-line</a></span>.</p><div class="navsetbottom"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.1", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.1");">top</a></span><span class="navright"> <a href="legacy.html" title="backward to "2.2 Legacy Languages"" data-pltdoc="x">← prev</a> <a href="languages.html" title="up to "2 Languages"" data-pltdoc="x">up</a> <a href="experimental-langs.html" title="forward to "2.4 Other Experimental Languages"" data-pltdoc="x">next →</a></span> </div></div></div><div id="contextindicator"> </div></body></html>
|