1 Medley for the Novice, Release 2.0 1 Medley for the Novice, Release 2.0 2. TYPING SHORTCUTS 1 2. TYPING SHORTCUTS 1 "2"2. TYPING SHORTCUTS 6 Once you have logged in to Medley, you are in Lisp. The functions you type into the Executive Window will now execute, that is, perform the designated task. Lisp is case-sensitive(CASE% SENSITIVITY NIL Case% sensitivity NIL NIL 1); 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. 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 "evaluation." 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(READ-EVAL-PRINT% LOOP NIL Read-eval-print% loop NIL NIL 1), and is how most Lisp interpreters, including the one for Lisp, run. The prompt in is a number followed by a left-pointing arrow (see Figure 2.3). This number is the function's position on the History List%a list that stores your interactions with the Lisp interpreter. Type the function (PLUS 3 4), and notice the History List assigns to the function (the number immediately to the left of the arrow). Lisp reads in the function and its arguments, evaluates the function, and then prints the number 7. Programmer's Assistant 1 In addition to this read-eval-print loop, there is also a "programmer's assistant." It is the programmer's assistant that prints the number as part of the prompt in the executive window, and uses these numbers to reference the function calls typed after them. When you issue commands to the programmer's assistant(PROGRAMMER'S% ASSISTANT NIL Programmer's% assistant NIL NIL 1), you will not use parentheses as you do with ordinary functiion calls. You simply type the command, and some specification that indicates which item on the history list the command refers to. Some programmer's assistant commands are FIX(FIX (Command) NIL NIL NIL 1), REDO(REDO (Command) NIL NIL NIL 1), and UNDO(UNDO (Command) NIL NIL NIL 1). They are explained in detail below. Programmer's 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. As an example use of the programmer's assistant, use REDO to redo your function call (PLUS 3 4). Type REDO at the prompt (programmer's assistant commands can be typed in either upper- or lowercase) , then specify the previous expression in one of the following ways: f When you originally typed in the function you now want to refer to, there was a History List number to the left of the arrow in the prompt. Type this number after the programmer's assistant command. This is the method illustrated in Figure 2-1. `u@`wݞ}xݮx7w{} xݾo;0000000000000000080 ̓0x`0|@ ̓X`0̓0000 000 @000 00 `0 `00000@00000000000>~|a03`0008@3`0`0D3|```09>``0D3`a0D@3`c083~|c0000000@00000000000008@0D0M040D@0800000000000000000000000000 Figure 2-1. Using a Programmer's Assistant Command to REDO a Function f 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. `w|` 0;}}}<}|]ۿ}w}};}}}]ۿ}|<}7``````````````````|``f <0` f,0c@ fl` |xL`@ ` ~`" ` ` ` `0`0````c` `@`@``aa`````?~>``cc` ccc@cc``"0cc``@cc`` cc``~>``````c` `@`@``aa``````` c@``@` `````````````````````````` Figure 2-2. Using a Negative Number after the Programmer's Assistant Command f You can also specify the function for the programmer's assistant with one of the items that was in that function call. The programmer's assistant will search backwards in the History List, and use the first function it finds that includes that item. For example, type REDO PLUS to have the functiion (PLUS 3 4) reevaluated. f If you type a programmer's assistant cmmand without specifying a function (i.e., simply typing the command, following by a Return), the programmer's assistant executes the command using the function entered at the previous prompt. Figure 2-3 shows a few more examples of how to use the programmer's assistant. @@`wݞ}xݮx7w{} xݾo; 8 ̓0 x` 8@ ̓ X` D̓0 0 800 @@00 |0 ` `  À @ @ @ @ @ À >~| 3` 8@3` D3| >` 3` D@3` 83~| À @ @ @ @ @ À   @ 0 )` H |@  `x0 3` 8@3` D3`x6 >`<`& 80` `? @@0`` |0~|   0  @ @ @  @ @  y>>a ̀03ca |@ 03c3 @y0>>c y=033c   033c  D@̀ư33c  8>>>  ` 0   Ĉ Ĉ Lj H H H LJ > 3 8@3 D> y3 D3 D@3 8>  Ĉ Ĉ Lj H H H LJ 1~π > 1`l0 |@1`l<<0 1|π | 1`l f  1`l   @1`l f  >~π <  Ĉ Ĉ Lj H H H LJ >| 3f 8@3f D>| 93f D3f D@3f 8>|  Ĉ Ĉ Lj H H H LJ ?l > 0l0 8@0g<<0 D>c | M0c f 40g  D@0l f 80l < y>>a ̀03ca 8@ 03c3 Dy0>>c M=033c  4 033c  D@̀ư33c  8>>>  ` 0   Ĉ" Ĉ" Lj H H H LJ> 0 0 8@ D E D D@ 8 @ @ @q`KDG8! €" L"D0@" €yH"D<# €H"DD" "ș"L0D"! yH4 3 @3 p> 3 3 @3 >  Ĉ" Ĉ" Lj H H H LJ> >| 3f 8@3f D>| 3f 83f @@3f |>|  Ĉ Ĉ Lj H H H LJ 8@ D   D@ 8 Figure 2-3. Some Applications of the Programmer's Assistant If You Make a Mistake 1 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. 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. To move the caret back to the end of the command being typed, press Control-X (hold the Control key down, and type X). To delete: Character behind the caret Press the Backspace key Word behind the caret Press Control-W (hold the Control key down and type W) Any part of the command Move the caret to the appropriate place in the command. Hold the right mouse button down and move the the mouse cursor over the text. All of the blackened text between the caret and mouse cursor is deleted when you release the right mouse button. Entire command Press Control-U (hold the Control key down and type U) Deletions can be undone. Just press the UNDO key. 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. [This page intentionally left blank] (LIST ((PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC "2-" "") STARTINGPAGE# 1) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD RIGHT) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY HELVETICA OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC "2-" "")) (270 15 288 36) NIL) (HEADING NIL (HEADINGTYPE FOOTINGR) (54 27 558 36) NIL) (TEXT NIL NIL (54 54 504 702) NIL))) (PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC "2-" "")) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD LEFT) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY HELVETICA OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC "2-" "")) (54 15 288 36) NIL) (HEADING NIL (HEADINGTYPE FOOTINGV) (54 27 558 36) NIL) (HEADING NIL (HEADINGTYPE VERSOHEAD) (54 762 558 36) NIL) (TEXT NIL NIL (54 54 504 684) NIL))) (PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC "2-" "")) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD RIGHT) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY HELVETICA OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC "2-" "")) (270 15 288 36) NIL) (HEADING NIL (HEADINGTYPE FOOTINGR) (54 27 558 36) NIL) (HEADING NIL (HEADINGTYPE RECTOHEAD) (54 762 558 36) NIL) (TEXT NIL NIL (54 54 504 684) NIL)))))-HHT2`8HH2HTT3HTTT,HH ,HH9HHT3`T3HTTT,HH-T-T25-TF PAGEHEADING VERSOHEADF PAGEHEADING RECTOHEADE PAGEHEADINGFOOTINGVE PAGEHEADINGFOOTINGR CLASSIC TITAN TITAN  HELVETICA HELVETICA HELVETICA CLASSICCLASSIC MODERNMODERN  HRULE.GETFNMODERN  " HRULE.GETFNCLASSIC # HRULE.GETFNCLASSIC  HRULE.GETFNCLASSIC  IM.CHAP.GETFN HELVETICA HRULE.GETFNMODERN 3IM.INDEX.GETFN ;IM.INDEX.GETFNF aE   HRULE.GETFNCLASSIC 5?IM.INDEX.GETFNIM.INDEX.GETFNIM.INDEX.GETFNIM.INDEX.GETFN'  5   BMOBJ.GETFN3CLASSIC 7   BMOBJ.GETFN3CLASSIC M  [?O` BMOBJ.GETFN3CLASSIC =    HRULE.GETFNCLASSIC  s  3MC ) $ z