This file is indexed.

/usr/share/doc/racket/guide/intro.html is in racket-doc 6.7-3.

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
<!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>1&nbsp;Welcome to Racket</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="../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="../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,&quot;tocview_0&quot;);">&#9660;</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x"><span style="font-weight: bold">The Racket Guide</span></a></td></tr></table></div><div class="tocviewsublisttop" style="display: block;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1&nbsp;</td><td><a href="" class="tocviewselflink" data-pltdoc="x">Welcome to Racket</a></td></tr><tr><td align="right">2&nbsp;</td><td><a href="to-scheme.html" class="tocviewlink" data-pltdoc="x">Racket Essentials</a></td></tr><tr><td align="right">3&nbsp;</td><td><a href="datatypes.html" class="tocviewlink" data-pltdoc="x">Built-<wbr></wbr>In Datatypes</a></td></tr><tr><td align="right">4&nbsp;</td><td><a href="scheme-forms.html" class="tocviewlink" data-pltdoc="x">Expressions and Definitions</a></td></tr><tr><td align="right">5&nbsp;</td><td><a href="define-struct.html" class="tocviewlink" data-pltdoc="x">Programmer-<wbr></wbr>Defined Datatypes</a></td></tr><tr><td align="right">6&nbsp;</td><td><a href="modules.html" class="tocviewlink" data-pltdoc="x">Modules</a></td></tr><tr><td align="right">7&nbsp;</td><td><a href="contracts.html" class="tocviewlink" data-pltdoc="x">Contracts</a></td></tr><tr><td align="right">8&nbsp;</td><td><a href="i_o.html" class="tocviewlink" data-pltdoc="x">Input and Output</a></td></tr><tr><td align="right">9&nbsp;</td><td><a href="regexp.html" class="tocviewlink" data-pltdoc="x">Regular Expressions</a></td></tr><tr><td align="right">10&nbsp;</td><td><a href="control.html" class="tocviewlink" data-pltdoc="x">Exceptions and Control</a></td></tr><tr><td align="right">11&nbsp;</td><td><a href="for.html" class="tocviewlink" data-pltdoc="x">Iterations and Comprehensions</a></td></tr><tr><td align="right">12&nbsp;</td><td><a href="match.html" class="tocviewlink" data-pltdoc="x">Pattern Matching</a></td></tr><tr><td align="right">13&nbsp;</td><td><a href="classes.html" class="tocviewlink" data-pltdoc="x">Classes and Objects</a></td></tr><tr><td align="right">14&nbsp;</td><td><a href="units.html" class="tocviewlink" data-pltdoc="x">Units</a></td></tr><tr><td align="right">15&nbsp;</td><td><a href="reflection.html" class="tocviewlink" data-pltdoc="x">Reflection and Dynamic Evaluation</a></td></tr><tr><td align="right">16&nbsp;</td><td><a href="macros.html" class="tocviewlink" data-pltdoc="x">Macros</a></td></tr><tr><td align="right">17&nbsp;</td><td><a href="languages.html" class="tocviewlink" data-pltdoc="x">Creating Languages</a></td></tr><tr><td align="right">18&nbsp;</td><td><a href="concurrency.html" class="tocviewlink" data-pltdoc="x">Concurrency and Synchronization</a></td></tr><tr><td align="right">19&nbsp;</td><td><a href="performance.html" class="tocviewlink" data-pltdoc="x">Performance</a></td></tr><tr><td align="right">20&nbsp;</td><td><a href="parallelism.html" class="tocviewlink" data-pltdoc="x">Parallelism</a></td></tr><tr><td align="right">21&nbsp;</td><td><a href="running.html" class="tocviewlink" data-pltdoc="x">Running and Creating Executables</a></td></tr><tr><td align="right">22&nbsp;</td><td><a href="More_Libraries.html" class="tocviewlink" data-pltdoc="x">More Libraries</a></td></tr><tr><td align="right">23&nbsp;</td><td><a href="dialects.html" class="tocviewlink" data-pltdoc="x">Dialects of Racket and Scheme</a></td></tr><tr><td align="right">24&nbsp;</td><td><a href="other-editors.html" class="tocviewlink" data-pltdoc="x">Command-<wbr></wbr>Line Tools and Your Editor of Choice</a></td></tr><tr><td align="right"></td><td><a href="doc-bibliography.html" class="tocviewlink" data-pltdoc="x">Bibliography</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,&quot;tocview_1&quot;);">&#9658;</a></td><td>1&nbsp;</td><td><a href="" class="tocviewselflink" data-pltdoc="x">Welcome to Racket</a></td></tr></table><div class="tocviewsublistbottom" style="display: none;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">1.1&nbsp;</td><td><a href="#%28part._.Interacting_with_.Racket%29" class="tocviewlink" data-pltdoc="x">Interacting with Racket</a></td></tr><tr><td align="right">1.2&nbsp;</td><td><a href="#%28part._.Definitions_and_.Interactions%29" class="tocviewlink" data-pltdoc="x">Definitions and Interactions</a></td></tr><tr><td align="right">1.3&nbsp;</td><td><a href="#%28part._.Creating_.Executables%29" class="tocviewlink" data-pltdoc="x">Creating Executables</a></td></tr><tr><td align="right">1.4&nbsp;</td><td><a href="#%28part._use-module%29" class="tocviewlink" data-pltdoc="x">A Note to Readers with Lisp/<span class="mywbr"> &nbsp;</span>Scheme Experience</a></td></tr></table></div></div></div><div class="tocsub"><div class="tocsubtitle">On this page:</div><table class="tocsublist" cellspacing="0"><tr><td><span class="tocsublinknumber">1.1<tt>&nbsp;</tt></span><a href="#%28part._.Interacting_with_.Racket%29" class="tocsubseclink" data-pltdoc="x">Interacting with Racket</a></td></tr><tr><td><span class="tocsublinknumber">1.2<tt>&nbsp;</tt></span><a href="#%28part._.Definitions_and_.Interactions%29" class="tocsubseclink" data-pltdoc="x">Definitions and Interactions</a></td></tr><tr><td><span class="tocsublinknumber">1.3<tt>&nbsp;</tt></span><a href="#%28part._.Creating_.Executables%29" class="tocsubseclink" data-pltdoc="x">Creating Executables</a></td></tr><tr><td><span class="tocsublinknumber">1.4<tt>&nbsp;</tt></span><a href="#%28part._use-module%29" class="tocsubseclink" data-pltdoc="x">A Note to Readers with Lisp/<span class="mywbr"> &nbsp;</span>Scheme Experience</a></td></tr></table></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, &quot;6.7&quot;, &quot;../&quot;);" onfocus="this.style.color=&quot;black&quot;; this.style.textAlign=&quot;left&quot;; if (this.value == &quot;...search manuals...&quot;) this.value=&quot;&quot;;" onblur="if (this.value.match(/^ *$/)) { this.style.color=&quot;#888&quot;; this.style.textAlign=&quot;center&quot;; this.value=&quot;...search manuals...&quot;; }"/></form>&nbsp;&nbsp;<a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot(&quot;6.7&quot;);">top</a></span><span class="navright">&nbsp;&nbsp;<a href="index.html" title="backward to &quot;The Racket Guide&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="index.html" title="up to &quot;The Racket Guide&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="to-scheme.html" title="forward to &quot;2 Racket Essentials&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div><h3 x-source-module="(lib &quot;scribblings/guide/guide.scrbl&quot;)" x-source-pkg="racket-doc" x-part-tag="&quot;intro&quot;">1<tt>&nbsp;</tt><a name="(part._intro)"></a>Welcome to Racket</h3><p>Depending on how you look at it, <span style="font-weight: bold">Racket</span> is</p><ul><li><p>a <span style="font-style: italic">programming language</span>&#8212;<wbr></wbr>a dialect of Lisp and a
descendant of Scheme;</p><blockquote class="refpara"><blockquote class="refcolumn"><blockquote class="refcontent"><p>See <a href="dialects.html" data-pltdoc="x">Dialects of Racket and Scheme</a> for more information on
other dialects of Lisp and how they relate to Racket.</p></blockquote></blockquote></blockquote></li><li><p>a <span style="font-style: italic">family</span> of programming languages&#8212;<wbr></wbr>variants of
Racket, and more; or</p></li><li><p>a set of <span style="font-style: italic">tools</span>&#8212;<wbr></wbr>for using a family of programming languages.</p></li></ul><p>Where there is no room for confusion, we use simply <span style="font-style: italic">Racket</span>.</p><p>Racket&rsquo;s main tools are</p><ul><li><p><span style="font-weight: bold"><span class="stt">racket</span></span>, the core compiler, interpreter, and run-time system;</p></li><li><p><span style="font-weight: bold">DrRacket</span>, the programming environment; and</p></li><li><p><span style="font-weight: bold"><span class="stt">raco</span></span>, a command-line tool for executing <span style="font-weight: bold">Ra</span>cket
<span style="font-weight: bold">co</span>mmands that install packages, build libraries, and more.</p></li></ul><p>Most likely, you&rsquo;ll want to explore the Racket language using
DrRacket, especially at the beginning. If you prefer, you can also
work with the command-line <span class="stt">racket</span> interpreter and your favorite
text editor; see also <a href="other-editors.html" data-pltdoc="x">Command-Line Tools and Your Editor of Choice</a>. The rest of this guide
presents the language mostly independent of your choice of editor.</p><p>If you&rsquo;re using DrRacket, you&rsquo;ll need to choose the proper language,
because DrRacket accommodates many different variants of Racket, as
well as other languages. Assuming that you&rsquo;ve never used DrRacket
before, start it up, type the line</p><blockquote class="SCodeFlow"><p><a href="Module_Syntax.html#%28part._hash-lang%29" class="RktModLink" data-pltdoc="x"><span class="RktMod">#lang</span></a><span class="hspace">&nbsp;</span><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=index.html&amp;version=6.7" class="RktModLink Sq" data-pltdoc="x"><span class="RktSym">racket</span></a></p></blockquote><p>in DrRacket&rsquo;s top text area, and then click the <span class="ssansserif">Run</span> button
that&rsquo;s above the text area. DrRacket then understands that you mean to
work in the normal variant of Racket (as opposed to the smaller
<a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=index.html&amp;version=6.7" class="RktModLink Sq" data-pltdoc="x"><span class="RktSym">racket/base</span></a> or many other possibilities).</p><blockquote class="refpara"><blockquote class="refcolumn"><blockquote class="refcontent"><p><a href="more-hash-lang.html" data-pltdoc="x">More Rackets</a> describes some of the other
possibilities.</p></blockquote></blockquote></blockquote><p>If you&rsquo;ve used DrRacket before with something other than a program
that starts <a href="Module_Syntax.html#%28part._hash-lang%29" class="RktModLink" data-pltdoc="x"><span class="RktMod">#lang</span></a>, DrRacket will remember the last language
that you used, instead of inferring the language from the <a href="Module_Syntax.html#%28part._hash-lang%29" class="RktModLink" data-pltdoc="x"><span class="RktMod">#lang</span></a>
line. In that case, use the <span class="ssansserif">Language|Choose Language...</span>
menu item.  In the dialog that appears, select the first item, which
tells DrRacket to use the language that is declared in a source
program via <a href="Module_Syntax.html#%28part._hash-lang%29" class="RktModLink" data-pltdoc="x"><span class="RktMod">#lang</span></a>. Put the <a href="Module_Syntax.html#%28part._hash-lang%29" class="RktModLink" data-pltdoc="x"><span class="RktMod">#lang</span></a> line above in the top
text area, still.</p><h4 x-source-module="(lib &quot;scribblings/guide/guide.scrbl&quot;)" x-source-pkg="racket-doc" x-part-tag="&quot;Interacting_with_Racket&quot;">1.1<tt>&nbsp;</tt><a name="(part._.Interacting_with_.Racket)"></a>Interacting with Racket</h4><p>DrRacket&rsquo;s bottom text area and the <span class="stt">racket</span> command-line program
(when started with no options) both act as a kind of calculator. You
type a Racket expression, hit the Return key, and the answer is
printed. In the terminology of Racket, this kind of calculator is
called a <span style="font-style: italic">read-eval-print loop</span> or <a name="(tech._repl)"></a><span style="font-style: italic">REPL</span>.</p><p>A number by itself is an expression, and the answer is just the
number:</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktVal">5</span></td></tr><tr><td><p><span class="RktRes">5</span></p></td></tr></table></blockquote><p>A string is also an expression that evaluates to itself. A string is
written with double quotes at the start and end of the string:</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktVal">"Hello, world!"</span></td></tr><tr><td><p><span class="RktRes">"Hello, world!"</span></p></td></tr></table></blockquote><p>Racket uses parentheses to wrap larger expressions&#8212;<wbr></wbr>almost any kind
of expression, other than simple constants. For example, a function
call is written: open parenthesis, function name, argument
expression, and closing parenthesis. The following expression calls
the built-in function <span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._substring%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">substring</a></span> with the arguments
<span class="RktVal">"the boy out of the country"</span>, <span class="RktVal">4</span>, and <span class="RktVal">7</span>:</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._substring%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">substring</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"the boy out of the country"</span><span class="hspace">&nbsp;</span><span class="RktVal">4</span><span class="hspace">&nbsp;</span><span class="RktVal">7</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">"boy"</span></p></td></tr></table></blockquote><h4 x-source-module="(lib &quot;scribblings/guide/guide.scrbl&quot;)" x-source-pkg="racket-doc" x-part-tag="&quot;Definitions_and_Interactions&quot;">1.2<tt>&nbsp;</tt><a name="(part._.Definitions_and_.Interactions)"></a>Definitions and Interactions</h4><p>You can define your own functions that work like <span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._substring%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">substring</a></span> by
using the <span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&amp;version=6.7" class="RktStxLink Sq" data-pltdoc="x">define</a></span> form, like this:</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&amp;version=6.7" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">extract</span><span class="hspace">&nbsp;</span><span class="RktSym">str</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._substring%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">substring</a></span><span class="hspace">&nbsp;</span><span class="RktSym">str</span><span class="hspace">&nbsp;</span><span class="RktVal">4</span><span class="hspace">&nbsp;</span><span class="RktVal">7</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><p>&nbsp;</p></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">extract</span><span class="hspace">&nbsp;</span><span class="RktVal">"the boy out of the country"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">"boy"</span></p></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">extract</span><span class="hspace">&nbsp;</span><span class="RktVal">"the country out of the boy"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">"cou"</span></p></td></tr></table></td></tr></table></blockquote><p>Although you can evaluate the <span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&amp;version=6.7" class="RktStxLink Sq" data-pltdoc="x">define</a></span> form in the <a href="#%28tech._repl%29" class="techoutside" data-pltdoc="x"><span class="techinside">REPL</span></a>,
definitions are normally a part of a program that you want to keep and
use later. So, in DrRacket, you&rsquo;d normally put the definition in the
top text area&#8212;<wbr></wbr>called the <a name="(tech._definitions._area)"></a><span style="font-style: italic">definitions area</span>&#8212;<wbr></wbr>along with the
<a href="Module_Syntax.html#%28part._hash-lang%29" class="RktModLink" data-pltdoc="x"><span class="RktMod">#lang</span></a> prefix:</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><a href="Module_Syntax.html#%28part._hash-lang%29" class="RktModLink" data-pltdoc="x"><span class="RktMod">#lang</span></a><span class="hspace">&nbsp;</span><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=index.html&amp;version=6.7" class="RktModLink Sq" data-pltdoc="x"><span class="RktSym">racket</span></a></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&amp;version=6.7" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">extract</span><span class="hspace">&nbsp;</span><span class="RktSym">str</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._substring%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">substring</a></span><span class="hspace">&nbsp;</span><span class="RktSym">str</span><span class="hspace">&nbsp;</span><span class="RktVal">4</span><span class="hspace">&nbsp;</span><span class="RktVal">7</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>If calling <span class="RktPn">(</span><span class="RktSym">extract</span><span class="stt"> </span><span class="RktVal">"the boy"</span><span class="RktPn">)</span> is part of the main action of
your program, that would go in the <a href="#%28tech._definitions._area%29" class="techoutside" data-pltdoc="x"><span class="techinside">definitions area</span></a>, too. But
if it was just an example expression that you were using to explore
<span class="RktSym">extract</span>, then you&rsquo;d more likely leave the <a href="#%28tech._definitions._area%29" class="techoutside" data-pltdoc="x"><span class="techinside">definitions
area</span></a> as above, click <span class="ssansserif">Run</span>, and then evaluate
<span class="RktPn">(</span><span class="RktSym">extract</span><span class="stt"> </span><span class="RktVal">"the boy"</span><span class="RktPn">)</span> in the <a href="#%28tech._repl%29" class="techoutside" data-pltdoc="x"><span class="techinside">REPL</span></a>.</p><p>When using command-line <span class="stt">racket</span> instead of DrRacket, you&rsquo;d save
the above text in a file using your favorite editor. If you save it as
<span class="stt">"extract.rkt"</span>, then after starting <span class="stt">racket</span> in the same
directory, you&rsquo;d evaluate the following sequence:</p><blockquote class="refpara"><blockquote class="refcolumn"><blockquote class="refcontent"><p>If you use <a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=xrepl&amp;rel=index.html&amp;version=6.7" class="RktModLink Sq" data-pltdoc="x"><span class="RktSym">xrepl</span></a>, you can use
<a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=xrepl&amp;rel=index.html%23%2528xrepl._enter%2529&amp;version=6.7" class="plainlink Sq" data-pltdoc="x"><span class="RktInBG"><span class="hspace"></span><span class="RktIn">,enter extract.rkt</span><span class="hspace"></span></span></a>.</p></blockquote></blockquote></blockquote><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=interactive.html%23%2528form._%2528%2528lib._racket%252Fenter..rkt%2529._enter%2521%2529%2529&amp;version=6.7" class="RktStxLink Sq" data-pltdoc="x">enter!</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"extract.rkt"</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">extract</span><span class="hspace">&nbsp;</span><span class="RktVal">"the gal out of the city"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">"gal"</span></p></td></tr></table></blockquote><p>The <span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=interactive.html%23%2528form._%2528%2528lib._racket%252Fenter..rkt%2529._enter%2521%2529%2529&amp;version=6.7" class="RktStxLink Sq" data-pltdoc="x">enter!</a></span> form both loads the code and switches the
evaluation context to the inside of the module, just like DrRacket&rsquo;s
<span class="ssansserif">Run</span> button.</p><h4 x-source-module="(lib &quot;scribblings/guide/guide.scrbl&quot;)" x-source-pkg="racket-doc" x-part-tag="&quot;Creating_Executables&quot;">1.3<tt>&nbsp;</tt><a name="(part._.Creating_.Executables)"></a>Creating Executables</h4><p>If your file (or <a href="#%28tech._definitions._area%29" class="techoutside" data-pltdoc="x"><span class="techinside">definitions area</span></a> in DrRacket) contains</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><a href="Module_Syntax.html#%28part._hash-lang%29" class="RktModLink" data-pltdoc="x"><span class="RktMod">#lang</span></a><span class="hspace">&nbsp;</span><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=index.html&amp;version=6.7" class="RktModLink Sq" data-pltdoc="x"><span class="RktSym">racket</span></a></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&amp;version=6.7" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">extract</span><span class="hspace">&nbsp;</span><span class="RktSym">str</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._substring%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">substring</a></span><span class="hspace">&nbsp;</span><span class="RktSym">str</span><span class="hspace">&nbsp;</span><span class="RktVal">4</span><span class="hspace">&nbsp;</span><span class="RktVal">7</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym">extract</span><span class="hspace">&nbsp;</span><span class="RktVal">"the cat out of the bag"</span><span class="RktPn">)</span></td></tr></table></blockquote><p>then it is a complete program that prints &ldquo;cat&rdquo; when run. You can
run the program within DrRacket or using <span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=interactive.html%23%2528form._%2528%2528lib._racket%252Fenter..rkt%2529._enter%2521%2529%2529&amp;version=6.7" class="RktStxLink Sq" data-pltdoc="x">enter!</a></span> in
<span class="stt">racket</span>, but if the program is saved in <span class="sroman">&#8249;<span style="font-style: italic">src-filename</span>&#8250;</span>,
you can also run it from a command line with</p><p><span class="hspace">&nbsp;&nbsp;</span><span class="stt">racket </span><span class="sroman">&#8249;<span style="font-style: italic">src-filename</span>&#8250;</span></p><p>To package the program as an executable, you have a few options:</p><ul><li><p>In DrRacket, you can select the <span class="ssansserif">Racket|Create
       Executable...</span> menu item.</p></li><li><p>From a command-line prompt, run <span class="stt">raco exe</span><span class="stt">
</span><span class="sroman">&#8249;<span style="font-style: italic">src-filename</span>&#8250;</span>, where <span class="sroman">&#8249;<span style="font-style: italic">src-filename</span>&#8250;</span> contains
the program. See <a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=raco&amp;rel=exe.html&amp;version=6.7" class="Sq" data-pltdoc="x"><span class="stt">raco exe</span>: Creating Stand-Alone Executables</a> for more information.</p></li><li><p>With Unix or Mac OS X, you can turn the program file into an
executable script by inserting the line</p><blockquote class="refpara"><blockquote class="refcolumn"><blockquote class="refcontent"><p>See <a href="scripts.html" data-pltdoc="x">Scripts</a> for more information on
script files.</p></blockquote></blockquote></blockquote><p><table cellspacing="0" cellpadding="0"><tr><td><p><span class="hspace">&nbsp;&nbsp;</span><span class="stt">#! /usr/bin/env racket</span></p></td></tr></table></p><p>at the very beginning of the file. Also, change the file
permissions to executable using <span class="stt">chmod +x</span><span class="stt">
</span><span class="sroman">&#8249;<span style="font-style: italic">filename</span>&#8250;</span> on the command line.</p><p>The script works as long as <span class="stt">racket</span> is in the user&rsquo;s
executable search path.  Alternately, use a full path to
<span class="stt">racket</span> after <span class="stt">#!</span>  (with a space between <span class="stt">#!</span>
and the path), in which case the user&rsquo;s executable search path
does not matter.</p></li></ul><h4 x-source-module="(lib &quot;scribblings/guide/guide.scrbl&quot;)" x-source-pkg="racket-doc" x-part-tag="&quot;use-module&quot;">1.4<tt>&nbsp;</tt><a name="(part._use-module)"></a>A Note to Readers with Lisp/Scheme Experience</h4><p>If you already know something about Scheme or Lisp, you might be
tempted to put just</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&amp;version=6.7" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace">&nbsp;</span><span class="RktPn">(</span><span class="RktSym">extract</span><span class="hspace">&nbsp;</span><span class="RktSym">str</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace">&nbsp;&nbsp;</span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._substring%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">substring</a></span><span class="hspace">&nbsp;</span><span class="RktSym">str</span><span class="hspace">&nbsp;</span><span class="RktVal">4</span><span class="hspace">&nbsp;</span><span class="RktVal">7</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>into <span class="stt">"extract.rktl"</span> and run <span class="stt">racket</span> with</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=eval.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._load%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">load</a></span><span class="hspace">&nbsp;</span><span class="RktVal">"extract.rktl"</span><span class="RktPn">)</span></td></tr><tr><td><span class="stt">&gt; </span><span class="RktPn">(</span><span class="RktSym">extract</span><span class="hspace">&nbsp;</span><span class="RktVal">"the dog out"</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">"dog"</span></p></td></tr></table></blockquote><p>That will work, because <span class="stt">racket</span> is willing to imitate a
traditional Lisp environment, but we strongly recommend against using
<span class="RktSym"><a href="https://download.racket-lang.org/docs/6.7/html/local-redirect/index.html?doc=reference&amp;rel=eval.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._load%2529%2529&amp;version=6.7" class="RktValLink Sq" data-pltdoc="x">load</a></span> or writing programs outside of a module.</p><p>Writing definitions outside of a module leads to bad error messages,
bad performance, and awkward scripting to combine and run
programs. The problems are not specific to <span class="stt">racket</span>; they&rsquo;re
fundamental limitations of the traditional top-level environment,
which Scheme and Lisp implementations have historically fought with ad
hoc command-line flags, compiler directives, and build tools. The
module system is designed to avoid these problems, so start with
<a href="Module_Syntax.html#%28part._hash-lang%29" class="RktModLink" data-pltdoc="x"><span class="RktMod">#lang</span></a>, and you&rsquo;ll be happier with Racket in the long run.</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, &quot;6.7&quot;, &quot;../&quot;);" onfocus="this.style.color=&quot;black&quot;; this.style.textAlign=&quot;left&quot;; if (this.value == &quot;...search manuals...&quot;) this.value=&quot;&quot;;" onblur="if (this.value.match(/^ *$/)) { this.style.color=&quot;#888&quot;; this.style.textAlign=&quot;center&quot;; this.value=&quot;...search manuals...&quot;; }"/></form>&nbsp;&nbsp;<a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot(&quot;6.7&quot;);">top</a></span><span class="navright">&nbsp;&nbsp;<a href="index.html" title="backward to &quot;The Racket Guide&quot;" data-pltdoc="x">&larr; prev</a>&nbsp;&nbsp;<a href="index.html" title="up to &quot;The Racket Guide&quot;" data-pltdoc="x">up</a>&nbsp;&nbsp;<a href="to-scheme.html" title="forward to &quot;2 Racket Essentials&quot;" data-pltdoc="x">next &rarr;</a></span>&nbsp;</div></div></div><div id="contextindicator">&nbsp;</div></body></html>