1
0
mirror of synced 2026-01-19 17:57:52 +00:00
2021-01-22 15:26:25 -08:00

3 lines
11 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><title>02-TYPING-SHORTCUTS</title><link href="navigation.css" rel="stylesheet" type="text/css"/><link href="document.css" rel="stylesheet" type="text/css"/></head><body><p class="top_nav"><a href="part3.htm">&lt; Previous</a><span> | </span><a href="../Medley-Primer.html">Contents</a><span> | </span><a href="part5.htm">Next &gt;</a></p><h1 style="padding-top: 3pt;padding-left: 35pt;text-indent: 0pt;text-align: left;"><a name="bookmark3">2. TYPING SHORTCUTS</a></h1><p style="padding-left: 35pt;text-indent: 0pt;line-height: 6pt;text-align: left;"><span><img width="640" height="8" alt="image" src="Image_017.png"/></span></p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">Once you have logged in to Medley, you are in Lisp. The functions you type into the</p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">Executive Window will now execute, that is, perform the designated task. Lisp is case-</p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">sensitive; it often matters whether text is typed in upper- or lowercase letters. Use the Shift-Lock key on your keyboard to ensure that everything typed is in capital letters.</p><p style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">You must type all Lisp functions in parentheses. The Lisp interpreter will read from the left parenthesis to the closing right parenthesis to determine both the function you want to execute and the arguments to that function. Executing this function is called</p><p style="padding-left: 107pt;text-indent: 0pt;text-align: justify;">&quot;evaluation.&quot; When the function is evaluated, it returns a value, which is then printed in the Executive Window. This entire process is called the read-eval-print loop, and is how most Lisp interpreters, including the one for Lisp, run.</p><p style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">The prompt in is a number followed by a left-pointing arrow (see Figure 2.3). This number is the functions position on the History List—a list that stores your</p><p style="padding-left: 107pt;text-indent: 0pt;line-height: 107%;text-align: left;">interactions with the Lisp interpreter. Type the function <span class="s3">(PLUS 3 4) </span>, and notice the History List assigns to the function (the number immediately to the left of the arrow).</p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">Lisp reads in the function and its arguments, evaluates the function, and then prints the number 7.</p><p style="text-indent: 0pt;text-align: left;"><br/></p><h2 style="padding-left: 35pt;text-indent: 0pt;text-align: left;">Programmers Assistant </h2><p style="padding-top: 9pt;padding-left: 107pt;text-indent: 0pt;text-align: justify;">In addition to this read-eval-print loop, there is also a &quot;programmers assistant.&quot; It is the programmers assistant that prints the number as part of the prompt in the</p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">executive window, and uses these numbers to reference the function calls typed after them.</p><p style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">When you issue commands to the programmers assistant, you will not use parentheses as you do with ordinary functiion calls. You simply type the command, and some</p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">specification that indicates which item on the history list the command refers to. Some programmers assistant commands are <span class="s3">FIX</span>, <span class="s3">REDO</span>, and <span class="s3">UNDO</span>. They are explained in</p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;">detail below.</p><p style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: justify;">Programmers assistant commands are useful only at the Lisp top level, that is, when you are typing into the Executive Window. They do not work in user-defined functions.</p><p style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">As an example use of the programmers assistant, use <span class="s3">REDO </span>to redo your function call</p><p style="padding-left: 107pt;text-indent: 0pt;text-align: left;"><span class="s3">(PLUS 3 4)</span>. Type <span class="s9">REDO </span>at the prompt (programmers assistant commands can be</p><p style="padding-left: 106pt;text-indent: 0pt;text-align: left;">typed in either upper- or lowercase) , then specify the previous expression in one of the following ways:</p><p style="padding-top: 7pt;padding-left: 108pt;text-indent: 0pt;text-align: left;">• When you originally typed in the function you now want to refer to, there was a</p><p style="padding-left: 119pt;text-indent: 0pt;text-align: left;">History List number to the left of the arrow in the prompt. Type this number after the programmers assistant command. This is the method illustrated in Figure 2-1.</p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-left: 224pt;text-indent: 0pt;text-align: left;"><span><img width="228" height="116" alt="image" src="Image_018.gif"/></span></p><p style="padding-top: 7pt;padding-left: 137pt;text-indent: 0pt;text-align: left;">Figure 2-1. Using a Programmers Assistant Command to <span class="s3">REDO </span>a Function</p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-top: 4pt;padding-left: 119pt;text-indent: -10pt;text-align: justify;">• A negative number will specify the function call typed in that number of prompts dago. In this example, you would type in -1, the position immediately before the current position. This is shown in Figure 2-2.</p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-left: 225pt;text-indent: 0pt;text-align: left;"><span><img width="228" height="116" alt="image" src="Image_019.gif"/></span></p><p style="padding-top: 8pt;padding-left: 119pt;text-indent: 0pt;text-align: left;">Figure 2-2. Using a Negative Number after the Programmers Assistant Command</p><p style="padding-top: 7pt;padding-left: 119pt;text-indent: -10pt;text-align: left;">• You can also specify the function for the programmers assistant with one of the items that was in that function call. The programmers assistant will search</p><p style="padding-left: 119pt;text-indent: 0pt;text-align: left;">backwards in the History List, and use the first function it finds that includes that</p><p style="padding-left: 119pt;text-indent: 0pt;text-align: left;">item. For example, type <span class="s9">REDO PLUS </span>to have the functiion <span class="s3">(PLUS 3 4) </span>reevaluated.</p><p style="padding-top: 7pt;padding-left: 119pt;text-indent: -11pt;text-align: justify;">• If you type a programmers assistant cmmand without specifying a function (i.e., simply typing the command, following by a Return), the programmers assistant executes the command using the function entered at the previous prompt.</p><p style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">Figure 2-3 shows a few more examples of how to use the programmers assistant.</p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-left: 197pt;text-indent: 0pt;text-align: left;"><span><img width="305" height="286" alt="image" src="Image_020.gif"/></span></p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-left: 168pt;text-indent: 0pt;text-align: left;">Figure 2-3. Some Applications of the Programmers Assistant</p><p style="text-indent: 0pt;text-align: left;"><br/></p><h2 style="padding-left: 35pt;text-indent: 0pt;text-align: left;">If You Make a Mistake </h2><p style="padding-top: 9pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">Editing in the Executive Window is explained in detail in Chapter 7. In the following section, only a few of the most useful commands are repeated.</p><p style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">To move the caret to a new place in the command being typed, point the mouse cursor at the appropriate position. Then press the left mouse button.</p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-top: 4pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">To move the caret back to the end of the command being typed, press Control-X (hold the Control key down, and type <b>X</b>).</p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-top: 4pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">To delete:</p><p style="padding-top: 7pt;padding-left: 131pt;text-indent: 0pt;text-align: left;">Character behind the caret Press the Backspace key</p><p style="padding-top: 7pt;padding-left: 131pt;text-indent: 0pt;text-align: left;">Word behind the caret Press Control-W (hold the Control key down and type</p><p style="padding-left: 263pt;text-indent: 0pt;text-align: left;">W)</p><p style="padding-top: 7pt;padding-left: 131pt;text-indent: 0pt;text-align: left;">Any part of the command Move the caret to the appropriate place in the</p><p style="padding-left: 263pt;text-indent: 0pt;text-align: left;">command. Hold the right mouse button down and move the the mouse cursor over the text. All of the</p><p style="padding-left: 263pt;text-indent: 0pt;text-align: left;">blackened text between the caret and mouse cursor is deleted when you release the right mouse button.</p><p style="padding-top: 7pt;padding-left: 131pt;text-indent: 0pt;text-align: left;">Entire command Press Control-U (hold the Control key down and type</p><p class="s10" style="padding-left: 263pt;text-indent: 0pt;text-align: left;">U<span class="p">)</span></p><p style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">Deletions can be undone. J ust press the <span class="s3">UNDO </span>key.</p><p style="padding-top: 7pt;padding-left: 107pt;text-indent: 0pt;text-align: left;">To add more text to the line, move the carent to the appropriate position and start to type. Whatever you type will appear at the caret.</p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="text-indent: 0pt;text-align: left;"><br/></p><p style="padding-left: 209pt;text-indent: 0pt;text-align: left;">[This page intentionally left blank]</p><p style="text-indent: 0pt;text-align: left;"><span><img width="640" height="8" alt="image" src="Image_021.png"/></span></p><p class="nav">&nbsp;&nbsp;</p><p class="nav">&nbsp;</p><p class="nav"><a href="part3.htm">&lt; Previous</a><span> | </span><a href="../Medley-Primer.html">Contents</a><span> | </span><a href="part5.htm">Next &gt;</a></p><p class="nav">&nbsp;&nbsp;</p></body></html>