home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / lambda / soundpot / f / ilisp-2.lbr / LISP.DZC / LISP.DOC
Encoding:
Text File  |  1993-10-26  |  89.8 KB  |  2,059 lines

  1. NOTE: This is the table of contents of the complete iLISP Reference 
  2. Manual. Only a portion of this manual is included in this file.
  3.  
  4. The contents of this file are 
  5.        (C) Copyrighted by Computing Insights, 1983.
  6.  
  7.                      iLISP Reference Manual
  8.  
  9.                         Table of Contents
  10.  
  11.        Section                                          Page
  12. ============================================================
  13.   0    Introduction
  14.                  About This Book                          4
  15.                  Using iLISP                              5
  16.   1    Data Types                              
  17.                   Numbers                                 7
  18.                   Literal Atoms                           9
  19.                   Lists                                  10
  20.                   Functions                              11
  21.   2    Primitive Functions
  22.                   List Functions                         14
  23.                     Selector Functions                   14
  24.                     Constructor Functions                15
  25.                     Destructive Functions                17
  26.                     Miscellaneous                        19
  27.                   Property List Functions                20
  28.                   Literal Atom Functions                 22
  29.                   Arithmetic Functions                   24
  30.                   Non Numeric Predicates                 26
  31.                     EQ and EQUALity                      26
  32.                   Procedure Functions                    28
  33.                     EVAL                                 28
  34.                     MAP Functions                        29
  35.                   Input/Output                           32
  36.                     READ                                 32
  37.                     Character Syntax                     33
  38.                     Read Macros                          35
  39.                     Console Input                        39
  40.                     PRINT                                41
  41.                     OUTPUT Formatting                    42
  42.                   Files                                  43
  43.                     Creating Files                       43
  44.                     Random Access                        44
  45.                     ERASE, RENAME                        44
  46.                   Miscellaneous Functions                45
  47.   3    Syntactic Forms                         
  48.                   QUOTE                                  48
  49.                   LAMBDA                                 49
  50.                   PROGN                                  50
  51.                   IF                                     51
  52.                   COND                                   51
  53.                   SELECTQ                                53
  54.                   AND                                    53
  55.                   OR                                     54
  56.                   SETQ                                   54
  57.                   LET                                    54
  58.                   LETSYS                                 55
  59.                   DEFINE                                 56
  60.                   CATCH                                  56
  61.                   ERRORSET                               57
  62.                   MACRO                                  57
  63.                     How MACROs Work                      59
  64.   4    iLISP Semantics                        
  65.                   LAMBDA                                 61
  66.                   Variable Scoping                       63
  67.                   Tail Recursion                         65
  68.   5    System Operation                        
  69.                   EXEC                                   69
  70.                   Start Up Procedures                    72
  71.                   Command Line Parameters                72
  72.                   Keyboard Interrupts                    73
  73.   6    The iLISP Editor                        
  74.                   Basic Editing Concepts                 76
  75.                   Move Commands                          77
  76.                   Modify Commands                        80
  77.                   Other Editing Features                 84
  78.   7    Error Processing                        
  79.                   Error Handling Philosophy              87
  80.                   Nonrecoverable Errors                  88
  81.                   Recoverable Errors                     88
  82.                   The Debugging Loop                     89
  83.                   Modifying Error Handling Procedures    91
  84.   8    Tracing                                           93
  85.   9    The iLISP Library Utility               
  86.                   Creating Library Files                 98
  87.                   Saving Functions                       98
  88.                   Retrieving Functions                   99
  89.                   Documenting Functions                  99
  90.                   Listing Functions                     100
  91.                   Other Functions                       101
  92.  10    iLISP Memory Allocation                 
  93.                   Primary Memory Usage                  102
  94.                   Saving an iLISP memory image          104
  95.                   Garbage Collection                    105
  96.   Appendicies
  97.           A Alphabetical Guide to iLISP Functions       107
  98.           B EVAL Description                            141
  99.           C LISP Error Messages                         143
  100.           D LISP Editor Commands                        145
  101.           E How to configure CS and CURSOR              147
  102.           F System Reconfiguration Options              151
  103.           G Machine Language Interfacing                155
  104.           H iLISP internal addresses                    159
  105.           I iLISP and Standard LISP Differences         163
  106.  
  107.                     A Guide to Learning iLISP
  108.  
  109.                         Table of Contents
  110.  
  111.       Section                                         Page
  112. ==========================================================
  113. 1  -  Introducing LISP
  114.         Getting Started                                171
  115.         Numbers                                        171
  116.         Notations                                      172
  117.         Functions and Applications                     173
  118.         Variables                                      174
  119.         Assignment and SETQ                            175
  120.         Nested Evaluation and Composition              176
  121.         Defining New Functions                         178
  122. 2  -  New Data Types: Literal Atoms and Lists         
  123.         Literal Atoms                                  183
  124.         Lists                                          185
  125.         NIL, The Empty List                            186
  126.          CAR & CDR, CONS, LIST, APPEND                 187
  127.         Defining New List Functions                    189
  128. 3  -  The LISP Secret: Programs are Data               191
  129. 4  -  More LISP Programming                          
  130.         IF, PREDICATES, T                              197
  131.         Syntactic Forms                                199
  132.         Equality                                       200
  133.         Recursion                                      202
  134.     LISP Programs                                  209
  135. 5  -  Input/Output in LISP:
  136.         READ                                           211
  137.         PRINT                                          212
  138. 6  -  iLISP and Disk Files                             215
  139. 7  -  Functions are Data                             
  140.         LAMBDA                                         218
  141.         Abstracting Control Structures                 219
  142.         Some New Forms                                 225
  143. 8  -  What to Do Next                                  227
  144.  
  145. Supplements
  146.  
  147.         The Pretty Print Algorithm                     229
  148.         Some Basic Statistics                          235
  149.         Using and Improving ELIZA                      239
  150.      Bibliography                                  248
  151.  
  152. iLISP Reference Manual   Chapter 0 (ABRIDGED)
  153. INTRODUCTION
  154.  
  155. iLISP is an implementation of LISP for the Z-80 CPU running under the 
  156. CP/M 2.x operating system. It is based on the LISP dialect called 
  157. SCHEME, developed at M.I.T. by Guy Lewis Steele and Gerald Sussman. 
  158. Its most unusual feature is that it supports lexical scoping of 
  159. variables (as opposed to the traditional dynamic scoping) and, 
  160. consequently, offers a stack free implementation of tail recursion 
  161. which allows LISP programmers to write recursive functions without 
  162. unnecessary overhead. 
  163.  
  164. About This Book
  165. ===============
  166. The iLISP Reference Manual is a reference document and a guide, 
  167. offering both a description of the iLISP implementation and 
  168. suggestions on how to write programs in iLISP. Many of the chapters 
  169. are broken into three types of sections:
  170.  
  171. 1)   Introductory notes for people who may not have seen the type of 
  172.      thing being described. E.g. the opening section of the list 
  173.      EDITOR chapter.
  174.            
  175. 2)   Straightforward reference material, organized to facilitate rapid 
  176.      lookup of particular information. E.g. Appendix A which presents 
  177.      all of the iLISP functions in alphabetical order.
  178.  
  179. 3)   Follow up suggestions and advice on how to use the feature  
  180.      described in the chapter.
  181.           
  182. Because of the importance of the primitive function set provided by 
  183. any LISP implementation, the iLISP set is documented twice: First in 
  184. Chapter Two, where all of the available functions are presented, 
  185. grouped by function or topic. Then in Appendix A, where they are all 
  186. presented in alphabetical order.
  187.  
  188. Very technical information is relegated to the appendicies at the end 
  189. of manual. 
  190.  
  191. Getting Into and Getting Out of iLISP
  192. =====================================
  193. To use iLISP, first make a copy of the distribution disk using the PIP 
  194. utility. Once this is done, and your copy is loaded into the A: disk 
  195. drive of your system, simply type at CP/M:
  196.  
  197.                 A>LISP
  198.  
  199. There is no need to provide any command line parameters.
  200.  
  201. It takes a moment to load the iLISP interpreter. When it is loaded, it 
  202. will print out:
  203.  
  204.            iLISP 2.0 - (C) Copyright by Computing Insights, 1982
  205.            Serial #nnnn 
  206.  
  207. and pause again. Under normal conditions, iLISP spends about five 
  208. seconds allocating internal memory. When it finishes, it will print a 
  209. greeting and then begin a new line with the standard iLISP prompt 
  210. character: "-".
  211.  
  212. At this point it is ready for your instructions.
  213.  
  214. To exit iLISP, you only have to evaluate the function EXIT. This is 
  215. usually done at the top level:
  216.  
  217.                 -(EXIT)                 ;return to CP/M
  218.                 A>                      
  219.  
  220. iLISP resists most other means of exiting programs (e.g. typing 
  221. control-C) in order to reduce the chances of accidentally exiting LISP 
  222. before you have saved your programs and closed any open files.
  223.  
  224. Once you have examined iLISP you may want to copy the LISP.COM file 
  225. onto the disk you use as your "standard" A: disk, the one that holds 
  226. all your COM files (Sometimes called a MASCOM disk). If you do this, 
  227. be sure to also copy the file named INIT.LSP as this is needed to 
  228. maintain iLISP's standard behavior. Chapter 5 documents this file and 
  229. how to change it.
  230.  
  231. Additional Note
  232. ===============
  233. iLISP monitors the console keyboard frequently. The following keys are 
  234. recognized at all times:
  235.  
  236. Control-C      forces an evaluation of (RESET). All processing is 
  237.                aborted. INPUT and OUTPUT are set to CON:. Control 
  238.                returns to the (EVAL EXEC) loop. No error processing is 
  239.                performed.
  240.  
  241. Control-B      causes an ERROR #10. Usually results in a BREAK from 
  242.                which the computation can be aborted or continued.
  243.  
  244. Control-E      causes an ERROR, but bypasses all error processing. 
  245.                That is, it behaves as though ERRPRIN were NIL. Control 
  246.                goes to the next level ERRORSET, or to the top level 
  247.                loop if there are no ERRORSETs.
  248.  
  249. The following keys are recognized during printing to the console:
  250.  
  251. Control-O      abort the current call to print and continue. Used to 
  252.                bypass the output of long or circular lists. No error 
  253.                is caused; control flow is unchanged.
  254.  
  255. Control-S      suspend printing. Resume by typing control-Q.
  256.  
  257. For specialized applicatons, keyboard monitoring can be turned off by 
  258. uing the BYTE function to store a 255 in location PINT (see appendix 
  259. H for this address).
  260. iLISP Reference Manual
  261. Chapter 6  (ABRIDGED)
  262. The ilISP List Editor
  263.  
  264.  
  265.  
  266.      The iLISP list editor provides a convenient way to modify 
  267.      function definitions and variable values. It is an editor which 
  268.      is oriented towards list structures rather than text. While it 
  269.      may take some getting used to, it will become your most valuable 
  270.      programming tool. 
  271.  
  272.  
  273. EDITING LISP FUNCTIONS
  274. ======================
  275. One of the best aspects of programming in LISP is its interactive 
  276. nature. You sit at your terminal and type in a function, and test it, 
  277. and change it, and test it, ....
  278.  
  279. ...
  280.  
  281. List oriented editors are not oriented toward modification of 
  282. characters or text, but are oriented toward modifying list data 
  283. structures. Their commands operate on the list structures themselves 
  284. and consequently go a long way toward eliminating the hassles of 
  285. LISP's highly parenthesized syntax.
  286.  
  287. The iLISP editor is a list oriented editor.
  288.  
  289. BASIC CONCEPTS
  290. ==============
  291. When a text editor is said to be line oriented, it usually means that 
  292. it is has an internal pointer which is always pointing to a particular 
  293. line in the text and its commands are oriented toward modifying that 
  294. line, or, derive meaning through reference to the line (e.g. move 
  295. pointer relative to the current line). When we say a list editor is 
  296. list oriented, we mean that it has a built in pointer which is always 
  297. pointing to a list, called the current list and all of its commands 
  298. are oriented toward modifying or manipulating that list, and, its 
  299. commands derive meaning through reference to that list.
  300.  
  301. The usual way of using the editor is with the LISP macro EDIT. EDIT 
  302. take a single literal atom as an argument and it makes, as the current 
  303. expression to be edited, a DEFINE or MACRO expression which gives the 
  304. definition or value of the atom. E.g. typing (EDIT PP) will have you 
  305. editing the expression:
  306.  
  307.      (DEFINE PP (X) (PROGN (PPRIN2 X) (TERPRI))) 
  308.  
  309. because this is the expression which when evaluated will properly 
  310. define PP. When you exit the editor, this expression, modified by you, 
  311. will be passed to EVAL which will cause PP to be redefined.
  312.  
  313. When the editor is called, it clears the screen* and presents the list 
  314. being edited by printing each element of the list on a separate 
  315. numbered line:
  316.  
  317. ----------------------------------------------------------------
  318. * Optimal use of the editor requires that the function CS, for 
  319. clearing the screen, be correctly adapted for use on your terminal. 
  320. The default operation of CS will work for many terminals (it simply 
  321. prints the character control-L). To test whether CS works properly 
  322. with your terminal, just type
  323.  
  324.         (CS)
  325.  
  326. followed by a carriage return. The terminal screen should clear 
  327. and "()" should be printed in the upper left hand corner of the 
  328. screen. If this doesn't happen, refer to Appendix E and follow 
  329. the instructions there for customizing CS for your terminal.
  330. ----------------------------------------------------------------
  331.      .                                                           .
  332.         ; All  of the following examples of editor operations
  333.         ; will be made on the function FAC, defined by:
  334.  
  335.         -(DEFINE FAC (N) (IF (ZEROP N) 1 (* N (FAC (SUB1 N)))))
  336.         FAC
  337.         -(EDIT FAC)
  338.  
  339.         1 DEFINE
  340.         2 FAC
  341.         3 (N)
  342.         4 (IF (ZEROP N) 1 (* N &))
  343.      '                                                           '
  344.  
  345. The editor uses a PRINTLEVEL of 2 (See Chapter 2) to start with, 
  346. so each element rarely, if ever, extends over one line.
  347.  
  348. The editor accepts a variety of commands for moving about inside 
  349. the current list and for modifying the list in several ways. 
  350. Commands are either LISP atoms or lists and should be typed in 
  351. remembering the general rules for typing LISP data objects: in 
  352. particular:
  353.  
  354.      you can put as many as you want on one line, 
  355.  
  356.      you can spread one list out across several lines, 
  357.  
  358.      you should separate adjacent atoms with a space or some 
  359.      other delimiter,
  360.  
  361.      and, of course, you must type RETURN before the editor will 
  362.      actually see and act on your commands.
  363.  
  364. The easiest way to get a feel for how the editor works is to 
  365. actually type in the examples below and try out the various 
  366. editing commands as they are introduced.
  367.  
  368.  
  369. MOVING ABOUT INSIDE THE LIST
  370. ============================
  371. The commands for traversing the list structure allow you to move into 
  372. or out from the current list.           
  373.  
  374.                   Typing a number makes the element of  the 
  375.                   current  list which is identified by that 
  376.                   number the new current list. 
  377.                        
  378.                     .                             .
  379.                        1 DEFINE
  380.                        2 FAC
  381.                        3 (N)
  382.                        4 (IF (ZEROP N) 1 (* N &))
  383.                        *4      ;move to element 4
  384.                
  385.                        1 IF
  386.                        2 (ZEROP N)
  387.                        3 1
  388.                        4 (* N (FAC &))
  389.                        *2      ;move to element 2
  390.                
  391.                        1 ZEROP
  392.                        2 N
  393.                     '                             '
  394.  
  395.  
  396.                   Typing  a  zero  means "go  back  up  one 
  397.                   level".  That  is,  go back to  the  list 
  398.                   surrounding the current list.
  399.  
  400.                     .                                       .
  401.                        1 ZEROP
  402.                        2 N
  403.                        *0
  404.  
  405.                        1 IF
  406.                        2 (ZEROP N)
  407.                        3 1
  408.                        4 (* N (FAC &))
  409.                        * 4 3       ;more than one command
  410.                                    ;per line is ok
  411.  
  412.                        1 FAC
  413.                        2 (SUB1 N)
  414.                     '                                       '
  415.  
  416.  
  417.                   Typing  the single character  "^", (the 
  418.                   uparrow), means "go  back to the outermost 
  419.                   list".  It  is like  typing a "B" for 
  420.                   Beginning  command in some text editors.
  421.  
  422.                     .                                  .
  423.                        1 FAC
  424.                        2 (SUB1 N)
  425.                        *^
  426.         
  427.                        1 DEFINE
  428.                        2 FAC
  429.                        3 (N)
  430.                        4 (IF (ZEROP N) 1 (* N &))
  431.                     '                                  '
  432.  
  433.  
  434.  
  435. SEARCH COMMANDS
  436. ===============
  437.  
  438. LIST MODIFICATION
  439. =================
  440. Once you have found a list that you want to change, the list 
  441. modification commands allow you to add to, delete and replace 
  442. elements of the current list.
  443.  
  444.                   All editor commands which actually modify 
  445.                   the  current  list  are in  the  form  of 
  446.                   lists;  that is,  the commands themselves 
  447.                   are enclosed in parentheses.
  448.  
  449. To insert a new element into the current list the command is:
  450.  
  451.         (-n X)
  452.  
  453. where  n  is an integer.  This means 
  454.  
  455.      insert X into the current list BEFORE the nth element.
  456.  
  457. To insert more than one element at a time, you can just follow X 
  458. with as many new elements as you wish:
  459.  
  460.      (-n X Y Z ...)
  461.  
  462. which means:
  463.  
  464.      insert X, Y, Z, ... all into the current list BEFORE the nth 
  465.      element.
  466.  
  467. To replace an element of the current list with one or more elements 
  468. use:
  469.  
  470.         (n X)
  471.  
  472. which means:  
  473.  
  474.      replace the nth element of the current list with the expression 
  475.  
  476. (As with the insert commands you can replace a single element 
  477. with many simply by including them in the replace command, e.g. 
  478. (n X Y Z ...).)
  479.  
  480.           .                                                 .
  481.  
  482.              1 DEFINE
  483.              2 FAC
  484.              3 (N)
  485.              4 (IF (ZEROP N) 1 (* N &))
  486.              *(-4 (M))       ;insert the list (M) 
  487.                              ;before the 4th element
  488.  
  489.              1 DEFINE
  490.              2 FAC
  491.              3 (N)
  492.              4 (M)
  493.              5 (IF (ZEROP N) 1 (* N &))
  494.              *(4 (A B) (C D))   ;replace the 4th element 
  495.                                 ;with these two lists
  496.  
  497.              1 DEFINE
  498.              2 FAC
  499.              3 (N)
  500.              4 (A B)
  501.              5 (C D)
  502.              6 (IF (ZEROP N) 1 (* N &))
  503.              *(4)
  504.                       ;To Delete an element:
  505.                       ;replace it with nothing.
  506.  
  507.              1 DEFINE
  508.              2 FAC
  509.              3 (N)
  510.              4 (C D)
  511.              5 (IF (ZEROP N) 1 (* N &))
  512.              *(4)
  513.  
  514.              1 DEFINE
  515.              2 FAC
  516.              3 (N)
  517.              4 (IF (ZEROP N) 1 (* N &))
  518.         
  519.           '                                                 '
  520.  
  521. To insert a new element at the beginning of the current list you 
  522. can use:
  523.  
  524.         (-1 A)  ;ADD BEFORE the first element
  525.                         or
  526.         (0  A)  ;REPLACE the (nonexistent) zeroth element
  527.  
  528. To add an element to the end of the current list you can use:
  529.  
  530.         (-5 A)  ;ADD BEFORE the (nonexistent) element after the last
  531.                 ;       or
  532.         (N  A)  ;The command N means "add to the end"
  533.  
  534. Remember: Any of these commands: (n X Y Z), (-n X Y) and (N X Y) 
  535. may have zero, one or more elements in the list.
  536.  
  537. THE EDITOR's READ MACRO: #
  538. ==========================
  539. Within the editor, the character "#" is a read macro which can be used 
  540. in the following way:
  541.  
  542.                   #n,  where n is a positive integer, means 
  543.                   "a copy of the nth element of the current 
  544.                   list".
  545.  
  546. You can use this notation to move pieces of the list structure 
  547. without retyping them.
  548.  
  549. ...
  550.         
  551. MANIPULATING PARENTHESES
  552. ========================
  553. The grouping of the elements of the current list into sublists 
  554. may be modified by these two editor commands:
  555.  
  556.         (PI n m) - Parentheses In
  557.                 Insert parentheses around the elements starting with the 
  558.                 nth element and ending with the mth element.
  559.  
  560.         (PO n)   - Parentheses Out
  561.                 Remove the parentheses surrounding the nth element
  562.                 of the current list.
  563.  
  564. SEARCH and REPLACE
  565. ==================
  566. The editor also has a "search and replace" command:
  567.  
  568. (R X Y) 
  569.     - replace all occurences of X (in the current list) with Y
  570.      
  571. MISCELLANEOUS EDITING COMMANDS
  572.  
  573. OK   When not inside an F* command, OK means EXIT the editor. 
  574.      When you are in the F* command, it means go on to the next 
  575.      occurence.
  576.  
  577. ABORT!
  578.      exit the editor, but forget the changes made during this 
  579.      editing session. This is for when you've made a terrible 
  580.      mistake. Since the editor is working on a copy of the actual 
  581.      expression, this command is always available to you.
  582.  
  583. P n  Change the current PRINTLEVEL used by the editor to n.
  584.  
  585. PP
  586.      Pretty Print the current list. The pretty printed list will 
  587.      remain on the screen until you type any key. E.g.
  588.  
  589.  
  590. E exp
  591.      Evaluate the expression "exp", print the results, pause 
  592.      until the user types a key.  This allows you to invoke the 
  593.      full power of EVAL during an editing session. 
  594.  
  595.  
  596. EDITING HINTS
  597. =============
  598. While we have deliberately kept the editor small, because it 
  599. usually resides in memory. It can still serve as a powerful tool, 
  600. providing facilities beyond what its simple command set might 
  601. seem to imply.
  602.  
  603.      1) Use The E Command
  604.  
  605.      The E command is the key to using all of LISP's functions 
  606.      while you are editing. For example, 
  607.         
  608.           If you need to consult or modify the definition of a 
  609.           function (e.g. PPRIN2) while editing another one, you 
  610.           can type:
  611.  
  612.         * E (EDIT PPRIN2)
  613.  
  614.           which will call the editor on PPRIN2 from inside the 
  615.           editor. When you finish editing PPRIN2, you will be 
  616.           returned to the editor at exactly the point you invoked 
  617.           the second call from. (Remember that the E command 
  618.           waits for you to type a key before returning you to the 
  619.           editor.)
  620.  
  621.      2) Buffering Portions of the Current List Structure
  622.  
  623.      There is no primitive command for extracting and buffering a 
  624.      piece of list structure. However, the simple commands for 
  625.      moving pieces of the current list about within the current 
  626.      list are not always enough. Sometimes you need to move a 
  627.      piece of the current list to some other part of the function 
  628.      definition. You need the equivalent of a list structure 
  629.      buffer. The E command gives you the ability to use any LISP 
  630.      variable:
  631.  
  632.         * E (SETQ BUF '#3)  ;Extract the third element 
  633.                             ;and store it in a variable
  634.         *                   ;after moving 
  635.         * (-2 $BUF)         ;insert the value of BUF before the
  636.                             ;second element of this structure
  637.  
  638.      You can even carry these buffers (as many as you want) from 
  639.      one call of the editor into another.
  640.  
  641.      3) The Editor as a Filtering Pipeline
  642.  
  643.      There is a second EDIT function available: EDITL. EDITL 
  644.      takes a list as its argument. It invokes the editor on a 
  645.      copy of the list and returns the new value of the list as 
  646.      its value. It can not be used to edit function definitions 
  647.      or variable values because it makes a copy and will not 
  648.      actually modify values. However it can be used inside 
  649.      functions or inside expressions to permit you to step in and 
  650.      modify values on the fly. For example,
  651.  
  652.           I want to copy some of the function definitions on one 
  653.           file to another. But, I don't remember all the names of 
  654.           all of the functions I want to copy. I type:
  655.  
  656.                 (COPYFILE 'OLD 'NEW (EDITL (DIRFILE 'OLD)))
  657.  
  658.           Which, when evaluated, finds the directory of the old 
  659.           file (DIRFILE 'OLD) and passes it to the editor, 
  660.           allowing me to edit the list of functions, leaving only 
  661.           the ones I want to copy. EDITL then passes the modified 
  662.           list on to the COPYFILE command.
  663.  
  664.         Here's another:
  665.  
  666.           Some of my library files need packing,  but I don't remember 
  667.           all of their names. 
  668.  
  669.                 (MAPNIL PACKFILE (EDITL (FILDIR '*.LSP)))
  670.  
  671.           allows  me to edit a list of all of the names of all of  the 
  672.           files with the extension .LSP. I can edit the list, deleting 
  673.           the  files which don't need to be packed,  and when I'm done 
  674.           (when I type OK),  PACKFILE will be applied to the ones that 
  675.           remain. 
  676.  
  677.         Once you start using this trick, it becomes indispensable.
  678.  
  679. Appendix D contains a one page summary of all of the editor commands.
  680. APPENDIX A - A Function Index
  681. ----------
  682. ABRIDGED FOR ELECTRONIC DISTRIBUTION
  683. NOTE: This abridged version of Appendix A contains all of the entries 
  684. that the complete appendix contains,  however,  most examples and 
  685. descriptions  have  been deleted in an attempt to make this  file 
  686. reasonably small.
  687. ----------
  688. This appendix contains descriptions of all of the functions provided 
  689. with iLISP. The entries are in alphabetical order. Each entry contains 
  690. a one line description of the function, with an indication of whether 
  691. it is a machine language function (a SUBR) or a LISP expression (an 
  692. EXPR). For EXPRs the one line description also indicates which library 
  693. file the source code for the function can be found on, and whether or 
  694. not the file is actually resident in the standard iLISP file (if the 
  695. file name is followed by an asterisk, the function must be loaded 
  696. before it can be used) e.g.
  697.  
  698. (ADDEL NEW LIST N)  Add an Element to a list    EXPR/UTILITY*
  699.  
  700.      ADDEL is an EXPR type function, which is stored on the file   
  701.      UTILITY and which is not loaded into the standard LISP.COM 
  702.      file.
  703.  
  704.  
  705. Each entry also contains:
  706.  
  707.    - a description of the value of the function,  
  708.    - any side effects it causes (if any),
  709.    - a description of what the function actually does, or how it 
  710.      works, and
  711.    - sometimes, examples of the use of the function or hints 
  712.      about when it is appropriate to use it.
  713.  
  714. This section does not include entries for all of the functions 
  715. internal to the iLISP utilities or the extra LISP programs such as 
  716. ELIZA.
  717.  
  718. The List Starts Here:
  719. (ABS N)             Absolute Value of N           SUBR 
  720.     Argument Types: N - number
  721.     Value:          Absolute value of N
  722.  
  723. (ADDEL NEW LIST N)  Add an element to a list      EXPR/UTILITY*
  724.     Argument Types: NEW - any data object
  725.                     LIST - a list
  726.                     N - integer, indicating position within the list
  727.     Value:          a list
  728.     Description:    Inserts the new element into the list after the 
  729.      Nth element of the list. 
  730.  
  731. (ADD1 N)            Increment a Number            SUBR  
  732.     Argument Types: N - number
  733.     Value:          A number equal to N+1
  734.  
  735. (ALPHORDER X Y)     Alphabetize Two Literal Atoms SUBR
  736.     Argument Types: X, Y - no restrictions
  737.     Value:          T   - if X and Y are literal atoms and 
  738.                           X precedes Y alphabetically,
  739.                     ()  - otherwise
  740.  
  741. (APPEND L1 L2)      Concatenate Two Lists         SUBR
  742.     Argument Types: L1, L2 - lists
  743.     Value:          Copy of L1 with L2 attached to the end.
  744.     Description:    Makes a top level copy of L1 and then uses NCONC. 
  745.  
  746. (ARCTAN N)          Arctangent of N               SUBR
  747.     Argument Types: N - a number
  748.     Value:          floating point arctangent of N (in radians).
  749.  
  750. (ARGCNT X)          Argument Count of a Function  SUBR
  751.     Argument Types: X - no restrictions
  752.     Description:    If X is a function, ARGCNT returns the number of 
  753.      arguments it expects. If the number is indefinite (e.g. as for 
  754.      LIST), ARGCNT returns -1. If X is not a function, ARGCNT returns 
  755.      NIL.
  756.  
  757. (ASCII X)           Convert Literal to ASCII      SUBR
  758.     Argument Types: X - literal atom
  759.     Value:          Integer which is the ASCII code for the first 
  760.                     character of X's print name.
  761.  
  762. (ATOM X)            Test for Atom                 SUBR
  763.     Argument Types: X - no restrictions
  764.     Value:          X  - if X is an atom, literal or numeric
  765.                     () - otherwise
  766.  
  767. (BYTE addr val)     General Byte Manipulating Function SUBR
  768.     Argument Types: addr - number
  769.                     val  - optional, number
  770.     Value:          Current contents of (addr)
  771.     Side Effects:   May change the value of the byte at (addr).
  772.     Description:    This is a combined PEEK and POKE. If only one 
  773.      argument is provided, it returns the value of the byte at that 
  774.      address. If two are provided, it returns the current value, but 
  775.      changes it to the second argument. (It behaves like a system 
  776.      function.) Its only real use is for manipulating internal 
  777.      variables for which functions  have not been provided (see 
  778.      appendix H). Use caution with this function as it is easy to 
  779.      accidentally damage the iLISP program with unpredictable results. 
  780.  
  781. (CALL X ...)        Call a Machine Language Subroutine SUBR
  782.     Argument Types: X - a literal atom
  783.                     others - depends, see below
  784.     Description:    CALL's first argument is a literal atom whose 
  785.      print name has been constructed out of the bytes of a machine 
  786.      language subroutine according to the rules and methods of 
  787.      Appendix G. The remaining arguments, if any, are for that 
  788.      subroutine. CALL transfers control to the subroutine, which is 
  789.      responsible for returning its own value.
  790.  
  791. (CAR L)             Select First Element of L     SUBR
  792.     Argument Types: L - a list
  793.     Value:          First element of L
  794.  
  795. (CARS L N)          Copy First N Elements of L SUBR
  796.     Argument Types: L - a list
  797.                     N - an integer >= 0
  798.     Value:          A new list of the first N elements of L.
  799.     Description:   This is a constructor function. It builds a new 
  800.      list which is a copy of the first N nodes of L.
  801.  
  802. (CDR L)             Select All But First Element  SUBR 
  803.     Argument Types: L - a list
  804.     Value:          The sublist of L containing all except first 
  805.                     element of L.
  806.  
  807. (CDRS L N)          Repeat CDR N times            SUBR
  808.     Argument Types: L - a list
  809.                     N - an integer >= 0
  810.     Value:          The sublist of L containing all but the first 
  811.                     N elements of L.
  812.  
  813. (CHAR N)            Convert ASCII to Literal      SUBR
  814.     Argument Types: N - integer
  815.     Value:          A one character literal atom whose print name 
  816.                     is the ASCII character denoted by N.
  817.     Description:      Packs the integer into a literal atom format.
  818.           For the inverse function, see ASCII.
  819.  
  820. (CLEARBUF)          Skip to Next Line of INPUT    SUBR
  821.     Value:          ()
  822.     Side Effects:   Advances input file pointer
  823.     Description:    Skips current input device/file ahead until the 
  824.      next end of line sequence. 
  825.  
  826. (CLOSE F)           Close a File                  SUBR
  827.     Argument Types: F - a literal atom
  828.     Value:          The full file name of file F
  829.     Side Effects:   CP/M closes the named file.
  830.     Description:    Flushes the internal buffer if necessary and 
  831.      closes the file for i/o operations. If CLOSE closes either the 
  832.      primary input or output file, it resets it to CON:.
  833.  
  834. (CLOSEALL)          Close all Open Files          EXPR/AUX
  835.     Value:          A list of all closed files.
  836.     Side Effects:   CP/M closes all open files
  837.     Description:    Just maps CLOSE over (OPENP).
  838.  
  839. (CONCATENATE X Y)   Concatenate two literal atoms EXPR/UTILITY*
  840.     Argument Types:   Both literal atoms
  841.     Value:            A literal atom
  842.  
  843. (CONS X L)          Allocate a New List Element   SUBR
  844.     Argument Types: X - no restrictions
  845.                     L - a list
  846.     Value:          A list node whose CAR is X and CDR is L
  847.  
  848.      NOTE: That since iLISP does not support dotted pairs, the second 
  849.      argument, L, MUST BE A LIST.
  850.  
  851. (COPY L)            Make a Copy of a List         SUBR
  852.     Argument Types: L - no restrictions
  853.     Value:          A copy of L
  854.     Description:    Deep copy of L
  855.  
  856. (COSINE N)          Cosine of N                   SUBR
  857.     Argument Types: N - a number, denotes an angle in radians
  858.     Value:          floating point number = cosine of N
  859.  
  860. (CS)                Clear the Screen              SUBR
  861.     Value:          ()
  862.     Side Effects:   Clears console screen and homes the cursor
  863.     Description:    This function must be customized by the user. 
  864.      Consult Appendix E for details.
  865.  
  866. (CURSOR COL ROW)    Position Cursor               SUBR
  867.     Argument Types: COL, ROW - both numbers
  868.     Value:          ()
  869.     Side Effects:   Repositions the console's cursor
  870.     Description:    Moves the console's CRT cursor to (COL,ROW) on the 
  871.      screen. This function must be customized by the user.  See 
  872.      Appendix E.
  873.  
  874. (DEFEXP X)          Build a Defining Expression   EXPR/AUX
  875.     Argument Types: X - a literal atom
  876.     Value:          A DEFINE or MACRO expression
  877.     Description:    Returns a DEFINE or a MACRO expression which, when 
  878.      evaluated, correctly redefines X as either a function or a macro 
  879.      or just a variable with a value. 
  880.  
  881. (DELETEL L N)       Delete an element from a list EXPR/UTILITY*
  882.     Argument Types: L - a list
  883.                     N - an integer
  884.     Value:          a modified L
  885.     Description:    This function is one of three (ADDEL, DELETEL and 
  886.      REPLACEL) which allow you to treat lists as arrays. DELETEL 
  887.      actually modifies the list L (using RPLACAD) and removes the Nth 
  888.      element from it. 
  889.      If L only has one element in it, the value of DELETEL will be 
  890.      NIL, but, it is impossible for DELETEL to change L into () so the 
  891.      actual list structure will be unchanged. 
  892.  
  893. (DESCRIBE X)        Describe a Procedure          SUBR
  894.     Argument Types: X - no restrictions
  895.     Description:    If X is a user defined function with no local 
  896.      environment, DESCRIBE returns a LAMBDA expression which, when 
  897.      evaluated in the global environment would yield an equivalent 
  898.      function, otherwise it just returns X.
  899.  
  900. (DIR X)             Print a CP/M directory        EXPR/UTILITY*
  901.     Argument Types: X, literal atom (optional)
  902.     Value:          ()
  903.     Description:     Prints a directory of the current or specified 
  904.      disk. Acts just like the CP/M CCP DIR command. Optionally accepts 
  905.      a file group identifier, e.g. *.*, *.LSP, etc. (Needs PRL.)
  906.  
  907. (DIRF F)            Print a library file directory     EXPR/UTILITY*
  908.     Argument Types: file name
  909.     Value:          ()
  910.     Description:     Prints the names of the entries on the specified 
  911.      iLISP library file, in a columnar format. (Needs PRL.)
  912.  
  913. (DIRIO n)           CP/M Direct Console i/o       SUBR
  914.     Argument Types: (n) - an integer between 0 and 255, or NIL (optional) 
  915.     Value:  1) If no argument was provided, DIRIO returns an
  916.                an integer representing the ASCII value of the
  917.                next character typed on the console.
  918.             2) If the argument was an integer, DIRIO transmits
  919.                that integer directly to the console, using the CP/M
  920.                DIRIO function, and returns the number as its value.
  921.             3) If the argument was NIL, DIRIO returns a T if there
  922.                is a character available from the console, else ().
  923.     Side Effects:   Receives or transmits a character from or to the 
  924.      console
  925.     Description:    direct console i/o using CP/M BDOS function 6.
  926.     Special Note:   You should be familiar with this CP/M function 
  927.      before using DIRIO. Input performed using (DIRIO) is done without 
  928.      recognition of any special characters and without echoing to the 
  929.      console. Furthermore, if you use option (2) to transmit bytes to 
  930.      the console, you will find that CP/M ignores the values 255 and 
  931.      254.
  932.  
  933.      If the keyboard interrupt functions are enabled, (and they 
  934.      usually are) a call to (DIRIO ()) will always return () because 
  935.      iLISP is regularly inspecting the keyboard for interrupt 
  936.      characters. Consult Chapter 2 for information on disabling the 
  937.      keyboard interrupts.
  938.  
  939. (DISK X)            Get/Set New Default Disk      SUBR
  940.     Argument Types: X - a literal atom, optional
  941.     Value:          The current default disk name
  942.     Side Effects:   Changes the current default disk
  943.     Description:   A system function which sets the current default 
  944.      disk to x: where x is the first character of X. (DISK) returns 
  945.      the current disk.
  946.  
  947. (DO I J FN AFN R)   Apply FN over a List of Numbers    EXPR/UTILITY*
  948.     Argument Types: I   - starting number
  949.                     J   - final number
  950.                     FN  - function of 1 numeric argument
  951.                     AFN - function of two arguments
  952.                     R   - no restrictions
  953.     Description:    applies FN to all integers X, I <= X <= J, in 
  954.      order, and accumulates the results to R using AFN. 
  955.     Value:          Final value of R
  956.  
  957. (DREVERSE L)        Reverse the Elements of L     SUBR
  958.     Argument Types: L - a LIST
  959.     Value:          L, with the elements in reverse order.
  960.     Side Effects:   Actually modifies the argument L
  961.     Description:    Destructive; actually performs RPLACDs on L's own 
  962.      list elements to produce a new list with the elements in the 
  963.      reverse order from L's. 
  964.  
  965.      NOTICE that the pointer which was the argument to L originally 
  966.      pointed to the first node in L, but now points to the last node.
  967.  
  968. (DSKRES)            Reset the Disk System         SUBR
  969.     Value:          ()
  970.     Side Effects:   Changes  current default disk,  resets  CP/M 
  971.                     disk i/o system.
  972.     Description:   Uses the CP/M DSKRES call to reset the disk  system 
  973.      and set the current disk to A:. Used when you need to change a 
  974.      disk without rebooting the system. Can't be called when files are 
  975.      open.
  976.  
  977. (DSUBST X Y Z)      Substitute X for Y in Z       EXPR/AUX
  978.     Argument Types: X, Y, Z - no restrictions
  979.     Value:          Z, with X replacing every occurence of Y in it
  980.     Side Effects:   Actually modifies Z.
  981.     Description:    DSUBST of course uses EQUAL to find occurences of 
  982.      Y in Z and uses RPLACA and RPLACD to change them.
  983.  
  984. (EDIT X)          Invoke the list editor on a value  MACRO/EDIT
  985.     Argument Types: X - a literal atom
  986.         Value:          X
  987.     Side Effects:   Invokes the list editing program
  988.     Description:     Invokes the editor on a copy of (DEFEXP X),           
  989.      an expression which will define X. Since this is a macro, the 
  990.      result is given to EVAL so the atom will be redefined once 
  991.      editing is complete.
  992.  
  993. (EDITL L)             Invoke the list editor on a list EXPR/EDIT
  994.     Argument Types:   L - a list
  995.     Value:            L, modified by the editor
  996.     Description:       Invokes the list editor on a copy of L.
  997.  
  998. (ERASE file)        Delete a File From The Directory.  SUBR
  999.     Argument Types: File - a literal atom
  1000.     Value:          File 
  1001.     Side Effects:   ERASES A FILE FROM THE DISK
  1002.     Description:    Just calls CP/M. However, iLISP won't let you 
  1003.      erase an OPEN file or a Read Only ($R/O) file. 
  1004.  
  1005. (ERR N)             Cause Recoverable Error N     SUBR          
  1006.     Argument Types: N - a number
  1007.     Side Effects:   Invokes error processing 
  1008.     Description:     Causes an ERROR number N. Useful for extending 
  1009.      the types of errors recognized by iLISP.
  1010.  
  1011. (EQ X1 X2)          Test for Pointer Equality     SUBR
  1012.     Argument Types: X1, X2 - no restrictions
  1013.     Value:          T   - if X1 is the same pointer as X2
  1014.                     ()  - otherwise
  1015.  
  1016. (EQUAL X Y)         Test for Equality             SUBR
  1017.     Argument Types: X, Y - no restrictions
  1018.     Value:          T  - if X and Y have equivalent structure or value
  1019.                     () - otherwise
  1020.  
  1021. (EVAL X)            Evaluate X                    SUBR
  1022.     Argument Types: no restrictions
  1023.     Value:          Value of X
  1024.     Side Effects:   None in particular, but X can be ANY LISP 
  1025.           expression, including side affecting ones.
  1026.     Description:    There is an OPTIONAL additional argument:
  1027.  
  1028.       (EVAL X)        X evaluated in the global environment.
  1029.       (EVAL X T)      X evaluated in the local  environment.
  1030.  
  1031.      EVAL is the real GOTO of LISP. Avoid using it.
  1032.  
  1033. (EXIT)              Exit LISP                     SUBR
  1034.     Side Effects:   EXITS iLISP. Prints a list of all open files.
  1035.     Description:    Calls CP/M function 0. Performs a system reset and 
  1036.      warm boot. EXIT closes all open files before EXITing.
  1037.  
  1038. (FILDIR filegroup)  Get the Disk Directory        SUBR
  1039.     Argument Types: Filename a literal atom
  1040.     Value:           A list of file names.
  1041.     Description:    This provides a DIR type function from within 
  1042.      iLISP as well as giving you a way of telling whether an OPEN 
  1043.      operation will succeed. If (FILDIR F) returns (F) then the file 
  1044.      already exists  and it can't be opened for writing. If (FILDIR F) 
  1045.      returns (), then the file doesn't exist and can't be opened for 
  1046.      reading.  Both the "?" and "*" characters perform just a they do 
  1047.      in CP/M's DIR command.
  1048.  
  1049. (FILLBUF)           Read Next Line of INPUT       SUBR
  1050.     Value:          ()
  1051.     Side Effects:   May cause a read request at the console; 
  1052.           skips input file pointer over remainder of current 
  1053.           line.
  1054.     Description:     If current input file is not CON:, FILLBUF is the 
  1055.      same as CLEARBUF. For CON:, FILLBUF performs a CP/M RDLINE 
  1056.      function, i.e. it reads a line from the console, and stores it in 
  1057.      an internal buffer, but the line isn't processed until some other 
  1058.      input function is called (e.g. READ).
  1059.  
  1060.      This function provides a convenient way to recognize a user's 
  1061.      typing of an empty line: if you call (READ), READ will keep after 
  1062.      the user until a valid data object is typed. If you call (READP), 
  1063.      the user won't be prompted if the current line is empty. But, if 
  1064.      you first call (FILLBUF) and then (READP), if READP returns (), 
  1065.      you can assume that the user simply typed a carriage return to 
  1066.      LISP's prompt. 
  1067.  
  1068. (FIT X)             Will X fit?                   EXPR/PP
  1069.     Argument Types: X - any data object
  1070.     Value:          T or ()
  1071.     Description:    Returns T if X will fit on the remainder of the 
  1072.      current line (when printed with PRIN1). Used by PPRIN2.
  1073.  
  1074. (FIX N)             Convert Floating Point to Integer SUBR
  1075.     Argument Types: N - a number
  1076.     Value:          Integer 
  1077.     Description:    Truncates the fractional part of N (if any). 
  1078.  
  1079. (FLOAT N)           Convert Integer to Floating Point SUBR
  1080.     Argument Types: N - a number
  1081.     Value:          A floating point number equal to N
  1082.  
  1083. (FREE)              number of FREE spaces nodes remaining SUBR
  1084.     Value:          A count of the remaining free nodes
  1085.     Description:    Returns a count of the number of nodes 
  1086.           remaining in the space allocated to FREE memory. This 
  1087.           value is the number of list nodes that can be allocated 
  1088.           before the next garbage collection occurs.
  1089.  
  1090. (FULL)              number of FULL space bytes remaining  SUBR
  1091.     Value:          A count of the remaining FULL space bytes
  1092.     Description:    Returns a count of the bytes in the space 
  1093.           allocated to FULL memory. This is the number of bytes 
  1094.           that can be allocated to print names and file buffers 
  1095.           before the next garbage collection occurs.
  1096.  
  1097. (GETPL X)           Get the Property List of X    SUBR
  1098.     Argument Types: X - a literal atom
  1099.     Value:          The property list of X.
  1100.     Description:    Just returns the associated list.
  1101.  
  1102. (GETPROP A P)       Get Property                  SUBR
  1103.     Argument Types: A - literal atom
  1104.                     P - no restrictions
  1105.     Value:          Value associated with P in (GETPL A)  OR  ().
  1106.     Description:    Performs a LISTGET on the property list of A.
  1107.                     Equivalent to:       (LISTGET (GETPL A) P)
  1108.  
  1109. (GFP file)          Return Current File Position  SUBR  
  1110.     Argument Types: file - a literal atom
  1111.     Value:          An integer, the value of file's pointer.
  1112.     Description:     The file pointer is the position, relative to the 
  1113.      beginning of the file, of the byte at which the next input or 
  1114.      output operation on file will begin.
  1115.  
  1116. (ID X)              Identity Function             SUBR
  1117.     Argument Types: X - no restrictions
  1118.     Value:          X
  1119.     Description:    This is not QUOTE. ID is a genuine function. Its 
  1120.      argument IS evaluated before it is passed to ID. ID just gives it 
  1121.      back. Its primary usage is as an argument to one of the MAP 
  1122.      functions.
  1123.  
  1124. (INB)               Read one Byte                 SUBR
  1125.     Value:          An integer or (), see below
  1126.     Side Effects:   Advances input file pointer
  1127.     Description:    Reads one byte from the primary input file and 
  1128.      returns it as an integer between 0 and 255. If the end of file is 
  1129.      encountered, INB returns (). INB only recognizes a CP/M physical 
  1130.      end of file as the end of file indicator; control-Z is returned 
  1131.      as 26. For more information regarding the processing of the end 
  1132.      of file indicators, consult the i/o section of the manual.
  1133.  
  1134. (INPUT file)        Get/Set Primary Input File    SUBR
  1135.     Argument Types: file - a literal atom, optional
  1136.     Value:          The old or current primary input file
  1137.     Side Effects:   Changes currently selected input file
  1138.     Description:    A system function used to set or query the current 
  1139.      primary input file. The file must have been previously opened for 
  1140.      input or update operations. (INPUT) returns the current primary 
  1141.      input file.
  1142.  
  1143. (IOBYTE n)          Get/Set the CP/M IOBYTE       SUBR
  1144.     Argument Types: N - an integer, optional
  1145.     Value:          The old or current value of IOBYTE
  1146.     Side Effects:   May change the IOBYTE
  1147.     Description:    A system function which sets the CP/M IOBYTE to 
  1148.      the byte n. Returns the old value of the IOBYTE. (IOBYTE) returns 
  1149.      the current value. The function of the IOBYTE is described in the 
  1150.      CP/M reference manual.
  1151.  
  1152. (LAST L)            Get the Last Node in L        SUBR
  1153.     Argument Types: L - a non NIL list
  1154.     Value:          The last node in L.
  1155.     Description:    The value is NOT the last element, but the last 
  1156.      NODE. (LAST L) actually performs: (CDRS L (SUB1 (LENGTH L))).
  1157.  
  1158. (LENGTH L)          Measure The Length of a List  SUBR
  1159.     Argument Types: L - a list
  1160.     Value:          integer, number of elements in L
  1161.  
  1162. (LINELENGTH N)      Get/Set Line Length           SUBR
  1163.     Argument Types: N - integer, optional
  1164.     Value:          Old or current value of LINELENGTH
  1165.     Side Effects:   Changes current LINELENGTH
  1166.     Description:   A system function which sets or queries iLISP's 
  1167.      value for the line length of the current output file. A line 
  1168.      length of zero signifies an indefinitely long line. iLISP issues 
  1169.      automatic TERPRIs at the end of each line, being careful not to 
  1170.      split atoms across line boundaries.
  1171.  
  1172.  (LIST X1 X2 X3 ... )Build a List                  SUBR
  1173.     Argument Types: No Restrictions, indefinite number
  1174.     Value:          A list whose elements are X1, X2, ...
  1175.     Description:    Just returns its argument list. Its actual 
  1176.      definition is equivalent to: (LAMBDA FORM FORM). Useful for 
  1177.      building new lists.
  1178.  
  1179. (LISTGET L P)       Retrieve a Property from a Property List SUBR
  1180.     Argument Types: L - a property list
  1181.                     P - no restrictions
  1182.     Value:          Either the value associated with P in L or NIL
  1183.     Description:    Treats L as a property list and searches for a 
  1184.      property P on L; returns associated value (V) or NIL if P not 
  1185.      found.
  1186.  
  1187. (LISTP X)           Test for List                 SUBR
  1188.     Argument Types: X - no restrictions
  1189.     Value:          X  - if X is a list
  1190.                     () - otherwise
  1191.     Description:     Notice that LISTP returns X itself if it is a 
  1192.      list, not the atom T. This means that (LISTP ()) is (), EVEN 
  1193.      THOUGH () IS A LIST. To spot () you must use NULL. This was a 
  1194.      deliberate decision because there are many occasions when a list 
  1195.      is wanted that () will not do (e.g. RPLACA).
  1196.  
  1197. (LISTPUT L P V)     Put Property P on L with Value V  SUBR
  1198.     Argument Types: L - a property list
  1199.                     P - no restrictions
  1200.                     V - no restrictions
  1201.     Value:          L
  1202.     Side Effects:   Changes the list L.
  1203.     Description:    Treats L as a property list and adds the property 
  1204.      P with associated value V.
  1205.  
  1206. (LISTREM L P)       Remove all Properties P from L  SUBR
  1207.     Argument Types: L - a property list
  1208.                     P - no restrictions
  1209.     Value:          L
  1210.     Side Effects:   Changes the list L
  1211.     Description:     Treats L as a property list and destructively 
  1212.      removes all occurrences of P (and associated values) from it.
  1213.  
  1214. (LITATOM X)         Test for Literal Atom         SUBR
  1215.     Argument Types: X - no restrictions
  1216.     Value:          X  - if X is a literal atom
  1217.                     () - otherwise
  1218.     Description:    Notice that LITATOM returns X itself, not T.
  1219.  
  1220. (MACROP X Y)        Get/Set the Macro Bit of Atom X  SUBR
  1221.     Argument Types: X - a literal atom
  1222.                     Y - optional, T or ()
  1223.     Value:          T/NIL representing current state of X's macro 
  1224.           status
  1225.     Side Effects:   With optional argument, MACROP changes X's 
  1226.           MACRO status.
  1227.     Description:     If only one argument is provided, MACROP returns 
  1228.      T or NIL depending on whether X is or is not an iLISP MACRO. If 
  1229.      two arguments are provided, MACROP either makes X a MACRO or 
  1230.      makes it not a MACRO, depending on whether Y is T or NIL. Its 
  1231.      value however reflects Xs status before the change was performed. 
  1232.      Special Note:    Setting an atom's macro status WILL NOT save it 
  1233.      from the garbage collector if it doesn't have a value.
  1234.  
  1235. (MAP FN L AFN R)    Map A Function Over a List    SUBR
  1236.     Argument Types: FN - a function of one argument
  1237.                     L  - a list
  1238.                     AFN- a function of two arguments
  1239.                     R  - no restrictions
  1240.     Description:    Applies the function FN to successive           
  1241.      elements of L accumulates the results of the application to R 
  1242.      using the function AFN. I.e. repeatedly performs
  1243.               R <- (AFN (FN (CAR L)) R)
  1244.               L <- (CDR L)
  1245.           UNTIL L = ().
  1246.     Value:          Final value of R.
  1247.  
  1248. (MAPCONS FN L)      MAP, accumulate results with CONS  EXPR/MAP
  1249.     Argument Types: FN - a function of one argument
  1250.                     L - a list of arguments for FN
  1251.     Description:   Applies FN to elements of L, and CONSes the results 
  1252.      to ().
  1253.     Value:          The result of all the CONSing.
  1254.  
  1255. (MAPCONSN FN L)     MAPCONS, but forget NILs      EXPR/MAP
  1256.     Argument Types: FN - a function of one argument
  1257.                     L  - a list of arguments for FN
  1258.     Description:    Applies FN to elements of L, and CONSes the 
  1259.      results to (), unless the result is NIL.
  1260.     Value:          The result of all the CONSing.
  1261.  
  1262. (MAPNCONC FN L)     MAP, accumulate results with NCONC  EXPR/MAP
  1263.     Argument Types: FN - a function of one argument
  1264.                     L  - a list of arguments for FN
  1265.     Description:    Applies FN to elements of L, and NCONCs the 
  1266.      results to (). Similar to MAPCONS, except that NCONC won't work 
  1267.      with atoms, eliminates () and concatenates lists into one big 
  1268.      list.
  1269.     Value:          The result of all the NCONCing
  1270.  
  1271. (MAPNIL FN L)       MAP, forget the results       EXPR/MAP
  1272.     Argument Types: FN - a function of one argument
  1273.                     L - a list of arguments for FN
  1274.     Side Effects:   None, BUT, presumably the FN itself has a side
  1275.                     effect, else why use MAPNIL?
  1276.     Description:    Applies FN to elements of L, forget the results.
  1277.     Value:          ()
  1278.  
  1279. (MAPTCONC FN L)     MAP, accumulate the results with TCONC  EXPR/MAP
  1280.     Argument Types: FN - a function of one argument
  1281.                     L - a list of arguments for FN
  1282.     Description:    Applies FN to elements of L, and TCONC the results 
  1283.      to (). Really just like MAPCONS except that the elements in the 
  1284.      result list are in the same order as the elements in L, not the 
  1285.      reverse.
  1286.     Value:          The CAR of the result of the TCONCing
  1287.  
  1288. (MARGIN N)          Get/Set Left Margin           SUBR
  1289.     Argument Types: N - number, optional
  1290.     Value:          Old or current value of MARGIN
  1291.     Side Effects:   Changes current MARGIN
  1292.     Description:   A system function which sets or queries the current 
  1293.      left margin, which is simply the number of spaces printed after 
  1294.      each TERPRI.
  1295.  
  1296. (MEMB X L)          Simple Test For Membership    SUBR
  1297.     Argument Types: X - no restrictions
  1298.                     L - a list
  1299.     Value:          The tail of L which begins with X,  or NIL.
  1300.     Description:    Uses EQ to compare X with the elements of L. 
  1301.  
  1302. (MEMBER X L)        Test for Membership           SUBR
  1303.     Argument Types: X - no restrictions
  1304.                     L - a list
  1305.     Value:          The tail of L which begins with X, or NIL.
  1306.     Description:    Uses EQUAL instead of EQ
  1307.  
  1308. (MEMORY free full)  Get/Set Memory Allocation     SUBR
  1309.     Argument Types: free, full - both numbers (optional)
  1310.     Value:          A list of four numbers (see description)
  1311.     Side Effects:   May allocate memory to free or full space
  1312.     Description:    If the two arguments are provided, they are 
  1313.      interpreted as the number of unallocated pages to give to each of 
  1314.      FREE space and FULL space. Regardless of whether the arguments 
  1315.      are provided, the value of MEMORY is a list of four numbers:
  1316.      1) The number of pages currently allocated to free space
  1317.      2) The number of pages currently allocated to full space
  1318.      3) The number of pages currently unallocated
  1319.      4) The address of the highest allocated element in full space.
  1320.         (Useful if you want to save the binary image of iLISP.)
  1321.  
  1322. (MINUS N)           Negate N                      SUBR
  1323.     Argument Types: N - a number
  1324.     Value:          N * -1
  1325.  
  1326. (NCHARS X)          Count the Characters in X     SUBR
  1327.     Argument Types: X - no restrictions
  1328.     Value:          Integer, count of characters in X's PRIN1 
  1329.           print image.
  1330.     Description:    This can be a time consuming function. 
  1331.  
  1332. (NCONC L1 L2)       Concatenate Two Lists         SUBR
  1333.     Argument Types: L1, L2 - both lists
  1334.     Value:          L1 with L2 attached to the end.
  1335.     Side Effects:   Modifies argument L1
  1336.     Description:     This is a destructive function and should be used 
  1337.      with caution since it is possible to create a circular list 
  1338.      structure with it. It actually changes L1 by performing (RPLACD 
  1339.      (LAST L1) L2).    
  1340.  
  1341. (NodeCount L)       Count the Nodes in a List     EXPR/UTILITY*
  1342.     Argument Types: L - a list
  1343.     Value:          integer
  1344.     Description:    Counts the total number of list nodes in a list, 
  1345.      including all sublists. NodeCount contains a built in DESCRIBE 
  1346.      call so that it can be called directly on user defined functions. 
  1347.  
  1348. (NTH L N)           Select The Nth Element of L   SUBR
  1349.     Argument Types: L - a list
  1350.                     N - an integer, 0 < N <= (LENGTH L)
  1351.     Value:          The Nth element of L.
  1352.  
  1353. (NULL X)            Test for NIL Pointer          SUBR
  1354.     Argument Types: X - no restrictions
  1355.     Value:          T - if X = (), 
  1356.                     () - otherwise
  1357.  
  1358. (NUMBERP X)         Test for Number               SUBR
  1359.     Argument Types: X - no restrictions
  1360.     Value:          X  - if X is a number
  1361.                     () - otherwise
  1362.     Description:    Notice that NUMBERP returns X itself, not T.
  1363.  
  1364. (OPEN file flag)    Open/Create a Disk File       SUBR
  1365.     Argument Types: file - name of file or logical device
  1366.                     flag - {R, W or U} (for read, write, or 
  1367.           update i/o).
  1368.     Value:          The complete file name of file
  1369.     Side Effects:   May create a file. CP/M opens the file.
  1370.     Description:    Opens the file for the specified type of 
  1371.      operation. Different restrictions apply to different types of 
  1372.      opening:
  1373.           READ -  the file must already exist. 
  1374.           WRITE - the file must NOT exist. This is how you create 
  1375.           new files.
  1376.           UPDATE- if the file exists, it will be used. If not, it 
  1377.           will be created. Logical devices are always open.
  1378.  
  1379. (OPENP file)        Test for Open File            SUBR
  1380.     Argument Types: (file) - a literal atom, optional
  1381.     Value:          R - if file is open for input
  1382.                     W - if file is open for output
  1383.                     U - if file is open for updating
  1384.                     T - if file is a logical device
  1385.                     () - if file is not open
  1386.                     OR: a list of all open files, if file is not 
  1387.           provided
  1388.     Description:    Useful for determining which files are currently 
  1389.      open. 
  1390.  
  1391. (OUTB n)            Output One Byte               SUBR
  1392.     Argument Types: N - an integer between 0 and 255
  1393.     Value:          n
  1394.     Side Effects:   Advances output file pointer
  1395.     Description:    Sends the byte N to the primary output file.
  1396.  
  1397. (OUTPUT file)       Get/Set Primary Output File   SUBR
  1398.     Argument Types: file - a literal atom, optional
  1399.     Value:          The old or current primary output file
  1400.     Side Effects:   Changes currently selected output file
  1401.     Description:    A system function used to set or query the current 
  1402.      primary output file. The file must have been previously opened 
  1403.      for output or update operation. (OUTPUT) returns the current 
  1404.      primary output file.
  1405.  
  1406. (PACK L)            Pack a List of Characters to an Atom  SUBR
  1407.     Argument Types: L - a list of literal atoms or numbers
  1408.     Value:          A new literal atom
  1409.     Description:     Builds a new literal atom out of the elements of 
  1410.      L. Literal atoms contribute their first characters; numbers 
  1411.      contribute  their ASCII equivalents.
  1412.  
  1413. (PEEKC)             Peek at One Character         SUBR
  1414.     Value:          Next character on current input file.
  1415.     Description:    Same as READC, but does not advance the file's 
  1416.      pointer, i.e. successive calls to PEEKC without intervening reads 
  1417.      will return the same character. When the primary input file is 
  1418.      the terminal PEEKC will return () if there are no more characters 
  1419.      in the line buffer. It will not cause a new line to be read.
  1420.      PEEKC recognizes either control-Z or a physical end of file as 
  1421.      the end of file indicator.
  1422.  
  1423. (POSITION N)        Get/Set Current Output Column SUBR
  1424.     Argument Types: N - a number, optional
  1425.     Value:          Old or current value of position.
  1426.     Side Effects:   Changes current POSITION variable
  1427.     Description:   A system function used to set or query iLISP's 
  1428.      column position indicator. It returns the current column position 
  1429.      of the current output file. Setting this to a value DOES NOT 
  1430.      actually perform any output. It only adjusts iLISP's current 
  1431.      knowledge of where the output device's cursor is. iLISP will 
  1432.      correctly keep track of spaces, printing characters, tabs and the 
  1433.      carriage return/line feed. But other non printing characters 
  1434.      affect different terminals in different ways. Both CURSOR and CS 
  1435.      keep POSITION up to date, but other uses of special characters on 
  1436.      your terminal may necessitate your using POSITION.
  1437.  
  1438. (PP X)              Pretty-Print X                EXPR/PP
  1439.     Argument Types: X - no restrictions
  1440.     Value:          ()
  1441.     Side Effects:   Advances output file pointer
  1442.     Description:    Performs (PPRIN2 X) followed by a TERPRI.
  1443.  
  1444. (PPRIN2 X)          Pretty-Prin X                 EXPR/PP
  1445.     Argument Types: X - no restrictions
  1446.     Value:          X
  1447.     Side Effects:   Advances output file pointer
  1448.     Description:    Similar to PRIN2 in that it prints the expressions 
  1449.      X on the primary output file, with the escape character "%" 
  1450.      inserted where needed for X to be properly read back in by READ. 
  1451.      HOWEVER: Lists are printed in a more readable fashion than with 
  1452.      the ordinary PRIN2. Indentation is used to show the structure of 
  1453.      lists embedded within lists.
  1454.  
  1455. (PRINT X)           Print X                       SUBR
  1456.     Argument Types: X - no restrictions
  1457.     Value:          X
  1458.     Side Effects:   Advances output file pointer
  1459.     Description:    PRIN2 followed by TERPRI.
  1460.  
  1461. (PRINTD N)          Print a number in a monetary format  EXPR/UTILITY*
  1462.     Argument Types: N - an integer
  1463.     Value:          NIL
  1464.     Description:    N is printed with a leading dollar sign and a 
  1465.      decimal point inserted before the penultimate digit.
  1466.  
  1467. (PRINTLEVEL N)      Get/Set Printlevel            SUBR
  1468.     Argument Types: N - number, optional
  1469.     Value:          Old or current value of PRINTLEVEL
  1470.     Side Effects:   Changes current printlevel
  1471.     Description:   A system function used to set or query iLISP's 
  1472.      PRINTLEVEL byte which controls the depth to which lists are 
  1473.      printed on the console. The printlevel is the number of levels 
  1474.      deep the PRINT routine will print lists on the console before 
  1475.      substituting an &. All output that is not directed to the console 
  1476.      is printed completely, without the PRINTLEVEL restriction.
  1477.  
  1478. (PRINT@ X Y Z)      Print After Positioning       EXPR/AUX
  1479.     Argument Types: X, Y - numbers (optional)
  1480.                     Z    - no restrictions
  1481.     Value:          Z
  1482.     Side Effects:   Moves current output file pointer.
  1483.     Description:    Prints the S-expression Z on the primary output 
  1484.      file, using PRIN2, followed by an end-of-line. The numbers X and 
  1485.      Y are interpreted as follows:
  1486.  
  1487.     IF output file is the console       ; (EQ 'CON: (INPUT))
  1488.     THEN    Move screen cursor to X,Y   ; (CURSOR X Y)
  1489.     ELSE    Position the file to byte X ; (SFP (INPUT) X) [Y missing.]
  1490.  
  1491. (PRIN1 X)           Print X                       SUBR
  1492.     Argument Types: X - no restrictions
  1493.     Value:          X
  1494.     Side Effects:   Advances output file pointer
  1495.     Description:    Prints the expression X on the primary output 
  1496.      file. Literal atoms with odd characters in their print names are 
  1497.      printed without the '%' necessary to read them back in.
  1498.  
  1499. (PRIN2 X)           Print X                       SUBR
  1500.     Argument Types: X - no restrictions
  1501.     Value:          X
  1502.     Side Effects:   Advances output file pointer
  1503.     Description:     Prints the S-expression X on the primary output 
  1504.      file with the escape character "%" inserted where needed for X to 
  1505.      be properly read back in by READ. 
  1506.  
  1507. (PRL L)             Print the Elements of a List  EXPR/UTILITY*
  1508.     Argument Types: L - a list
  1509.     Value:          ()
  1510.     Description:     PRL prints the individual elements of the list L, 
  1511.      each followed by a TAB character for separation. It is used by 
  1512.      functions such as DIR and DIRF for presenting atoms in a columnar 
  1513.      format.
  1514.  
  1515. (PROCP X)           Test for Procedure            SUBR
  1516.     Argument Types: X - no restrictions
  1517.     Value:          X  - if X is a procedure
  1518.                     () - otherwise
  1519.     Description:    PROCP returns X itself if X is a procedure; not T.
  1520.  
  1521. (PROG1 X1 X2)       Evaluate Two Forms            SUBR
  1522.     Argument Types: X1, X2 - No Restrictions
  1523.     Value:          X1.
  1524.     Description:    Similar to ID; it just returns its first argument. 
  1525.      Primary use is as a control structure which is  useful when you 
  1526.      need to perform some side effect (e.g. a SETQ or a file CLOSE) 
  1527.      AFTER calculating the value of an expression.
  1528.  
  1529. (PROMPT X)          Get/Set Prompt Character      SUBR
  1530.     Argument Types: X - a number, optional
  1531.     Value:          ASCII value of old or current prompt character
  1532.     Side Effects:   Modifies current PROMPT character
  1533.     Description:    X is the ASCII value of the character used to 
  1534.      prompt the user at the console at the beginning of each line, AT 
  1535.      THE BEGINNING OF EACH READ. (PROMPT) returns the current prompt.
  1536.  
  1537. (PROMPT1 X)         Get/Set Extended Prompt Character  SUBR
  1538.     Argument Types: X - number, optional
  1539.     Value:          ASCII value of old or current PROMPT1 character
  1540.     Side Effects:   Modifies current PROMPT1 character
  1541.     Description:    X is the ASCII value of the character used to 
  1542.      prompt the user at the console at the beginning of each line, 
  1543.      WHEN IN THE MIDDLE OF A READ. (PROMPT1) just returns the ASCII 
  1544.      value of the current prompt character.
  1545.  
  1546. (PUTPROP A P V)     Put property/value on A's property list  SUBR
  1547.     Argument Types: A - a literal atom
  1548.                     P, V - no restrictions
  1549.     Value:          V
  1550.     Side Effects:   Changes the property list of A
  1551.     Description:    Performs a LISTPUT on the property list of A.
  1552.  
  1553. (RANDINT N)         Generate a Random Integer     EXPR/UTILITY*
  1554.     Argument Types: N - an integer
  1555.     Value:          a random non negative integer less than N
  1556.  
  1557. (RANDOM X)          Generate a Random Number      SUBR
  1558.     Argument Types: X - a number or (), optional
  1559.     Value:          A floating point number X, 0 < X < 1
  1560.     Side Effects:   Modifies RANDOM's internal seed for next call
  1561.     Description:     Usually called with no argument. RANDOM just 
  1562.      calculates the next element in a pseudo random sequence.
  1563.      When a number is provided as an argument, RANDOM uses it as a 
  1564.      seed to start a new sequence. Any number will do: small or large, 
  1565.      floating point or integer. 
  1566.      When the value of the argument is (), RANDOM generates a new seed 
  1567.      itself, "at random". This is the same as what is called RANDOMIZE 
  1568.      in some BASICs.
  1569.  
  1570. (RDSTR X)           Read a String                 SUBR
  1571.     Argument Types: X - a number
  1572.     Value:          Next atom in current input file 
  1573.     Side Effects:   Advances input file pointer
  1574.     Description:     Reads a literal atom which consists of all the 
  1575.      characters on INPUT up to the next character whose ASCII code is 
  1576.      X. If no characters intervene, () is returned. RDSTR recognizes 
  1577.      either control-Z or a physical end of file as the end of file 
  1578.      indicator.
  1579.  
  1580. (READ)              Read an S-expression          SUBR
  1581.     Value:          Next expression on current input file.
  1582.     Side Effects:   Advances input file pointer past next expression
  1583.     Description:    Reads and returns an expression from the primary 
  1584.      input file. Recognizes either control-Z or a physical end of file 
  1585.      as the end of file indicator.
  1586.  
  1587. (READC)             Read A Character              SUBR
  1588.     Value:          Next character on current input file.
  1589.     Side Effects:   Advances input file pointer
  1590.     Description:     Reads one character from the primary input file. 
  1591.      Returns it as an atom with a single character print name. READC 
  1592.      recognizes either control-Z or a physical end of file as the end 
  1593.      of file indicator.
  1594.  
  1595. (READLINE)          Read a Line                   EXPR/AUX
  1596.     Value:          A list of elements in (INPUT)'s line buffer
  1597.     Side Effects:   Advances the input file's pointer
  1598.     Description:   Reads the elements on the current line of input and 
  1599.      returns a list of them. If there is nothing available, READLINE 
  1600.      returns ().
  1601.  
  1602. (READP)             Test For More to Read         SUBR
  1603.     Value:          T  - if there is anything useful left 
  1604.                          to READ from the current input file
  1605.                     () - otherwise
  1606.     Side Effects:   May advance input file pointer
  1607.     Description:     READP skips over the next sequence of delimiters; 
  1608.      It actually advances the file pointer. If it encounters a non 
  1609.      delimiter before the end of file it returns T, otherwise (). 
  1610.      If the current input file is the console, READP advances only to 
  1611.      the end of the current line; it won't perform a (FILLBUF).
  1612.      While READP is useful for deciding whether it is safe to READ, it 
  1613.      can be misled. For example, if the last character in a file is a 
  1614.      macro character which calls READ (e.g. any of ', ", $ or ;) or a 
  1615.      left parenthesis, READP will return T even though performing a 
  1616.      READ will cause an end of file error. 
  1617.      READP recognizes either control-Z or a physical end of file as 
  1618.      the end of file indicator.
  1619.  
  1620. (READ@ X Y)         READ after Positioning        EXPR/AUX
  1621.     Argument Types: X, Y - numbers, optional
  1622.     Value:          Expression read from current input file
  1623.     Side Effects:   Repositions either the cursor or file pointer 
  1624.     Description:    Reads and returns one S-expression from the 
  1625.      primary input file, using READ. The numbers X and Y are 
  1626.      interpreted thus:
  1627.  
  1628.       IF input file is the console        ; (EQ 'CON: (INPUT))
  1629.       THEN    Move screen cursor to X,Y   ; (CURSOR X Y)
  1630.       ELSE    Position the file to byte X ; (SFP (INPUT) X)
  1631.       (READ)
  1632.  
  1633.      This is useful both for reading from files and for reading 
  1634.      from  particular places on the screen.
  1635.  
  1636. (RECLAIM)           Do a Garbage Collection       SUBR
  1637.     Value:          ()
  1638.     Side Effects:   Causes a garbage collection
  1639.  
  1640. (REM N1 N2)         Divide Two Numbers, Return Remainder  SUBR
  1641.     Argument Types: N1, N2 - numbers
  1642.     Value:          A number equal to N1 REM N2
  1643.     Description:     Floats the computation if either argument is 
  1644.      floating point. The remainder operation on floating point numbers 
  1645.      is:
  1646.                 (REM N1 N2) = N1 - ROUND(N1/N2)*N2
  1647.  
  1648.      ROUND will round to the nearest integer. This is not quite 
  1649.      the same as MOD (not provided) which truncates N1/N2 instead 
  1650.      of rounding.
  1651.  
  1652.      For integers, REM is just like MOD.
  1653.  
  1654. (REMPROP A P)       Remove P from Property List of A  SUBR
  1655.     Argument Types: A - a literal atom
  1656.                     P - no restrictions
  1657.     Value:          ()
  1658.     Side Effects:   Changes the property list of A
  1659.     Description:     Performs a LISTREM on the property list of A. It 
  1660.  
  1661. (RENAME new old)   Rename a Disk File            SUBR
  1662.     Argument Types: new, old - both literal atoms
  1663.     Value:          New if successful, NIL otherwise.
  1664.     Side Effects:   Actually changes the file's name
  1665.     Description:     Just calls CP/M. However, iLISP won't let you 
  1666.      RENAME an open file or a read-only (i.e. CP/M $R/O) file.
  1667.  
  1668. (REPEAT N exp)      A simple control macro        EXPR/UTILITY*
  1669.     Argument Types: N - an integer
  1670.                     exp - an expression to be evaluated
  1671.     Value:          NIL
  1672.     Description:    REPEAT is a MACRO. Its meaning is: 
  1673.                          EVALUATE the expression N times. 
  1674.  
  1675. (REPLACEL X L N)    Replace an Element of a List  EXPR/UTILITY*
  1676.     Argument Types: X - the new element 
  1677.                     L - the list to be changed 
  1678.                     N - the position of the element to be replaced 
  1679.     Description:    Replaces the Nth element of the list L with the 
  1680.      new element X (using RPLACA). 
  1681.  
  1682. (RESET)             Abort Computation             SUBR
  1683.     Value:          Doesn't matter
  1684.     Side Effects:   Aborts current computation
  1685.     Description:    Forces a return to iLISP's top level evaluator.
  1686.           Both INPUT and OUTPUT are reset to CON:. 
  1687.  
  1688. (REVERSE L)         Reverse the Elements of L     EXPR/AUX
  1689.     Argument Types: L - a LIST
  1690.     Value:          Copy of L, with element order reversed.
  1691.     Description:    Makes a copy of L and performs DREVERSE on it.
  1692.  
  1693. (RPLACA L X)        Replace CAR of L with X       SUBR
  1694.     Argument Types: L - non NIL list
  1695.                     X - no restrictions
  1696.     Value:          New value of L
  1697.     Side Effects:   Modifies argument L
  1698.     Description:    Replaces the CAR of L with X. This is a 
  1699.      destructive function; it actually changes the list structure of 
  1700.      L. It should be used with caution since it is possible to create 
  1701.      a circular list structure with it.
  1702.  
  1703. (RPLACAD L1 L2)     Replace CAR and CDR of L1     SUBR
  1704.     Argument Types: L1 - non nil list
  1705.                     L2 - non nil list
  1706.     Value:          EQ to L1,  but EQUAL to L2
  1707.     Side Effects:   Modifies argument L1
  1708.     Description:     Replaces both the CAR and CDR of L1 with the CAR 
  1709.      and CDR of L2. This is a destructive function; it actually 
  1710.      changes the list structure of L1. It should be used with caution 
  1711.      since it is possible to create a circular list structure with it.
  1712.  
  1713. (RPLACD L X)        Replace CDR of L with X       SUBR
  1714.     Argument Types: L - non NIL list
  1715.                     X - list
  1716.     Value:          New value of L
  1717.     Side Effects:   Modifies argument L
  1718.     Description:     Replaces the CDR of L with X. This is a 
  1719.      destructive function; it actually changes the list structure of 
  1720.      L. It should be used with caution since it is possible to create 
  1721.      a circular list structure with it.
  1722.  
  1723. (SET X V)           Assign V to X                 SUBR
  1724.     Argument Types: X - a literal atom
  1725.                     V - no restrictions
  1726.     Value:          V
  1727.     Side Effects:   Changes the local value of X
  1728.     Description:     Like the syntactic form SETQ, except that both of 
  1729.      the arguments are evaluated before the SET is performed. That is,
  1730.               (SET 'A 1)
  1731.               (SETQ A 1)
  1732.               (SET' A 1)
  1733.      are all equivalent.
  1734.  
  1735. (SETPL X L)         Set the Property List of an Atom  SUBR
  1736.     Argument Types: X - a literal atom
  1737.                     L - a list
  1738.     Value:          L
  1739.     Side Effects:   Changes the property list of X
  1740.     Description:   Clobbers previous value for (GETPL X); installs new 
  1741.      one.
  1742.  
  1743. (SFP file addr)     Set Current File Position     SUBR
  1744.     Argument Types: file - an open file
  1745.                     addr - an integer
  1746.     Value:          Addr
  1747.     Side Effects:   Moves the file pointer for file
  1748.     Description:    Sets the file pointer for file to addr. 
  1749.     Special Note:       
  1750.      CP/M does not provide an open-for-append function, but if 
  1751.      SFP is given a negative addr it will position the file to 
  1752.      the beginning of the last record in the file. If the file is 
  1753.      a binary file (unusual for LISP) the actual end of file 
  1754.      position is 128 bytes past this point. If the file is an 
  1755.      ASCII file (terminated with a control-Z) you then can 
  1756.      PEEKC/READC your way to the last byte in the file. That is, 
  1757.      repeatedly perform READCs until PEEKC returns (). (Or you 
  1758.      can use INB to look for the control-Z.)
  1759.  
  1760. (SINE N)            Sine N                        SUBR
  1761.     Argument Types: N - a number, an angle in radians
  1762.     Value:          A floating point number equal to the sine of N.
  1763.  
  1764. (SPACES n)          Print N Spaces                SUBR
  1765.     Argument Types: N - an integer
  1766.     Value:          ()
  1767.     Side Effects:   Advances output file pointer
  1768.     Description:    Prints N spaces on the primary output file.
  1769.  
  1770. (SQRT X)            Square Root of X              SUBR
  1771.     Argument Types: X - a positive number
  1772.     Value:          floating point number = square root of X.
  1773.  
  1774. (SUBST X Y Z)       Substitute X for Y in Z       EXPR/AUX
  1775.     Argument Types: X, Y, Z - no restrictions
  1776.     Value:          Copy of Z with X replacing every occurence of 
  1777.           Y in Z.
  1778.  
  1779. (SUBSTRING S F N)   Extract a Substring of a Literal Atom  EXPR/UTILITY*
  1780.     Argument Types: S - a literal atom
  1781.                     F, N - integers
  1782.     Description:     Constructs a new literal atom whose print name is 
  1783.      the substring of the print name of STRING, beginning with the 
  1784.      START character and extending for COUNT characters. E.g. 
  1785.  
  1786. (SUB1 N)            Decrement a Number            SUBR
  1787.     Argument Types: N - a number
  1788.     Value:          A number equal to N-1
  1789.     Description:    (- N 1)
  1790.  
  1791. (SYNTAB X)          Get/Set Entire Character Syntax Table  SUBR
  1792.     Argument Types: X - literal atom, previously returned by 
  1793.           SYNTAB, optional
  1794.     Value:          A literal atom with the current or old value 
  1795.           of the character syntax table as its print name.
  1796.     Side Effects:   Changes character syntax table
  1797.     Description:    A system function which sets or queries the entire 
  1798.      character syntax table. 
  1799.  
  1800. (SYNTAX X N)        Get/Set Character Syntax      SUBR
  1801.     Argument Types: X  - single character atom
  1802.                     N  - an integer, 0 <= N <= 7 (optional)
  1803.     Value:          Old or current syntax number of X
  1804.     Side Effects:   Changes syntax status of X
  1805.     Description:    The character type of X is set to N, and the 
  1806.      previous type is returned. (SYNTAX X) returns X's type unchanged.
  1807.  
  1808. (TAB N)             Tab to a Column               SUBR
  1809.     Argument Types: N - an integer
  1810.     Value:          ()
  1811.     Side Effects:   Advances output file pointer
  1812.     Description:     Advances the output file to the specified column. 
  1813.      If the pointer is at or past column N, no action is taken.
  1814.  
  1815. (TCONC X L)         Attach X to the End of L      SUBR
  1816.     Argument Types: X - no restriction
  1817.                     L - either NIL or a TCONC format list
  1818.     Value:          A TCONC format list with X added to the end of L.
  1819.     Side Effects:   Modifies its argument L.
  1820.     Description:    TCONC is similar to CONS in that it adds its first 
  1821.      argument X to its second argument L, a list. However TCONC adds X 
  1822.      to the end of the list L, not the beginning. It is functionally 
  1823.      similar (in purpose) to:
  1824.               (RPLACD (LAST L) (LIST X)).
  1825.      HOWEVER, a TCONC format list X, is a list whose CAR is the real 
  1826.      list of interest and whose CDR is (LAST (CAR X)). This means that 
  1827.      the pointer needed to perform the RPLACD is always available and 
  1828.      there is no need to traverse the list with (LAST L) in order to 
  1829.      add the element to the end of the list. In the end, you must take 
  1830.      the CAR of the result for it to be useful.
  1831.  
  1832. (TERPRI)            Print an End of Line          SUBR
  1833.     Value:          ()
  1834.     Side Effects:   Advances output file pointer
  1835.     Description:    Prints  a CR/LF on the current output  file.  
  1836.  
  1837. (TRACE X)           Trace a function              SUBR
  1838.     Argument Types: Either a number or a literal atom
  1839.     Description: 
  1840.      IF X is a literal atom, TRACE sets a trace flag for the atom, 
  1841.      meaning that when it is used as a function or a macro, tracing 
  1842.      messages will be printed out. In this case, TRACE returns X as 
  1843.      its value.
  1844.  
  1845.      IF X is a number, TRACE sets the PRINTLEVEL used for printing 
  1846.      trace output to that number. In this case, TRACE returns the 
  1847.      previous value of the TRACE printlevel.
  1848.  
  1849. (TYPE file)         Type the Contents of a File   EXPR/UTILITY*
  1850.     Argument Types: a file name
  1851.     Value:          file
  1852.     Description:     TYPE duplicates the CP/M CCP command TYPE. It 
  1853.      takes one argument, a file name, and types out the contents of 
  1854.      the file on the current output device (presumably the console) . 
  1855.      TYPE is interesting because it illustrates the use of a local 
  1856.      function, TYPELOOP. This is defined as the value of a local 
  1857.      variable, one defined inside the LET statement. The function is 
  1858.      used by TYPE, but its definition disappears once TYPE is exited. 
  1859.  
  1860. (UNPACK X)          Unpack a Print Name           SUBR
  1861.     Argument Types: X - a literal atom
  1862.     Value:          A list of single character atoms.
  1863.     Description:     The inverse of PACK. Breaks the print name of X 
  1864.      into single character atoms and constructs a list of them.
  1865.  
  1866. (UNSET X)           Remove X's Value              SUBR
  1867.     Argument Types: X - a literal atom
  1868.     Value:          NIL
  1869.     Side Effects:   Actually changes X's value 
  1870.     Description:    Removes Xs binding in the current environment.
  1871.  
  1872. (UNSETF F)          Unset the entries on a file   EXPR/UTILITY*
  1873.     Argument Types: File name
  1874.     Value:          F
  1875.     Description:     Applies UNSET to all of the entry names in file 
  1876.      F. It effectively reverses an INFILE to the file F. This releases 
  1877.      the free space and full space occupied by those functions for use 
  1878.      by new ones. 
  1879.  
  1880. (UNTRACE X)         Clear X's Trace Flag          SUBR
  1881.     Argument Types: X - a literal atom
  1882.     Value:          X
  1883.     Side Effects:   Clears the trace flag associated with X
  1884.  
  1885. (VALUEP X)          Test for Value                SUBR
  1886.     Argument Types: X - literal atom
  1887.     Value:          T  - if X has a value in the current environment
  1888.                     () - otherwise
  1889.     Description:   VALUEP doesn't return the value of X, (it might be 
  1890.      ()), but simply T. If you need the value of X you might try: 
  1891.               (ERRORSET NIL X)
  1892.      which returns a list of the value of X or () if X has no value.
  1893.  
  1894. (ZEROP N)           Test For Zero                 SUBR
  1895.     Argument Types: N - a number
  1896.     Value:          T  - if N = 0
  1897.                     () - otherwise
  1898.  
  1899. (+ N1 N2)           Add Two Numbers               SUBR
  1900.     Argument Types: N1, N2 - numbers
  1901.     Value:          A number equal to (N1 + N2).
  1902.  
  1903. (- N1 N2)           Subtract Two Numbers          SUBR
  1904.     Argument Types: N1, N2 - numbers
  1905.     Value:          A number equal to (N1 - N2)
  1906.  
  1907. (* N1 N2)           Multiply Two Numbers          SUBR
  1908.     Argument Types: N1, N2 - numbers
  1909.     Value:          A number equal to (N1 * N2)
  1910.  
  1911. (/ N1 N2)           Divide Two Numbers            SUBR
  1912.     Argument Types: N1, N2 - numbers
  1913.     Value:          A number equal to (N1 / N2)
  1914.  
  1915. (= N1 N2)           Test for Number Equality      SUBR
  1916.     Argument Types: N1, N2 - numbers
  1917.     Value:          T  - if N1 and N2 have the same value
  1918.                     () - otherwise
  1919.  
  1920. (> N1 N2)           Test for > relationship       SUBR
  1921.     Argument Types: N1, N2 - numbers
  1922.     Value:          T  - if N1 > N2, 
  1923.                     () - otherwise
  1924.  
  1925. (>= N1 N2)          Test for >= relationship      SUBR
  1926.     Argument Types: N1, N2 - numbers
  1927.     Value:          T  - if N1 >= N2, 
  1928.                     () - otherwise
  1929.  
  1930. (< N1 N2)           Test for < relationship       SUBR
  1931.     Argument Types: N1, N2 - numbers
  1932.     Value:          T  - if N1 < N2, 
  1933.                     () - otherwise
  1934.  
  1935. (<= N1 N2)          Test for <= relationship      SUBR
  1936.     Argument Types: N1, N2 - numbers
  1937.     Value:          T  - if N1 <= N2, 
  1938.                     () - otherwise
  1939.  
  1940. Appendix I 
  1941. iLISP and Other LISP Differences
  1942.  
  1943.  
  1944. Until recently, there was no standard definition of the LISP language. 
  1945. iLISP was written before the Common LISP definition was common 
  1946. knowledge. There are still many different dialects of LISP. iLISP is 
  1947. yet another. 
  1948.  
  1949. However, iLISP is very different from most other implementations 
  1950. because it is based on a radically different dialect of LISP called 
  1951. SCHEME. The main differences between iLISP and most other dialects are 
  1952. summarized below:
  1953.  
  1954.  1) Function Definitions are Values
  1955.  
  1956.      Function  definitions  are not stored on LISP property  lists  as 
  1957.      they are in many implementations.  They are the values of literal 
  1958.      atoms. 
  1959.  
  1960.  2) There are No FEXPRS
  1961.  
  1962.      iLISP  does  not support functions which block the evaluation  of 
  1963.      their  arguments,  the  so-called FEXPRS.  It does  support  LISP 
  1964.      evaluation MACROs which,  especially in conjunctions with LAMBDA, 
  1965.      can handle all cases that FEXPRs were needed for.
  1966.  
  1967.  3) Evaluation of the First Position of Function Application
  1968.  
  1969.      In iLISP, the function position of each function application is 
  1970.      always evaluated exactly once. In most cases, when the first 
  1971.      position is a variable, the single evaluation simply extracts its 
  1972.      value and uses it. In other cases, e.g. a LAMBDA form, the 
  1973.      position is evaluated and must evaluate to a function. One, 
  1974.      consequence of this is that, in nearly all cases, LAMBDA forms 
  1975.      (e.g. as used in the MAP functions) are NEVER quoted.
  1976.  
  1977.  4) No Dotted Pairs
  1978.  
  1979.      iLISP supports only true lists. The final CDR of every list is 
  1980.      NIL. This is enforced by READ, which doesn't recognize the dotted 
  1981.      pair syntax, and by CONS, which doesn't accept a non list as its 
  1982.      second argument
  1983.  
  1984.  5) Lexical Variable Scoping
  1985.  
  1986.      Unlike most dialects of LISP, iLISP uses a static or lexical 
  1987.      scoping rule. This has nothing to do with variable allocation, 
  1988.      which, of course, is dynamic. It has to do with where variables 
  1989.      get their values from at execution time.
  1990.  
  1991.      Traditional LISP has always had a dynamic variable scoping rule. 
  1992.      The effect of this was that if a function, FOO called another 
  1993.      function, FIE, FIE had access to FOO's internal variables. It 
  1994.      could use their current values and even change them. While this 
  1995.      device has legitimate uses, it is more often abused. In iLISP, 
  1996.      references to variables which are not local to the function in 
  1997.      which the reference is made refer to the outermost, static, 
  1998.      global environment, where most of the function definitions are 
  1999.      kept.
  2000.  
  2001.  
  2002.      One of the greatest advantages of this type of implementation is:
  2003.  
  2004.  6) Tail Recursion is Stack Free
  2005.  
  2006.      Function calling, and in particular, recursive function calling, 
  2007.      is one of the most powerful tools  LISP has. Unfortunately, in 
  2008.      most implementations, LISP programmers have had to restrict their 
  2009.      use of this method of describing programs because it always uses 
  2010.      the runtime stack of the LISP interpreter. However, in iLISP, as 
  2011.      in SCHEME, the implementation iLISP was based on, a special case 
  2012.      of the recursive use of functions is made without the use of the 
  2013.      runtime stack. 
  2014.  
  2015.      In particular, 
  2016.  
  2017.           the  last function call made from inside a function is  made 
  2018.           with a jump or a GOTO instead of a CALL.
  2019.  
  2020.      For a discussion of the differences between tail recursion  and 
  2021.      general recursion, see the discussion in Chapter 4 and also in 
  2022.      the introductory guide.
  2023.  
  2024.      Because of this implementation of tail recursion,
  2025.  
  2026. 7) No PROG and No GO Functions are Needed
  2027.  
  2028.      PROG and its associated non-applicative blemishes on LISP were 
  2029.      added in order to allow programmers to write iterative 
  2030.      alternatives to the recursive functions they wanted to write but 
  2031.      could not because they were so expensive. 
  2032.  
  2033.      With the stack free implementation of tail recursion, these 
  2034.      functions are no longer needed and are not included in iLISP. 
  2035.      Anything that once was coded with a PROG can now be coded as a 
  2036.      tail recursive function or with a general control structure 
  2037.      (coded in a tail recursive manner) such as DO or one of the MAP 
  2038.      functions.
  2039.  
  2040. 8) Functions are Genuine Data Types, the Value of LAMBDA forms
  2041.  
  2042.      Functions are not a subset of the list data type, i.e. those 
  2043.      lists that begin with LAMBDA. LAMBDA is a special form which 
  2044.      EVALUATES to a functions. The new data is internal only; it can't 
  2045.      be read in or printed out directly. 
  2046.  
  2047.      Example
  2048.       -CAR               ;value of CAR
  2049.       #1246              ;the way procedures are printed out
  2050.       -REVERSE           ;even EXPRs are printed in this way
  2051.       #42A3
  2052.  
  2053.      However, EXPRs can be examined via the DESCRIBE function and 
  2054.      modified via the EDITor. Functions are closures in that they 
  2055.      carry their own environments (the environment in which the LAMBDA 
  2056.      was evaluated) with them thus eliminating the so called FUNARG 
  2057.      problem completely.
  2058.  
  2059.  
  2060. CHAPTER FOUR discusses the most important of these differences,  those 
  2061. relating to variable bindings and tail recursion, in greater detail.
  2062.