home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 176_02 / xlisp.doc < prev   
Text File  |  1986-01-06  |  60KB  |  2,575 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.                 XLISP: An Experimental Object-oriented Language
  8.  
  9.                                   Version 1.6
  10.  
  11.                                 January 6, 1986
  12.  
  13.  
  14.                                        by
  15.                                David Michael Betz
  16.                                114 Davenport Ave.
  17.                              Manchester, NH  03103
  18.  
  19.                              (603) 625-4691 (home)
  20.  
  21.                    Copyright (c) 1986, by David Michael Betz
  22.                               All Rights Reserved
  23.            Permission is granted for unrestricted non-commercial use
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.         XLISP                  TABLE OF CONTENTS                  Page 2
  71.  
  72.  
  73.                                Table of Contents
  74.  
  75.  
  76.                 TABLE OF CONTENTS                        2
  77.  
  78.                 INTRODUCTION                             4
  79.  
  80.                 A NOTE FROM THE AUTHOR                   5
  81.  
  82.                 XLISP COMMAND LOOP                       6
  83.  
  84.                 BREAK COMMAND LOOP                       7
  85.  
  86.                 DATA TYPES                               8
  87.  
  88.                 THE EVALUATOR                            9
  89.  
  90.                 LEXICAL CONVENTIONS                     10
  91.  
  92.                 READTABLES                              11
  93.  
  94.                 OBJECTS                                 12
  95.  
  96.                 SYMBOLS                                 15
  97.  
  98.                 EVALUATION FUNCTIONS                    16
  99.  
  100.                 SYMBOL FUNCTIONS                        17
  101.  
  102.                 PROPERTY LIST FUNCTIONS                 19
  103.  
  104.                 ARRAY FUNCTIONS                         20
  105.  
  106.                 LIST FUNCTIONS                          21
  107.  
  108.                 DESTRUCTIVE LIST FUNCTIONS              24
  109.  
  110.                 PREDICATE FUNCTIONS                     25
  111.  
  112.                 CONTROL CONSTRUCTS                      27
  113.  
  114.                 LOOPING CONSTRUCTS                      29
  115.  
  116.                 THE PROGRAM FEATURE                     30
  117.  
  118.                 DEBUGGING AND ERROR HANDLING            31
  119.  
  120.                 ARITHMETIC FUNCTIONS                    32
  121.  
  122.                 BITWISE LOGICAL FUNCTIONS               34
  123.  
  124.                 RELATIONAL FUNCTIONS                    35
  125.  
  126.                 STRING FUNCTIONS                        36
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.         XLISP                  TABLE OF CONTENTS                  Page 3
  137.  
  138.  
  139.                 INPUT/OUTPUT FUNCTIONS                  37
  140.  
  141.                 FILE I/O FUNCTIONS                      38
  142.  
  143.                 SYSTEM FUNCTIONS                        39
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.         XLISP                     INTRODUCTION                    Page 4
  203.  
  204.  
  205.         INTRODUCTION
  206.  
  207.         XLISP is an experimental programming language combining some of
  208.         the features of LISP with an object-oriented extension
  209.         capability.  It was implemented to allow experimentation with
  210.         object-oriented programming on small computers.  There are
  211.         currently implementations running on the the VAX under VAX/VMS,
  212.         on the 8088/8086 under MS-DOS, on the 68000 under CP/M-68K, on
  213.         the Macintosh, on the Atari 520ST and on the Amiga.  It is
  214.         completely written in the programming language 'C' and is easily
  215.         extended with user written built-in functions and classes.  It
  216.         is available in source form free of charge to non-commercial
  217.         users.
  218.  
  219.         Many traditional LISP functions are built into XLISP.  In
  220.         addition, XLISP defines the objects 'Object' and 'Class' as
  221.         primitives.  'Object' is the only class that has no superclass
  222.         and hence is the root of the class heirarchy tree.  'Class' is
  223.         the class of which all classes are instances (it is the only
  224.         object that is an instance of itself).
  225.  
  226.         This document is a brief description of XLISP.  It assumes some
  227.         knowledge of LISP and some understanding of the concepts of
  228.         object-oriented programming.
  229.  
  230.         A recommended text for learning LISP programming is the book
  231.         "LISP" by Winston and Horn and published by Addison Wesley.  The
  232.         first edition of this book is based on MacLisp and the second
  233.         edition is based on Common Lisp.  Future versions of XLISP will
  234.         continue to migrate towards compatibility with Common Lisp.
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.         XLISP                A NOTE FROM THE AUTHOR               Page 5
  269.  
  270.  
  271.         A NOTE FROM THE AUTHOR
  272.  
  273.         If you have any problems with XLISP, feel free to contact me for
  274.         help or advice.  Please remember that since XLISP is available
  275.         in source form in a high level language, many users have been
  276.         making versions available on a variety of machines.  If you call
  277.         to report a problem with a specific version, I may not be able
  278.         to help you if that version runs on a machine to which I don't
  279.         have access.  Please have the version number of the version that
  280.         you are running readily accessible before calling me.
  281.  
  282.         If you find a bug in XLISP, first try to fix the bug yourself
  283.         using the source code provided.  If you are successful in fixing
  284.         the bug, send the bug report along with the fix to me.  If you
  285.         don't have access to a C compiler or are unable to fix a bug,
  286.         please send the bug report to me and I'll try to fix it.
  287.  
  288.         Any suggestions for improvements will be welcomed.  Feel free to
  289.         extend the language in whatever way suits your needs.  However,
  290.         PLEASE DO NOT RELEASE ENHANCED VERSIONS WITHOUT CHECKING WITH ME
  291.         FIRST!!  I would like to be the clearing house for new features
  292.         added to XLISP.  If you want to add features for your own
  293.         personal use, go ahead.  But, if you want to distribute your
  294.         enhanced version, contact me first.  Please remember that the
  295.         goal of XLISP is to provide a language to learn and experiment
  296.         with LISP and object-oriented programming on small computers.  I
  297.         don't want it to get so big that it requires megabytes of memory
  298.         to run.
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.         XLISP                 XLISP COMMAND LOOP                  Page 6
  335.  
  336.  
  337.         XLISP COMMAND LOOP
  338.  
  339.         When XLISP is started, it first tries to load "init.lsp" from
  340.         the default directory.  It then loads any files named as
  341.         parameters on the command line (after appending ".lsp" to their
  342.         names).  It then issues the following prompt:
  343.  
  344.         >
  345.  
  346.         This indicates that XLISP is waiting for an expression to be
  347.         typed.  When an incomplete expression has been typed (one where
  348.         the left and right parens don't match) XLISP changes its prompt
  349.         to:
  350.  
  351.         n>
  352.  
  353.         where n is an integer indicating how many levels of left parens
  354.         remain unclosed.
  355.  
  356.         When a complete expression has been entered, XLISP attempts to
  357.         evaluate that expression.  If the expression evaluates
  358.         successfully, XLISP prints the result of the evaluation and then
  359.         returns to the initial prompt waiting for another expression to
  360.         be typed.
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.         XLISP                 BREAK COMMAND LOOP                  Page 7
  401.  
  402.  
  403.         BREAK COMMAND LOOP
  404.  
  405.         When XLISP encounters an error while evaluating an expression,
  406.         it attempts to handle the error in the following way:
  407.  
  408.         If the symbol '*breakenable*' is true, the message corresponding
  409.         to the error is printed.  If the error is correctable, the
  410.         correction message is printed.  If the symbol '*tracenable*' is
  411.         true, a trace back is printed.  The number of entries printed
  412.         depends on the value of the symbol '*tracelimit*'.  If this
  413.         symbol is set to something other than a number, the entire trace
  414.         back stack is printed.  XLISP then enters a read/eval/print loop
  415.         to allow the user to examine the state of the interpreter in the
  416.         context of the error.  This loop differs from the normal top-
  417.         level read/eval/print loop in that if the user invokes the
  418.         function 'continue', XLISP will continue from a correctable
  419.         error.  If the user invokes the function 'clean-up', XLISP will
  420.         abort the break loop and return to the top level or the next
  421.         lower numbered break loop.  When in a break loop, XLISP prefixes
  422.         the break level to the normal prompt.
  423.  
  424.         If the symbol '*breakenable*' is nil, XLISP looks for a
  425.         surrounding errset function.  If one is found, XLISP examines
  426.         the value of the print flag.  If this flag is true, the error
  427.         message is printed.  In any case, XLISP causes the errset
  428.         function call to return nil.
  429.  
  430.         If there is no surrounding errset function, XLISP prints the
  431.         error message and returns to the top level.
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.         XLISP                      DATA TYPES                     Page 8
  467.  
  468.  
  469.         DATA TYPES
  470.  
  471.         There are several different data types available to XLISP
  472.         programmers.
  473.  
  474.             o lists
  475.             o symbols
  476.             o strings
  477.             o integers
  478.             o floats
  479.             o objects
  480.             o arrays
  481.             o file pointers
  482.             o subrs (built-in functions)
  483.             o fsubrs (special forms)
  484.  
  485.         Another data type is the stream.  A stream is a list node whose
  486.         car points to the head of a list of integers and whose cdr
  487.         points to the last list node of the list.  An empty stream is a
  488.         list node whose car and cdr are nil.  Each of the integers in
  489.         the list represents a character in the stream.  When a character
  490.         is read from a stream, the first integer from the head of the
  491.         list is removed and returned.  When a character is written to a
  492.         stream, the integer representing the character code of the
  493.         character is appended to the end of the list.  When a function
  494.         indicates that it takes an input source as a parameter, this
  495.         parameter can either be an input file pointer or a stream.
  496.         Similarly, when a function indicates that it takes an output
  497.         sink as a parameter, this parameter can either be an output file
  498.         pointer or a stream.
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.         XLISP                    THE EVALUATOR                    Page 9
  533.  
  534.  
  535.         THE EVALUATOR
  536.  
  537.         The process of evaluation in XLISP:
  538.  
  539.         Integers, floats, strings, file pointers, subrs, fsubrs, objects
  540.         and arrays evaluate to themselves
  541.  
  542.         Symbols evaluate to the value associated with their current
  543.         binding
  544.  
  545.         Lists are evaluated by evaluating the first element of the list
  546.         and then taking one of the following actions:
  547.  
  548.             If it is a subr, the remaining list elements are evaluated
  549.             and the subr is called with these evaluated expressions as
  550.             arguments.
  551.  
  552.             If it is an fsubr, the fsubr is called using the remaining
  553.             list elements as arguments (unevaluated)
  554.  
  555.             If it is a list:
  556.  
  557.                 If the list is a function closure (a list whose car is a
  558.                 lambda expression and whose cdr is an environment list),
  559.                 the car of the list is used as the function to be
  560.                 applied and the cdr is used as the environment to be
  561.                 extended with the parameter bindings.
  562.  
  563.                 If the list is a lambda expression, the current
  564.                 environment is used for the function application.
  565.  
  566.                     In either of the above two cases, the remaining list
  567.                     elements are evaluated and the resulting expressions
  568.                     are bound to the formal arguments of the lambda
  569.                     expression.  The body of the function is executed
  570.                     within this new binding environment.
  571.  
  572.                 If it is a list and the car of the list is 'macro', the
  573.                 remaining list elements are bound to the formal
  574.                 arguments of the macro expression.  The body of the
  575.                 function is executed within this new binding
  576.                 environment.  The result of this evaluation is
  577.                 considered the macro expansion.  This result is then
  578.                 evaluated in place of the original expression.
  579.  
  580.                 If it is an object, the second list element is evaluated
  581.                 and used as a message selector.  The message formed by
  582.                 combining the selector with the values of the remaining
  583.                 list elements is sent to the object.
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.         XLISP                 LEXICAL CONVENTIONS                Page 10
  599.  
  600.  
  601.         LEXICAL CONVENTIONS
  602.  
  603.         The following conventions must be followed when entering XLISP
  604.         programs:
  605.  
  606.         Comments in XLISP code begin with a semi-colon character and
  607.         continue to the end of the line.
  608.  
  609.         Symbol names in XLISP can consist of any sequence of non-blank
  610.         printable characters except the following:
  611.  
  612.                 ( ) ' ` , " ;
  613.  
  614.         Uppercase and lowercase characters are not distinguished within
  615.         symbol names.  All lowercase characters are mapped to uppercase
  616.         on input.
  617.  
  618.         Integer literals consist of a sequence of digits optionally
  619.         beginning with a '+' or '-'.  The range of values an integer can
  620.         represent is limited by the size of a C 'long' on the machine on
  621.         which XLISP is running.
  622.  
  623.         Floating point literals consist of a sequence of digits
  624.         optionally beginning with a '+' or '-' and including an embedded
  625.         decimal point.  The range of values a floating point number can
  626.         represent is limited by the size of a C 'float' ('double' on
  627.         machines with 32 bit addresses) on the machine on which XLISP is
  628.         running.
  629.  
  630.         Literal strings are sequences of characters surrounded by double
  631.         quotes.  Within quoted strings the '' character is used to allow
  632.         non-printable characters to be included.  The codes recognized
  633.         are:
  634.  
  635.                 \\        means the character '\'
  636.                 \n       means newline
  637.                 \t       means tab
  638.                 \r       means return
  639.                 \f       means form feed
  640.                 \nnn     means the character whose octal code is nnn
  641.  
  642.         XLISP defines several useful read macros:
  643.  
  644.                 '<expr>         == (quote <expr>)
  645.                 #'<expr>        == (function <expr>)
  646.                 #(<expr>...)    == an array of the specified expressions
  647.                 #x<hdigits>     == a hexadecimal number
  648.                 #\<char> == the ASCII code of the character
  649.                 `<expr>         == (backquote <expr>)
  650.                 ,<expr>         == (comma <expr>)
  651.                 ,@<expr>        == (comma-at <expr>)
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.         XLISP                      READTABLES                    Page 11
  665.  
  666.  
  667.         READTABLES
  668.  
  669.         The behaviour of the reader is controlled by a data structure
  670.         called a "readtable".  The reader uses the symbol *READTABLE* to
  671.         locate the current readtable.  This table controls the
  672.         interpretation of input characters.  It is an array with 128
  673.         entries, one for each of the ASCII character codes.  Each entry
  674.         contains one of the following things:
  675.  
  676.                 NIL             Indicating an invalid character
  677.                 :CONSTITUENT    Indicating a symbol constituent
  678.                 :WHITE-SPACE    Indicating a whitespace character
  679.                 (:TMACRO . fun) Terminating readmacro
  680.                 (:NMACRO . fun) Non-terminating readmacro
  681.  
  682.         In the case of the last two forms, the "fun" component is a
  683.         function definition.  This can either be a pointer to a built-in
  684.         readmacro function or a lambda expression.  The function should
  685.         take two parameters.  The first is the input stream and the
  686.         second is the character that caused the invocation of the
  687.         readmacro.  The character is passed as an integer.  The
  688.         readmacro function should return NIL to indicate that the
  689.         character should be treated as white space or a value consed
  690.         with NIL to indicate that the readmacro should be treated as an
  691.         occurance of the specified value.  Of course, the readmacro code
  692.         is free to read additional characters from the input stream.
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.         XLISP                       OBJECTS                      Page 12
  731.  
  732.  
  733.         OBJECTS
  734.  
  735.         Definitions:
  736.  
  737.             o selector - a symbol used to select an appropriate method
  738.             o message - a selector and a list of actual arguments
  739.             o method - the code that implements a message
  740.  
  741.         Since XLISP was created to provide a simple basis for
  742.         experimenting with object-oriented programming, one of the
  743.         primitive data types included is 'object'.  In XLISP, an object
  744.         consists of a data structure containing a pointer to the
  745.         object's class as well as an array containing the values of the
  746.         object's instance variables.
  747.  
  748.         Officially, there is no way to see inside an object (look at the
  749.         values of its instance variables).  The only way to communicate
  750.         with an object is by sending it a message.  When the XLISP
  751.         evaluator evaluates a list the value of whose first element is
  752.         an object, it interprets the value of the second element of the
  753.         list (which must be a symbol) as the message selector.  The
  754.         evaluator determines the class of the receiving object and
  755.         attempts to find a method corresponding to the message selector
  756.         in the set of messages defined for that class.  If the message
  757.         is not found in the object's class and the class has a super-
  758.         class, the search continues by looking at the messages defined
  759.         for the super-class.  This process continues from one super-
  760.         class to the next until a method for the message is found.  If
  761.         no method is found, an error occurs.
  762.  
  763.         When a method is found, the evaluator binds the receiving object
  764.         to the symbol 'self', binds the class in which the method was
  765.         found to the symbol 'msgclass', and evaluates the method using
  766.         the remaining elements of the original list as arguments to the
  767.         method.  These arguments are always evaluated prior to being
  768.         bound to their corresponding formal arguments.  The result of
  769.         evaluating the method becomes the result of the expression.
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.         XLISP                       OBJECTS                      Page 13
  797.  
  798.  
  799.         THE 'Object' CLASS
  800.  
  801.         Classes:
  802.  
  803.         Object  THE TOP OF THE CLASS HEIRARCHY
  804.  
  805.             Messages:
  806.  
  807.                 :show  SHOW AN OBJECT'S INSTANCE VARIABLES
  808.                     returns     the object
  809.  
  810.                 :class  RETURN THE CLASS OF AN OBJECT
  811.                     returns     the class of the object
  812.  
  813.                 :isnew  THE DEFAULT OBJECT INITIALIZATION ROUTINE
  814.                     returns     the object
  815.  
  816.                 :sendsuper <sel> [<args>]...  SEND SUPERCLASS A MESSAGE
  817.                     <sel>       the message selector
  818.                     <args>      the message arguments
  819.                     returns     the result of sending the message
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.         XLISP                       OBJECTS                      Page 14
  863.  
  864.  
  865.         THE 'Class' CLASS
  866.  
  867.         Class   THE CLASS OF ALL OBJECT CLASSES (including itself)
  868.  
  869.             Messages:
  870.  
  871.                 :new  CREATE A NEW INSTANCE OF A CLASS
  872.                     returns     the new class object
  873.  
  874.                 :isnew <ivars> [<cvars>[<super>]]  INITIALIZE A NEW CLASS
  875.                     <ivars>     the list of instance variable symbols
  876.                     <cvars>     the list of class variable symbols
  877.                     <super>     the superclass (default is Object)
  878.                     returns     the new class object
  879.  
  880.                 :answer <msg> <fargs> <code>  ADD A MESSAGE TO A CLASS
  881.                     <msg>       the message symbol
  882.                     <fargs>     the formal argument list
  883.                                   this list is of the form:
  884.                                     ([<farg>]...
  885.                                      [&optional [<oarg>]...]
  886.                                      [&rest <rarg>]
  887.                                      [&aux [<aux>]...])
  888.                                   where
  889.                                     <farg>   a formal argument
  890.                                     <oarg>   an optional argument
  891.                                     <rarg>   bound to rest of the arguments
  892.                                     <aux>    a auxiliary variable
  893.                     <code>      a list of executable expressions
  894.                     returns     the object
  895.  
  896.  
  897.         When a new instance of a class is created by sending the message
  898.         ':new' to an existing class, the message ':isnew' followed by
  899.         whatever parameters were passed to the ':new' message is sent to
  900.         the newly created object.
  901.  
  902.         When a new class is created by sending the ':new' message to the
  903.         object 'Class', an optional parameter may be specified
  904.         indicating the superclass of the new class.  If this parameter
  905.         is omitted, the new class will be a subclass of 'Object'.  A
  906.         class inherits all instance variables, class variables, and
  907.         methods from its super-class.
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.         XLISP                       SYMBOLS                      Page 15
  929.  
  930.  
  931.         SYMBOLS
  932.  
  933.             o self - the current object (within a message context)
  934.             o msgclass - the class in which the current method was found
  935.             o *obarray* - the object hash table
  936.             o *standard-input* - the standard input file
  937.             o *standard-output* - the standard output file
  938.             o *breakenable* - flag controlling entering break loop on errors
  939.             o *tracenable* - enable baktrace on errors
  940.             o *tracelimit* - number of levels of trace back information
  941.             o *evalhook* - user substitute for the evaluator function
  942.             o *applyhook* - (not yet implemented)
  943.             o *readtable* - the current readtable
  944.             o *unbound* - indicator for unbound symbols
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.  
  961.  
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.         XLISP                 EVALUATION FUNCTIONS               Page 16
  995.  
  996.  
  997.         EVALUATION FUNCTIONS
  998.  
  999.         (eval <expr>)  EVALUATE AN XLISP EXPRESSION
  1000.             <expr>      the expression to be evaluated
  1001.             returns     the result of evaluating the expression
  1002.  
  1003.         (apply <fun> <args>)  APPLY A FUNCTION TO A LIST OF ARGUMENTS
  1004.             <fun>       the function to apply (or function symbol)
  1005.             <args>      the argument list
  1006.             returns     the result of applying the function to the arguments
  1007.  
  1008.         (funcall <fun> [<arg>]...)  CALL A FUNCTION WITH ARGUMENTS
  1009.             <fun>       the function to call (or function symbol)
  1010.             <arg>       arguments to pass to the function
  1011.             returns     the result of calling the function with the arguments
  1012.  
  1013.         (quote <expr>)  RETURN AN EXPRESSION UNEVALUATED
  1014.             <expr>      the expression to be quoted (quoted)
  1015.             returns     <expr> unevaluated
  1016.  
  1017.         (function <expr>)  QUOTE A FUNCTION
  1018.             <expr>      the function to be quoted (quoted)
  1019.             returns     a function closure
  1020.  
  1021.         (backquote <expr>)  FILL IN A TEMPLATE
  1022.             <expr>      the template
  1023.             returns     a copy of the template with comma and comma-at
  1024.                         expressions expanded
  1025.  
  1026.         (lambda <args> [<expr>]...)  MAKE A FUNCTION CLOSURE
  1027.             <args>      the argument list (quoted)
  1028.             <expr>      expressions of the function body
  1029.             returns     the function closure
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.         XLISP                   SYMBOL FUNCTIONS                 Page 17
  1061.  
  1062.  
  1063.         SYMBOL FUNCTIONS
  1064.  
  1065.         (set <sym> <expr>)  SET THE VALUE OF A SYMBOL
  1066.             <sym>       the symbol being set
  1067.             <expr>      the new value
  1068.             returns     the new value
  1069.  
  1070.         (setq [<sym> <expr>]...)  SET THE VALUE OF A SYMBOL
  1071.             <sym>       the symbol being set (quoted)
  1072.             <expr>      the new value
  1073.             returns     the new value
  1074.  
  1075.         (setf [<place> <expr>]...)  SET THE VALUE OF A FIELD
  1076.             <place>     the field specifier (quoted):
  1077.                             <sym>                set value of a symbol
  1078.                             (car <expr>)         set car of a list node
  1079.                             (cdr <expr>)         set cdr of a list node
  1080.                             (nth <n> <expr>)     set nth car of a list
  1081.                             (aref <expr> <n>)    set nth element of an array
  1082.                             (get <sym> <prop>)   set value of a property
  1083.                             (symbol-value <sym>) set value of a symbol
  1084.                             (symbol-plist <sym>) set property list of a symbol
  1085.             <value>     the new value
  1086.             returns     the new value
  1087.  
  1088.         (defun <sym> <fargs> [<expr>]...)  DEFINE A FUNCTION
  1089.         (defmacro <sym> <fargs> [<expr>]...)  DEFINE A MACRO
  1090.             <sym>       symbol being defined (quoted)
  1091.             <fargs>     list of formal arguments (quoted)
  1092.                           this list is of the form:
  1093.                             ([<farg>]...
  1094.                              [&optional [<oarg>]...]
  1095.                              [&rest <rarg>]
  1096.                              [&aux [<aux>]...])
  1097.                           where
  1098.                             <farg>      is a formal argument
  1099.                             <oarg>      is an optional argument
  1100.                             <rarg>      bound to the rest of the arguments
  1101.                             <aux>       is an auxiliary variable
  1102.             <expr>      expressions constituting the body of the
  1103.                         function (quoted)
  1104.             returns     the function symbol
  1105.  
  1106.         (gensym [<tag>])  GENERATE A SYMBOL
  1107.             <tag>       string or number
  1108.             returns     the new symbol
  1109.  
  1110.         (intern <pname>)  MAKE AN INTERNED SYMBOL
  1111.             <pname>     the symbol's print name string
  1112.             returns     the new symbol
  1113.  
  1114.         (make-symbol <pname>)  MAKE AN UNINTERNED SYMBOL
  1115.             <pname>     the symbol's print name string
  1116.             returns     the new symbol
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.         XLISP                   SYMBOL FUNCTIONS                 Page 18
  1127.  
  1128.  
  1129.         (symbol-name <sym>)  GET THE PRINT NAME OF A SYMBOL
  1130.             <sym>       the symbol
  1131.             returns     the symbol's print name
  1132.  
  1133.         (symbol-value <sym>)  GET THE VALUE OF A SYMBOL
  1134.             <sym>       the symbol
  1135.             returns     the symbol's value
  1136.  
  1137.         (symbol-plist <sym>)  GET THE PROPERTY LIST OF A SYMBOL
  1138.             <sym>       the symbol
  1139.             returns     the symbol's property list
  1140.  
  1141.         (hash <sym> <n>)  COMPUTE THE HASH INDEX FOR A SYMBOL
  1142.             <sym>       the symbol or string
  1143.             <n>         the table size (integer)
  1144.             returns     the hash index (integer)
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.         XLISP               PROPERTY LIST FUNCTIONS              Page 19
  1193.  
  1194.  
  1195.         PROPERTY LIST FUNCTIONS
  1196.  
  1197.         (get <sym> <prop>)  GET THE VALUE OF A PROPERTY
  1198.             <sym>       the symbol
  1199.             <prop>      the property symbol
  1200.             returns     the property value or nil
  1201.  
  1202.         (putprop <sym> <val> <prop>)  PUT A PROPERTY ONTO A PROPERTY LIST
  1203.             <sym>       the symbol
  1204.             <val>       the property value
  1205.             <prop>      the property symbol
  1206.             returns     the property value
  1207.  
  1208.         (remprop <sym> <prop>)  REMOVE A PROPERTY
  1209.             <sym>       the symbol
  1210.             <prop>      the property symbol
  1211.             returns     nil
  1212.  
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.         XLISP                   ARRAY FUNCTIONS                  Page 20
  1259.  
  1260.  
  1261.         ARRAY FUNCTIONS
  1262.  
  1263.         (aref <array> <n>)  GET THE NTH ELEMENT OF AN ARRAY
  1264.             <array>     the array
  1265.             <n>         the array index (integer)
  1266.             returns     the value of the array element
  1267.  
  1268.         (make-array <size>)  MAKE A NEW ARRAY
  1269.             <size>      the size of the new array (integer)
  1270.             returns     the new array
  1271.  
  1272.  
  1273.  
  1274.  
  1275.  
  1276.  
  1277.  
  1278.  
  1279.  
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.         XLISP                    LIST FUNCTIONS                  Page 21
  1325.  
  1326.  
  1327.         LIST FUNCTIONS
  1328.  
  1329.         (car <expr>)  RETURN THE CAR OF A LIST NODE
  1330.             <expr>      the list node
  1331.             returns     the car of the list node
  1332.  
  1333.         (cdr <expr>)  RETURN THE CDR OF A LIST NODE
  1334.             <expr>      the list node
  1335.             returns     the cdr of the list node
  1336.  
  1337.         (cxxr <expr>)  ALL CxxR COMBINATIONS
  1338.         (cxxxr <expr>)  ALL CxxxR COMBINATIONS
  1339.         (cxxxxr <expr>)  ALL CxxxxR COMBINATIONS
  1340.  
  1341.         (cons <expr1> <expr2>)  CONSTRUCT A NEW LIST NODE
  1342.             <expr1>     the car of the new list node
  1343.             <expr2>     the cdr of the new list node
  1344.             returns     the new list node
  1345.  
  1346.         (list [<expr>]...)  CREATE A LIST OF VALUES
  1347.             <expr>      expressions to be combined into a list
  1348.             returns     the new list
  1349.  
  1350.         (append [<expr>]...)  APPEND LISTS
  1351.             <expr>      lists whose elements are to be appended
  1352.             returns     the new list
  1353.  
  1354.         (reverse <expr>)  REVERSE A LIST
  1355.             <expr>      the list to reverse
  1356.             returns     a new list in the reverse order
  1357.  
  1358.         (last <list>)  RETURN THE LAST LIST NODE OF A LIST
  1359.             <list>      the list
  1360.             returns     the last list node in the list
  1361.  
  1362.         (member <expr> <list> [<key> <test>])  FIND AN EXPRESSION IN A LIST
  1363.             <expr>      the expression to find
  1364.             <list>      the list to search
  1365.             <key>       the keyword :test or :test-not
  1366.             <test>      the test function (defaults to eql)
  1367.             returns     the remainder of the list starting with the expression
  1368.  
  1369.         (assoc <expr> <alist> [<key> <test>])  FIND AN EXPRESSION IN AN A-LIST
  1370.             <expr>      the expression to find
  1371.             <alist>     the association list
  1372.             <key>       the keyword :test or :test-not
  1373.             <test>      the test function (defaults to eql)
  1374.             returns     the alist entry or nil
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.         XLISP                    LIST FUNCTIONS                  Page 22
  1391.  
  1392.  
  1393.         (remove <expr> <list> [<key> <test>])  REMOVE AN EXPRESSION
  1394.             <expr>      the expression to delete
  1395.             <list>      the list
  1396.             <key>       the keyword :test or :test-not
  1397.             <test>      the test function (defaults to eql)
  1398.             returns     the list with the matching expressions deleted
  1399.  
  1400.         (length <expr>)  FIND THE LENGTH OF A LIST OR STRING
  1401.             <expr>      the list or string
  1402.             returns     the length of the list or string
  1403.  
  1404.         (nth <n> <list>)  RETURN THE NTH ELEMENT OF A LIST
  1405.             <n>         the number of the element to return (zero origin)
  1406.             <list>      the list
  1407.             returns     the nth element or nil if the list isn't that long
  1408.  
  1409.         (nthcdr <n> <list>)  RETURN THE NTH CDR OF A LIST
  1410.             <n>         the number of the element to return (zero origin)
  1411.             <list>      the list
  1412.             returns     the nth cdr or nil if the list isn't that long
  1413.  
  1414.         (mapc <fcn> <list1> [<list>]...)  APPLY FUNCTION TO SUCCESSIVE CARS
  1415.             <fcn>       the function or function name
  1416.             <listn>     a list for each argument of the function
  1417.             returns     the first list of arguments
  1418.  
  1419.         (mapcar <fcn> <list1> [<list>]...)  APPLY FUNCTION TO SUCCESSIVE CARS
  1420.             <fcn>       the function or function name
  1421.             <listn>     a list for each argument of the function
  1422.             returns     a list of the values returned
  1423.  
  1424.         (mapl <fcn> <list1> [<list>]...)  APPLY FUNCTION TO SUCCESSIVE CDRS
  1425.             <fcn>       the function or function name
  1426.             <listn>     a list for each argument of the function
  1427.             returns     the first list of arguments
  1428.  
  1429.         (maplist <fcn> <list1> [<list>]...)  APPLY FUNCTION TO SUCCESSIVE CDRS
  1430.             <fcn>       the function or function name
  1431.             <listn>     a list for each argument of the function
  1432.             returns     a list of the values returned
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.         XLISP                    LIST FUNCTIONS                  Page 23
  1457.  
  1458.  
  1459.         (subst <to> <from> <expr> [<key> <test>])  SUBSTITUTE EXPRESSIONS
  1460.             <to>        the new expression
  1461.             <from>      the old expression
  1462.             <expr>      the expression in which to do the substitutions
  1463.             <key>       the keyword :test or :test-not
  1464.             <test>      the test function (defaults to eql)
  1465.             returns     the expression with substitutions
  1466.  
  1467.         (sublis <alist> <expr> [<key> <test>])  SUBSTITUTE WITH AN A-LIST
  1468.             <alist>     the association list
  1469.             <expr>      the expression in which to do the substitutions
  1470.             <key>       the keyword :test or :test-not
  1471.             <test>      the test function (defaults to eql)
  1472.             returns     the expression with substitutions
  1473.  
  1474.  
  1475.  
  1476.  
  1477.  
  1478.  
  1479.  
  1480.  
  1481.  
  1482.  
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.         XLISP              DESTRUCTIVE LIST FUNCTIONS            Page 24
  1523.  
  1524.  
  1525.         DESTRUCTIVE LIST FUNCTIONS
  1526.  
  1527.         (rplaca <list> <expr>)  REPLACE THE CAR OF A LIST NODE
  1528.             <list>      the list node
  1529.             <expr>      the new value for the car of the list node
  1530.             returns     the list node after updating the car
  1531.  
  1532.         (rplacd <list> <expr>)  REPLACE THE CDR OF A LIST NODE
  1533.             <list>      the list node
  1534.             <expr>      the new value for the cdr of the list node
  1535.             returns     the list node after updating the cdr
  1536.  
  1537.         (nconc [<list>]...)  DESTRUCTIVELY CONCATENATE LISTS
  1538.             <list>      lists to concatenate
  1539.             returns     the result of concatenating the lists
  1540.  
  1541.         (delete <expr> <list> [<key> <test>])  DELETE AN EXPRESSION FROM A LIST
  1542.             <expr>      the expression to delete
  1543.             <list>      the list
  1544.             <key>       the keyword :test or :test-not
  1545.             <test>      the test function (defaults to eql)
  1546.             returns     the list with the matching expressions deleted
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.         XLISP                 PREDICATE FUNCTIONS                Page 25
  1589.  
  1590.  
  1591.         PREDICATE FUNCTIONS
  1592.  
  1593.         (atom <expr>)  IS THIS AN ATOM?
  1594.             <expr>      the expression to check
  1595.             returns     t if the value is an atom, nil otherwise
  1596.  
  1597.         (symbolp <expr>)  IS THIS A SYMBOL?
  1598.             <expr>      the expression to check
  1599.             returns     t if the expression is a symbol, nil otherwise
  1600.  
  1601.         (numberp <expr>)  IS THIS A NUMBER?
  1602.             <expr>      the expression to check
  1603.             returns     t if the expression is a number, nil otherwise
  1604.  
  1605.         (null <expr>)  IS THIS AN EMPTY LIST?
  1606.             <expr>      the list to check
  1607.             returns     t if the list is empty, nil otherwise
  1608.  
  1609.         (not <expr>)  IS THIS FALSE?
  1610.             <expr>      the expression to check
  1611.             return      t if the expression is nil, nil otherwise
  1612.  
  1613.         (listp <expr>)  IS THIS A LIST?
  1614.             <expr>      the expression to check
  1615.             returns     t if the value is a list node or nil, nil otherwise
  1616.  
  1617.         (consp <expr>)  IS THIS A NON-EMPTY LIST?
  1618.             <expr>      the expression to check
  1619.             returns     t if the value is a list node, nil otherwise
  1620.  
  1621.         (boundp <sym>)  IS THIS A BOUND SYMBOL?
  1622.             <sym>       the symbol
  1623.             returns     t if a value is bound to the symbol, nil otherwise
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.         XLISP                 PREDICATE FUNCTIONS                Page 26
  1655.  
  1656.  
  1657.         (minusp <expr>)  IS THIS NUMBER NEGATIVE?
  1658.             <expr>      the number to test
  1659.             returns     t if the number is negative, nil otherwise
  1660.  
  1661.         (zerop <expr>)  IS THIS NUMBER ZERO?
  1662.             <expr>      the number to test
  1663.             returns     t if the number is zero, nil otherwise
  1664.  
  1665.         (plusp <expr>)  IS THIS NUMBER POSITIVE?
  1666.             <expr>      the number to test
  1667.             returns     t if the number is positive, nil otherwise
  1668.  
  1669.         (evenp <expr>)  IS THIS NUMBER EVEN?
  1670.             <expr>      the number to test
  1671.             returns     t if the number is even, nil otherwise
  1672.  
  1673.         (oddp <expr>)  IS THIS NUMBER ODD?
  1674.             <expr>      the number to test
  1675.             returns     t if the number is odd, nil otherwise
  1676.  
  1677.         (eq <expr1> <expr2>)  ARE THE EXPRESSIONS IDENTICAL?
  1678.             <expr1>     the first expression
  1679.             <expr2>     the second expression
  1680.             returns     t if they are equal, nil otherwise
  1681.  
  1682.         (eql <expr1> <expr2>)  ARE THE EXPRESSIONS IDENTICAL?
  1683.                                 (WORKS WITH NUMBERS AND STRINGS)
  1684.             <expr1>     the first expression
  1685.             <expr2>     the second expression
  1686.             returns     t if they are equal, nil otherwise
  1687.  
  1688.         (equal <expr1> <expr2>)  ARE THE EXPRESSIONS EQUAL?
  1689.             <expr1>     the first expression
  1690.             <expr2>     the second expression
  1691.             returns     t if they are equal, nil otherwise
  1692.  
  1693.  
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.         XLISP                  CONTROL CONSTRUCTS                Page 27
  1721.  
  1722.  
  1723.         CONTROL CONSTRUCTS
  1724.  
  1725.         (cond [<pair>]...)  EVALUATE CONDITIONALLY
  1726.             <pair>      pair consisting of:
  1727.                             (<pred> [<expr>]...)
  1728.                           where
  1729.                             <pred>      is a predicate expression
  1730.                             <expr>      evaluated if the predicate
  1731.                                         is not nil
  1732.             returns     the value of the first expression whose predicate
  1733.                         is not nil
  1734.  
  1735.         (and [<expr>]...)  THE LOGICAL AND OF A LIST OF EXPRESSIONS
  1736.             <expr>      the expressions to be ANDed
  1737.             returns     nil if any expression evaluates to nil,
  1738.                         otherwise the value of the last expression
  1739.                         (evaluation of expressions stops after the first
  1740.                          expression that evaluates to nil)
  1741.  
  1742.         (or [<expr>]...)  THE LOGICAL OR OF A LIST OF EXPRESSIONS
  1743.             <expr>      the expressions to be ORed
  1744.             returns     nil if all expressions evaluate to nil,
  1745.                         otherwise the value of the first non-nil expression
  1746.                         (evaluation of expressions stops after the first
  1747.                          expression that does not evaluate to nil)
  1748.  
  1749.         (if <texpr> <expr1> [<expr2>])  EXECUTE EXPRESSIONS CONDITIONALLY
  1750.             <texpr>     the test expression
  1751.             <expr1>     the expression to be evaluated if texpr is non-nil
  1752.             <expr2>     the expression to be evaluated if texpr is nil
  1753.             returns     the value of the selected expression
  1754.  
  1755.         (case <expr> [<case>]...)  SELECT BY CASE
  1756.             <expr>      the selection expression
  1757.             <case>      pair consisting of:
  1758.                             (<value> [<expr>]...)
  1759.                           where:
  1760.                             <value>     is a single expression or a list of
  1761.                                         expressions (unevaluated)
  1762.                             <expr>      are expressions to execute if the
  1763.                                         case matches
  1764.             returns     the value of the last expression of the matching case
  1765.  
  1766.         (let ([<binding>]...) [<expr>]...)  CREATE LOCAL BINDINGS
  1767.         (let* ([<binding>]...) [<expr>]...)  LET WITH SEQUENTIAL BINDING
  1768.             <binding>   the variable bindings each of which is either:
  1769.                         1)  a symbol (which is initialized to nil)
  1770.                         2)  a list whose car is a symbol and whose cadr
  1771.                                 is an initialization expression
  1772.             <expr>      the expressions to be evaluated
  1773.             returns     the value of the last expression
  1774.  
  1775.         (catch <sym> [<expr>]...)  EVALUATE EXPRESSIONS AND CATCH THROWS
  1776.             <sym>       the catch tag
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.         XLISP                  CONTROL CONSTRUCTS                Page 28
  1787.  
  1788.  
  1789.             <expr>      expressions to evaluate
  1790.             returns     the value of the last expression the throw expression
  1791.  
  1792.         (throw <sym> [<expr>])  THROW TO A CATCH
  1793.             <sym>       the catch tag
  1794.             <expr>      the value for the catch to return (defaults to nil)
  1795.             returns     never returns
  1796.  
  1797.  
  1798.  
  1799.  
  1800.  
  1801.  
  1802.  
  1803.  
  1804.  
  1805.  
  1806.  
  1807.  
  1808.  
  1809.  
  1810.  
  1811.  
  1812.  
  1813.  
  1814.  
  1815.  
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.         XLISP                  LOOPING CONSTRUCTS                Page 29
  1853.  
  1854.  
  1855.         LOOPING CONSTRUCTS
  1856.  
  1857.         (do ([<binding>]...) (<texpr> [<rexpr>]...) [<expr>]...)
  1858.         (do* ([<binding>]...) (<texpr> [<rexpr>]...) [<expr>]...)
  1859.             <binding>   the variable bindings each of which is either:
  1860.                         1)  a symbol (which is initialized to nil)
  1861.                         2)  a list of the form: (<sym> <init> [<step>])
  1862.                             where:
  1863.                                 <sym>  is the symbol to bind
  1864.                                 <init> is the initial value of the symbol
  1865.                                 <step> is a step expression
  1866.             <texpr>     the termination test expression
  1867.             <rexpr>     result expressions (the default is nil)
  1868.             <expr>      the body of the loop (treated like an implicit prog)
  1869.             returns     the value of the last result expression
  1870.  
  1871.         (dolist (<sym> <expr> [<rexpr>]) [<expr>]...)  LOOP THROUGH A LIST
  1872.             <sym>       the symbol to bind to each list element
  1873.             <expr>      the list expression
  1874.             <rexpr>     the result expression (the default is nil)
  1875.             <expr>      the body of the loop (treated like an implicit prog)
  1876.  
  1877.         (dotimes (<sym> <expr> [<rexpr>]) [<expr>]...)  LOOP FROM ZERO TO N-1
  1878.             <sym>       the symbol to bind to each value from 0 to n-1
  1879.             <expr>      the number of times to loop
  1880.             <rexpr>     the result expression (the default is nil)
  1881.             <expr>      the body of the loop (treated like an implicit prog)
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.         XLISP                 THE PROGRAM FEATURE                Page 30
  1919.  
  1920.  
  1921.         THE PROGRAM FEATURE
  1922.  
  1923.         (prog ([<binding>]...) [<expr>]...)  THE PROGRAM FEATURE
  1924.         (prog* ([<binding>]...) [<expr>]...)  PROG WITH SEQUENTIAL BINDING
  1925.             <binding>   the variable bindings each of which is either:
  1926.                         1)  a symbol (which is initialized to nil)
  1927.                         2)  a list whose car is a symbol and whose cadr
  1928.                                 is an initialization expression
  1929.             <expr>      expressions to evaluate or tags (symbols)
  1930.             returns     nil or the argument passed to the return function
  1931.  
  1932.         (go <sym>)  GO TO A TAG WITHIN A PROG CONSTRUCT
  1933.             <sym>       the tag (quoted)
  1934.             returns     never returns
  1935.  
  1936.         (return [<expr>])  CAUSE A PROG CONSTRUCT TO RETURN A VALUE
  1937.             <expr>      the value (defaults to nil)
  1938.             returns     never returns
  1939.  
  1940.         (prog1 <expr1> [<expr>]...)  EXECUTE EXPRESSIONS SEQUENTIALLY
  1941.             <expr1>     the first expression to evaluate
  1942.             <expr>      the remaining expressions to evaluate
  1943.             returns     the value of the first expression
  1944.  
  1945.         (prog2 <expr1> <expr2> [<expr>]...)  EXECUTE EXPRESSIONS SEQUENTIALLY
  1946.             <expr1>     the first expression to evaluate
  1947.             <expr2>     the second expression to evaluate
  1948.             <expr>      the remaining expressions to evaluate
  1949.             returns     the value of the second expression
  1950.  
  1951.         (progn [<expr>]...)  EXECUTE EXPRESSIONS SEQUENTIALLY
  1952.             <expr>      the expressions to evaluate
  1953.             returns     the value of the last expression (or nil)
  1954.  
  1955.  
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.         XLISP             DEBUGGING AND ERROR HANDLING           Page 31
  1985.  
  1986.  
  1987.         DEBUGGING AND ERROR HANDLING
  1988.  
  1989.         (error <emsg> [<arg>])  SIGNAL A NON-CORRECTABLE ERROR
  1990.             <emsg>      the error message string
  1991.             <arg>       the argument expression (printed after the message)
  1992.             returns     never returns
  1993.  
  1994.         (cerror <cmsg> <emsg> [<arg>])  SIGNAL A CORRECTABLE ERROR
  1995.             <cmsg>      the continue message string
  1996.             <emsg>      the error message string
  1997.             <arg>       the argument expression (printed after the message)
  1998.             returns     nil when continued from the break loop
  1999.  
  2000.         (break [<bmsg> [<arg>]])  ENTER A BREAK LOOP
  2001.             <bmsg>      the break message string (defaults to "**BREAK**")
  2002.             <arg>       the argument expression (printed after the message)
  2003.             returns     nil when continued from the break loop
  2004.  
  2005.         (clean-up)  CLEAN-UP AFTER AN ERROR
  2006.             returns     never returns
  2007.  
  2008.         (continue)  CONTINUE FROM A CORRECTABLE ERROR
  2009.             returns     never returns
  2010.  
  2011.         (errset <expr> [<pflag>])  TRAP ERRORS
  2012.             <expr>      the expression to execute
  2013.             <pflag>     flag to control printing of the error message
  2014.             returns     the value of the last expression consed with nil
  2015.                         or nil on error
  2016.  
  2017.         (baktrace [<n>])  PRINT N LEVELS OF TRACE BACK INFORMATION
  2018.             <n>         the number of levels (defaults to all levels)
  2019.             returns     nil
  2020.  
  2021.         (evalhook <expr> <ehook> <ahook> [<env>])  EVALUATE WITH HOOKS
  2022.             <expr>      the expression to evaluate
  2023.             <ehook>     the value for *evalhook*
  2024.             <ahook>     the value for *applyhook*
  2025.             <env>       the environment (default is nil)
  2026.             returns     the result of evaluating the expression
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.         XLISP                 ARITHMETIC FUNCTIONS               Page 32
  2051.  
  2052.  
  2053.         ARITHMETIC FUNCTIONS
  2054.  
  2055.         (truncate <expr>)  TRUNCATES A FLOATING POINT NUMBER TO AN INTEGER
  2056.             <expr>      the number
  2057.             returns     the result of truncating the number
  2058.  
  2059.         (float <expr>)  CONVERTS AN INTEGER TO A FLOATING POINT NUMBER
  2060.             <expr>      the number
  2061.             returns     the result of floating the integer
  2062.  
  2063.         (+ <expr>...)  ADD A LIST OF NUMBERS
  2064.             <expr>      the numbers
  2065.             returns     the result of the addition
  2066.  
  2067.         (- <expr>...)  SUBTRACT A LIST OF NUMBERS OR NEGATE A SINGLE NUMBER
  2068.             <expr>      the numbers
  2069.             returns     the result of the subtraction
  2070.  
  2071.         (* <expr>...)  MULTIPLY A LIST OF NUMBERS
  2072.             <expr>      the numbers
  2073.             returns     the result of the multiplication
  2074.  
  2075.         (/ <expr>...)  DIVIDE A LIST OF NUMBERS
  2076.             <expr>      the numbers
  2077.             returns     the result of the division
  2078.  
  2079.         (1+ <expr>)  ADD ONE TO A NUMBER
  2080.             <expr>      the number
  2081.             returns     the number plus one
  2082.  
  2083.         (1- <expr>)  SUBTRACT ONE FROM A NUMBER
  2084.             <expr>      the number
  2085.             returns     the number minus one
  2086.  
  2087.         (rem <expr>...)  REMAINDER OF A LIST OF NUMBERS
  2088.             <expr>      the numbers
  2089.             returns     the result of the remainder operation
  2090.  
  2091.         (min <expr>...)  THE SMALLEST OF A LIST OF NUMBERS
  2092.             <expr>      the expressions to be checked
  2093.             returns     the smallest number in the list
  2094.  
  2095.         (max <expr>...)  THE LARGEST OF A LIST OF NUMBERS
  2096.             <expr>      the expressions to be checked
  2097.             returns     the largest number in the list
  2098.  
  2099.         (abs <expr>)  THE ABSOLUTE VALUE OF A NUMBER
  2100.             <expr>      the number
  2101.             returns     the absolute value of the number
  2102.  
  2103.         (random <n>)  COMPUTE A RANDOM NUMBER BETWEEN 1 and N-1
  2104.             <n>         the upper bound (integer)
  2105.             returns     a random number
  2106.  
  2107.  
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.         XLISP                 ARITHMETIC FUNCTIONS               Page 33
  2117.  
  2118.  
  2119.         (sin <expr>)  COMPUTE THE SINE OF A NUMBER
  2120.             <expr>      the floating point number
  2121.             returns     the sine of the number
  2122.  
  2123.         (cos <expr>)  COMPUTE THE COSINE OF A NUMBER
  2124.             <expr>      the floating point number
  2125.             returns     the cosine of the number
  2126.  
  2127.         (tan <expr>)  COMPUTE THE TANGENT OF A NUMBER
  2128.             <expr>      the floating point number
  2129.             returns     the tangent of the number
  2130.  
  2131.         (expt <x-expr> <y-expr>)  COMPUTE X TO THE Y POWER
  2132.             <x-expr>    the floating point number
  2133.             <y-expr>    the floating point exponent
  2134.             returns     x to the y power
  2135.  
  2136.         (exp <x-expr>)  COMPUTE E TO THE X POWER
  2137.             <x-expr>    the floating point number
  2138.             returns     e to the x power
  2139.  
  2140.         (sqrt <expr>)  COMPUTE THE SQUARE ROOT OF A NUMBER
  2141.             <expr>      the floating point number
  2142.             returns     the square root of the number
  2143.  
  2144.  
  2145.  
  2146.  
  2147.  
  2148.  
  2149.  
  2150.  
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.         XLISP              BITWISE LOGICAL FUNCTIONS             Page 34
  2183.  
  2184.  
  2185.         BITWISE LOGICAL FUNCTIONS
  2186.  
  2187.         (bit-and <expr>...)  THE BITWISE AND OF A LIST OF NUMBERS
  2188.             <expr>      the numbers
  2189.             returns     the result of the and operation
  2190.  
  2191.         (bit-ior <expr>...)  THE BITWISE INCLUSIVE OR OF A LIST OF NUMBERS
  2192.             <expr>      the numbers
  2193.             returns     the result of the inclusive or operation
  2194.  
  2195.         (bit-xor <expr>...)  THE BITWISE EXCLUSIVE OR OF A LIST OF NUMBERS
  2196.             <expr>      the numbers
  2197.             returns     the result of the exclusive or operation
  2198.  
  2199.         (bit-not <expr>)  THE BITWISE NOT OF A NUMBER
  2200.             <expr>      the number
  2201.             returns     the bitwise inversion of number
  2202.  
  2203.  
  2204.  
  2205.  
  2206.  
  2207.  
  2208.  
  2209.  
  2210.  
  2211.  
  2212.  
  2213.  
  2214.  
  2215.  
  2216.  
  2217.  
  2218.  
  2219.  
  2220.  
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.         XLISP                 RELATIONAL FUNCTIONS               Page 35
  2249.  
  2250.  
  2251.         RELATIONAL FUNCTIONS
  2252.  
  2253.         The relational functions can be used to compare integers,
  2254.         floating point numbers or strings.
  2255.  
  2256.         (< <e1> <e2>)  TEST FOR LESS THAN
  2257.             <e1>        the left operand of the comparison
  2258.             <e2>        the right operand of the comparison
  2259.             returns     the result of comparing <e1> with <e2>
  2260.  
  2261.         (<= <e1> <e2>)  TEST FOR LESS THAN OR EQUAL TO
  2262.             <e1>        the left operand of the comparison
  2263.             <e2>        the right operand of the comparison
  2264.             returns     the result of comparing <e1> with <e2>
  2265.  
  2266.         (= <e1> <e2>)  TEST FOR EQUAL TO
  2267.             <e1>        the left operand of the comparison
  2268.             <e2>        the right operand of the comparison
  2269.             returns     the result of comparing <e1> with <e2>
  2270.  
  2271.         (/= <e1> <e2>)  TEST FOR NOT EQUAL TO
  2272.             <e1>        the left operand of the comparison
  2273.             <e2>        the right operand of the comparison
  2274.             returns     the result of comparing <e1> with <e2>
  2275.  
  2276.         (>= <e1> <e2>)  TEST FOR GREATER THAN OR EQUAL TO
  2277.             <e1>        the left operand of the comparison
  2278.             <e2>        the right operand of the comparison
  2279.             returns     the result of comparing <e1> with <e2>
  2280.  
  2281.         (> <e1> <e2>)  TEST FOR GREATER THAN
  2282.             <e1>        the left operand of the comparison
  2283.             <e2>        the right operand of the comparison
  2284.             returns     the result of comparing <e1> with <e2>
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.         XLISP                   STRING FUNCTIONS                 Page 36
  2315.  
  2316.  
  2317.         STRING FUNCTIONS
  2318.  
  2319.         (char <string> <index>)  EXTRACT A CHARACTER FROM A STRING
  2320.             <string>    the string
  2321.             <index>     the string index (zero relative)
  2322.             returns     the ascii code of the character
  2323.  
  2324.         (string <expr>)  MAKE A STRING FROM AN INTEGER ASCII VALUE
  2325.             <expr>      the integer
  2326.             returns     a one character string
  2327.  
  2328.         (strcat [<expr>]...)  CONCATENATE STRINGS
  2329.             <expr>      the strings to concatenate
  2330.             returns     the result of concatenating the strings
  2331.  
  2332.         (substr <expr> <sexpr> [<lexpr>]) EXTRACT A SUBSTRING
  2333.             <expr>      the string
  2334.             <sexpr>     the starting position
  2335.             <lexpr>     the length (default is rest of string)
  2336.             returns     substring starting at <sexpr> for <lexpr>
  2337.  
  2338.  
  2339.  
  2340.  
  2341.  
  2342.  
  2343.  
  2344.  
  2345.  
  2346.  
  2347.  
  2348.  
  2349.  
  2350.  
  2351.  
  2352.  
  2353.  
  2354.  
  2355.  
  2356.  
  2357.  
  2358.  
  2359.  
  2360.  
  2361.  
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380.         XLISP                INPUT/OUTPUT FUNCTIONS              Page 37
  2381.  
  2382.  
  2383.         INPUT/OUTPUT FUNCTIONS
  2384.  
  2385.         (read [<source> [<eof> [<rflag>]]])  READ AN XLISP EXPRESSION
  2386.             <source>    the input source (default is standard input)
  2387.             <eof>       the value to return on end of file (default is nil)
  2388.             <rflag>     recursive read flag (default is nil)
  2389.             returns     the expression read
  2390.  
  2391.         (print <expr> [<sink>])  PRINT A LIST OF VALUES ON A NEW LINE
  2392.             <expr>      the expressions to be printed
  2393.             <sink>      the output sink (default is standard output)
  2394.             returns     the expression
  2395.  
  2396.         (prin1 <expr> [<sink>])  PRINT A LIST OF VALUES
  2397.             <expr>      the expressions to be printed
  2398.             <sink>      the output sink (default is standard output)
  2399.             returns     the expression
  2400.  
  2401.         (princ <expr> [<sink>])  PRINT A LIST OF VALUES WITHOUT QUOTING
  2402.             <expr>      the expressions to be printed
  2403.             <sink>      the output sink (default is standard output)
  2404.             returns     the expression
  2405.  
  2406.         (terpri [<sink>])  TERMINATE THE CURRENT PRINT LINE
  2407.             <sink>      the output sink (default is standard output)
  2408.             returns     nil
  2409.  
  2410.         (flatsize <expr>)  LENGTH OF PRINTED REPRESENTATION USING PRIN1
  2411.             <expr>      the expression
  2412.             returns     the length
  2413.  
  2414.         (flatc <expr>)  LENGTH OF PRINTED REPRESENTATION USING PRINC
  2415.             <expr>      the expression
  2416.             returns     the length
  2417.  
  2418.  
  2419.  
  2420.  
  2421.  
  2422.  
  2423.  
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.         XLISP                  FILE I/O FUNCTIONS                Page 38
  2447.  
  2448.  
  2449.         FILE I/O FUNCTIONS
  2450.  
  2451.         (openi <fname>)  OPEN AN INPUT FILE
  2452.             <fname>     the file name string or symbol
  2453.             returns     a file pointer
  2454.  
  2455.         (openo <fname>)  OPEN AN OUTPUT FILE
  2456.             <fname>     the file name string or symbol
  2457.             returns     a file pointer
  2458.  
  2459.         (close <fp>)  CLOSE A FILE
  2460.             <fp>        the file pointer
  2461.             returns     nil
  2462.  
  2463.         (read-char [<source>])  READ A CHARACTER FROM A FILE OR STREAM
  2464.             <source>    the input source (default is standard input)
  2465.             returns     the character (integer)
  2466.  
  2467.         (peek-char [<flag> [<source>]])  PEEK AT THE NEXT CHARACTER
  2468.             <flag>      flag for skipping white space (default is nil)
  2469.             <source>    the input source (default is standard input)
  2470.             returns     the character (integer)
  2471.  
  2472.         (write-char <ch> [<sink>])  WRITE A CHARACTER TO A FILE OR STREAM
  2473.             <ch>        the character to put (integer)
  2474.             <sink>      the output sink (default is standard output)
  2475.             returns     the character (integer)
  2476.  
  2477.         (read-line [<source>])  READ A LINE FROM A FILE OR STREAM
  2478.             <source>    the input source (default is standard input)
  2479.             returns     the input string
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.  
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.         XLISP                   SYSTEM FUNCTIONS                 Page 39
  2513.  
  2514.  
  2515.         SYSTEM FUNCTIONS
  2516.  
  2517.         (load <fname> [<vflag> [<pflag>]])  LOAD AN XLISP SOURCE FILE
  2518.             <fname>     the filename string or symbol
  2519.             <vflag>     the verbose flag (default is t)
  2520.             <pflag>     the print flag (default is nil)
  2521.             returns     the filename
  2522.  
  2523.         (gc)  FORCE GARBAGE COLLECTION
  2524.             returns     nil
  2525.  
  2526.         (expand <num>)  EXPAND MEMORY BY ADDING SEGMENTS
  2527.             <num>       the number of segments to add
  2528.             returns     the number of segments added
  2529.  
  2530.         (alloc <num>)  CHANGE NUMBER OF NODES TO ALLOCATE IN EACH SEGMENT
  2531.             <num>       the number of nodes to allocate
  2532.             returns     the old number of nodes to allocate
  2533.  
  2534.         (mem)  SHOW MEMORY ALLOCATION STATISTICS
  2535.             returns     nil
  2536.  
  2537.         (type-of <expr>)  RETURNS THE TYPE OF THE EXPRESSION
  2538.             <expr>      the expression to return the type of
  2539.             returns     nil if the value is nil otherwise one of the symbols:
  2540.                           :SYMBOL for symbols
  2541.                           :OBJECT for objects
  2542.                           :CONS   for conses
  2543.                           :SUBR   for built-ins with evaluated arguments
  2544.                           :FSUBR  for built-ins with unevaluated arguments
  2545.                           :STRING for strings
  2546.                           :FIXNUM for integers
  2547.                           :FLONUM for floating point numbers
  2548.                           :FILE   for file pointers
  2549.                           :ARRAY  for arrays
  2550.  
  2551.         (exit)  EXIT XLISP
  2552.             returns     never returns
  2553.  
  2554.  
  2555.  
  2556.  
  2557.  
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.  
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575.