home *** CD-ROM | disk | FTP | other *** search
/ PC-Blue - MS DOS Public Domain Library / PC-Blue MS-DOS Public Domain Library - NYACC.iso / vol080 / xlisp.doc < prev    next >
Encoding:
Text File  |  1987-01-14  |  28.7 KB  |  895 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.               XLISP: An Experimental Object Oriented Language
  7.  
  8.  
  9.                                      by
  10.                                  David Betz
  11.                              114 Davenport Ave.
  12.                            Manchester, NH  03103
  13.  
  14.                                (603) 625-4691
  15.  
  16.  
  17.         XLISP is an experimental programming language combining some
  18.         of  the  features  of LISP with an object oriented extension
  19.         capability.  It was  implemented  to  allow  experimentation
  20.         with  object oriented programming on small computers.  There
  21.         are currently implementations running on  the  PDP-11  under
  22.         RSX-11,  RT-11, and UNIX V7, on the VAX-11 under VAX/VMS and
  23.         Berkeley VAX/UNIX and on the Z-80 running  CP/M-80.   It  is
  24.         completely  written  in  the programming language 'C' and is
  25.         believed to be easily extended  with  user  written  builtin
  26.         functions  and  classes.  It is available free of charge and
  27.         is in the public domain.
  28.  
  29.         Many traditional LISP functions are built  into  XLISP.   In
  30.         addition,   XLISP   defines  the  object  classes  'Object',
  31.         'Class', and 'Keymap' as primitives.  'Object' is  the  only
  32.         class  that  has  no superclass and hence is the root of the
  33.         class heirarchy tree.  'Class' is the  class  of  which  all
  34.         classes  are  instances  (it  is  the only object that is an
  35.         instance of itself).  'Keymap' is a  class  whose  instances
  36.         are mappings from input key sequences to messages.
  37.  
  38.         This document is intended  to  be  a  brief  description  of
  39.         XLISP.    It   assumes  some  knowledge  of  LISP  and  some
  40.         understanding   of   the   concepts   of   object   oriented
  41.         programming.
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.         XLISP: An Experimental Object Oriented Language       Page 2
  52.         XLISP Command Loop
  53.  
  54.  
  55.         When XLISP is started, it issues the following prompt:
  56.  
  57.         >
  58.  
  59.         This indicates that XLISP is waiting for an expression to be
  60.         typed.   When  an  incomplete expression has been typed (one
  61.         where the left and right parens don't match)  XLISP  changes
  62.         its prompt to:
  63.  
  64.         n>
  65.  
  66.         where n is an integer indicating how many levels  of  parens
  67.         remain unclosed.
  68.  
  69.         When a complete expression has been entered, XLISP  attempts
  70.         to  evaluate  that  expression.  If the expression evaluates
  71.         successfully, XLISP prints the result of the evaluation  and
  72.         then  returns  to  the  initial  prompt  waiting for another
  73.         expression to be typed.
  74.  
  75.         Input can be aborted at any time  by  typing  the  EOF  key.
  76.         Another EOF will exit from XLISP.
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.         XLISP: An Experimental Object Oriented Language       Page 3
  87.         DATA TYPES AND THE EVALUATOR
  88.  
  89.  
  90.         XLISP data types
  91.  
  92.         There are several different data types  available  to  XLISP
  93.         programmers.
  94.  
  95.  
  96.               o  symbols
  97.  
  98.               o  strings
  99.  
  100.               o  integers
  101.  
  102.               o  objects
  103.  
  104.               o  file pointers
  105.  
  106.               o  lists
  107.  
  108.               o  subrs (builtin functions)
  109.  
  110.  
  111.         The XLISP evaluator
  112.  
  113.         The process of evaluation in XLISP:
  114.  
  115.               o  Integers,  strings,  objects,  file  pointers,  and
  116.                  subrs evaluate to themselves
  117.  
  118.               o  Symbols evaluate to the value associated with their
  119.                  current binding
  120.  
  121.               o  Lists are evaluated by evaluating the first element
  122.                  of the list
  123.  
  124.                   o  If it evaluates to a subr, the builtin function
  125.                      is  executed  using the remaining list elements
  126.                      as arguments (they are evaluated  by  the  subr
  127.                      itself)
  128.  
  129.                   o  If it evaluates to a list, the list is  assumed
  130.                      to be a function definition and the function is
  131.                      evaluated using the  values  of  the  remaining
  132.                      list elements as arguments
  133.  
  134.                   o  If it evaluates to an object, the  second  list
  135.                      element  is  evaluated  and  used  as a message
  136.                      selector.  The message formed by combining  the
  137.                      selector  with the values of the remaining list
  138.                      elements is sent to the object.
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.         XLISP: An Experimental Object Oriented Language       Page 4
  151.         LEXICAL CONVENTIONS
  152.  
  153.  
  154.         XLISP lexical conventions:
  155.  
  156.         The following conventions are followed when  entering  XLISP
  157.         programs:
  158.  
  159.         Comments in XLISP code begin with a semi-colon character and
  160.         continue to the end of the line.
  161.  
  162.         Symbol names  in  XLISP  can  consist  of  any  sequence  of
  163.         non-blank printable characters except the following:
  164.  
  165.                 ( ) . ' " ;
  166.  
  167.         Symbol names must not begin with a digit.
  168.  
  169.         Integer literals consist of a sequence of digits  optionally
  170.         beginning with a '+' or '-'.  The range of values an integer
  171.         can represent is limited by the size of a  C  'int'  on  the
  172.         machine that XLISP is running on.
  173.  
  174.         Literal strings are sequences of  characters  surrounded  by
  175.         double  quotes.   Within quoted strings the '\' character is
  176.         used to allow non-printable characters to be included.   The
  177.         codes recognized are:
  178.  
  179.                 \\      means the character '\'
  180.                 \n      means newline
  181.                 \t      means tab
  182.                 \r      means return
  183.                 \e      means escape
  184.                 \nnn    means the character whose octal code is nnn
  185.  
  186.         The single quote character can be used as a shorthand for  a
  187.         call on the function 'quote':
  188.  
  189.                                 'foo
  190.         is equivalent to:
  191.                                 (quote foo)
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.         XLISP: An Experimental Object Oriented Language       Page 5
  202.         OBJECTS
  203.  
  204.  
  205.         Objects:
  206.  
  207.         Definitions:
  208.  
  209.               o  selector - a symbol used to select  an  appropriate
  210.                  method
  211.  
  212.               o  message - a selector and a list of actual arguments
  213.  
  214.               o  method - the code that implements a message
  215.  
  216.         Since XLISP was  created  to  provide  a  simple  basis  for
  217.         experimenting  with  object oriented programming, one of the
  218.         primitive data types included was 'object'.   In  XLISP,  an
  219.         object  consists of a data structure containing a pointer to
  220.         the object's class as well as a list containing  the  values
  221.         of the object's instance variables.
  222.  
  223.         Officially, there is no way to see inside an object (look at
  224.         the  values  of  its  instance  variables).  The only way to
  225.         communicate with an object is by sending it a message.  When
  226.         the  XLISP  evaluator  evaluates  a  list the value of whose
  227.         first element is an object, it interprets the value  of  the
  228.         second  element  of the list (which must be a symbol) as the
  229.         message selector.  The evaluator determines the class of the
  230.         receiving object and attempts to find a method corresponding
  231.         to the message selector in the set of messages  defined  for
  232.         that  class.   If  the  message is not found in the object's
  233.         class and the class has a super-class, the search  continues
  234.         by  looking  at  the  messages  defined for the super-class.
  235.         This process continues from  one  super-class  to  the  next
  236.         until  a  method  for the message is found.  If no method is
  237.         found, an error occurs.
  238.  
  239.         When a method is found, the evaluator  binds  the  receiving
  240.         object  to  the  symbol 'self', binds the class in which the
  241.         method was found to the symbol 'msgclass', and evaluates the
  242.         method  using the remaining elements of the original list as
  243.         arguments  to  the  method.   These  arguments  are   always
  244.         evaluated prior to being bound to their corresponding formal
  245.         arguments.  The result of evaluating the method becomes  the
  246.         result of the expression.
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.         XLISP: An Experimental Object Oriented Language       Page 6
  257.         OBJECTS
  258.  
  259.  
  260.         Classes:
  261.  
  262.         Object  THE TOP OF THE CLASS HEIRARCHY
  263.  
  264.             Messages:
  265.  
  266.                 print   THE DEFAULT OBJECT PRINT ROUTINE
  267.                     returns     the object
  268.  
  269.                 show    SHOW AN OBJECT'S INSTANCE VARIABLES
  270.                     returns     the object
  271.  
  272.                 class   RETURN THE CLASS OF AN OBJECT
  273.                     returns     the class of the object
  274.  
  275.                 isnew   THE DEFAULT OBJECT INITIALIZATION ROUTINE
  276.                     returns     the object
  277.  
  278.                 sendsuper <sel> [<args>...] SEND SUPERCLASS A MESSAGE
  279.                     <sel>       the message selector
  280.                     <args>      the message arguments
  281.                     returns     the result of sending the message
  282.  
  283.  
  284.         Class   THE CLASS OF ALL OBJECT CLASSES (including itself)
  285.  
  286.             Messages:
  287.  
  288.                 new     CREATE A NEW INSTANCE OF A CLASS
  289.                     returns     the new class object
  290.  
  291.                 isnew [<scls>]  INITIALIZE A NEW CLASS
  292.                     <scls>      the superclass
  293.                     returns     the new class object
  294.  
  295.                 answer <msg> <fargs> <code>     ADD A MESSAGE TO A CLASS
  296.                     <msg>       the message symbol
  297.                     <fargs>     the formal argument list
  298.                                   this list is of the form:
  299.                                     (<farg>... [/ <local>...])
  300.                                   where
  301.                                     <farg>      a formal argument
  302.                                     <local>     a local variable
  303.                     <code>      a list of executable expressions
  304.                     returns     the object
  305.  
  306.                 ivars <vars>    DEFINE THE LIST OF INSTANCE VARIABLES
  307.                     <vars>      the list of instance variable symbols
  308.                     returns     the object
  309.  
  310.                 cvars <vars>    DEFINE THE LIST OF CLASS VARIABLES
  311.                     <vars>      the list of class variable symbols
  312.                     returns     the object
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.         XLISP: An Experimental Object Oriented Language       Page 7
  323.         OBJECTS
  324.  
  325.  
  326.         When a new instance of a class is  created  by  sending  the
  327.         message  'new'  to  an  existing  class, the message 'isnew'
  328.         followed by whatever parameters were  passed  to  the  'new'
  329.         message is sent to the newly created object.
  330.  
  331.         When a new class is created by sending the 'new' message  to
  332.         the  object  'Class', an optional parameter may be specified
  333.         indicating of which class the newly generated class is to be
  334.         a  subclass.   If  this  parameter is omitted, the new class
  335.         will be a subclass of 'Object'.
  336.  
  337.          Example:
  338.  
  339.             ; create 'Foo' as a subclass of 'Object'
  340.             (setq Foo (Class 'new))
  341.  
  342.             ; create 'Bar' as a subclass of 'Foo'
  343.             (setq Bar (Class 'new Foo))
  344.  
  345.         A class inherits all instance  variables,  class  variables,
  346.         and methods from its super-class.
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.         XLISP: An Experimental Object Oriented Language       Page 8
  357.         OBJECTS
  358.  
  359.  
  360.         The 'Keymap' Class:
  361.  
  362.         A keymap is data structure that  translates  a  sequence  of
  363.         keystrokes into a message.
  364.  
  365.         In order to create a keymap:
  366.  
  367.                 (setq km (Keymap 'new))
  368.  
  369.         In order to add a key definition to a keymap (km):
  370.  
  371.                 (km 'key "\eA" 'up)
  372.                 (km 'key "\eB" 'down)
  373.                 (km 'key "\eC" 'right)
  374.                 (km 'key "\eD" 'left)
  375.  
  376.         Executing a keymap:
  377.  
  378.                 (setq env (list ob1 ob2 ob3 ob4))
  379.                 (km 'process env)
  380.  
  381.         When the process  message  is  sent,  its  method  enters  a
  382.         character  input  loop  calling  kbin to get single unechoed
  383.         characters from the keyboard.  When a sequence of characters
  384.         is  found that matches one of the sequences defined in a key
  385.         function call,  the  corresponding  message  is  sent.   The
  386.         method  tries  to send the message to each of the objects in
  387.         the environment list.  It stops when it finds an object that
  388.         knows  how  to  answer  the message.  Along with the message
  389.         selector given  in  the  key  definition,  the  sequence  of
  390.         matched characters is passed as a single string parameter.
  391.  
  392.             Keymap
  393.  
  394.                 new     CREATE A NEW KEYMAP
  395.                     returns     a new keymap
  396.  
  397.                 isnew   INITIALIZE THE NEW KEYMAP
  398.                     returns     the keymap
  399.  
  400.                 key <kstr> <ksym>       ADD A KEY DEFINITION TO A KEYMAP
  401.                     <kstr>      the string defining the key
  402.                     <ksym>      the symbol for the message
  403.                     returns     the keymap
  404.  
  405.                 process <envlist>       PROCESS INPUT USING A KEYMAP
  406.                     <envlist>   list of active objects
  407.                     returns     the keymap when a message evaluates to nil
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.         XLISP: An Experimental Object Oriented Language       Page 9
  418.         SYMBOLS
  419.  
  420.  
  421.         Symbols:
  422.  
  423.  
  424.               o  self  -  the  current  object  (within  a   message
  425.                  context)
  426.  
  427.               o  msgclass - the class in which  the  current  method
  428.                  was found
  429.  
  430.               o  currentenv - the environment list for  the  current
  431.                  invocation of kmprocess
  432.  
  433.               o  oblist - the object list
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.         XLISP: An Experimental Object Oriented Language      Page 10
  445.         FUNCTIONS
  446.  
  447.  
  448.         Utility functions:
  449.  
  450.         (load <fname>)  LOAD AN XLISP SOURCE FILE
  451.             <fname>     the filename string
  452.             returns     the filename
  453.  
  454.         (mem)   SHOW MEMORY ALLOCATION STATISTICS
  455.             returns     nil
  456.  
  457.         (gc)    FORCE GARBAGE COLLECTION
  458.             returns     nil
  459.  
  460.         (alloc <num>)   CHANGE NUMBER OF NODES TO ALLOCATE IN EACH SEGMENT
  461.             <num>       the number of nodes to allocate
  462.             returns     the old number of nodes to allocate
  463.  
  464.         (expand <num>)  EXPAND MEMORY BY ADDING SEGMENTS
  465.             <num>       the number of segments to add
  466.             returns     the number of segments added
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.         XLISP: An Experimental Object Oriented Language      Page 11
  477.         FUNCTIONS
  478.  
  479.  
  480.         Functions:
  481.  
  482.         (eval <expr>)   EVALUATE AN XLISP EXPRESSION
  483.             <expr>      the expression to be evaluated
  484.             returns     the result of evaluating the expression
  485.  
  486.         (set <sym> <expr>)      SET THE VALUE OF A SYMBOL
  487.             <sym>       the symbol being set
  488.             <expr>      the new value
  489.             returns     the new value
  490.  
  491.         (setq <qsym> <expr>)    SET THE VALUE OF A SYMBOL
  492.             <qsym>      the symbol being set (quoted)
  493.             <expr>      the new value
  494.             returns     the new value
  495.  
  496.         (print <expr>...)       PRINT A LIST OF VALUES
  497.             <expr>      the expressions to be printed
  498.             returns     nil
  499.  
  500.         (princ <expr>...)       PRINT A LIST OF VALUES WITHOUT QUOTING
  501.             <expr>      the expressions to be printed
  502.             returns     nil
  503.  
  504.         (quote <expr>)  RETURN AN EXPRESSION UNEVALUATED
  505.         or
  506.         '<expr>
  507.             <expr>      the expression to be quoted (quoted)
  508.             returns     <expr> unevaluated
  509.  
  510.         (if <texpr> <expr1> [ <expr2> ])  EXECUTE EXPRESSIONS CONDITIONALLY
  511.             <texpr>     test expression
  512.             <expr1>     expression evaluated if texpr is non-nil or non-zero
  513.             <expr2>     expression evaluated if texpr is nil or zero
  514.             returns     the value of the expression evaluated
  515.  
  516.         (while <texpr> <expr>...)       ITERATE WHILE AN EXPRESSION IS TRUE
  517.             <texpr>     test expression evaluated at start of each iteration
  518.             <expr>      expressions evaluated as long as <texpr> evaluates to
  519.                         non-nil or non-zero
  520.             returns     the result of the last expression evaluated
  521.  
  522.         (repeat <iexpr> <expr>...)      ITERATE USING A REPEAT COUNT
  523.             <iexpr>     integer expression indicating the repeat count
  524.             <expr>      expressions evaluated <iexpr> times
  525.             returns     the result of the last expression evaluated
  526.  
  527.         (foreach <qsym> <list> <expr>...) ITERATE FOR EACH ELEMENT IN A LIST
  528.             <qsym>      symbol to assign each list element to (quoted)
  529.             <list>      list to iterate through
  530.             <expr>      expressions evaluated for each element in the list
  531.             returns     the result of the last expression evaluated
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.  
  541.         XLISP: An Experimental Object Oriented Language      Page 12
  542.         FUNCTIONS
  543.  
  544.  
  545.         (defun <qsym> <qfargs> <expr>...)       DEFINE A NEW FUNCTION
  546.             <qsym>      symbol to be defined (quoted)
  547.             <qfargs>    list of formal arguments (quoted)
  548.                           this list is of the form:
  549.                             (<farg>... [/ <local>...])
  550.                           where
  551.                             <farg>      is a formal argument
  552.                             <local>     is a local variable
  553.             <expr>      expressions constituting the body of the
  554.                         function (quoted)
  555.             returns     the function symbol
  556.  
  557.         (cond <pair>...)        EVALUATE CONDITIONALLY
  558.             <pair>      pair consisting of:
  559.                             (<pred> <expr>)
  560.                           where
  561.                             <pred>      is a predicate expression
  562.                             <expr>      is evaluated if the predicate
  563.                                         is not nil
  564.             returns     the value of the first expression whose predicate
  565.                         is not nil
  566.  
  567.         (exit)  EXIT XLISP
  568.             returns     never returns
  569.  
  570.  
  571.  
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.         XLISP: An Experimental Object Oriented Language      Page 13
  579.         FUNCTIONS
  580.  
  581.  
  582.         I/O Functions:
  583.  
  584.         (fopen <fname> <mode>)  OPEN A FILE
  585.             <fname>     the file name string
  586.             <mode>      the open mode string
  587.             returns     a file pointer
  588.  
  589.         (fclose <fp>)   CLOSE A FILE
  590.             <fp>        the file pointer
  591.             returns     nil
  592.  
  593.         (getc [<fp>])   GET A CHARACTER FROM A FILE
  594.             <fp>        the file pointer (default is stdin)
  595.             returns     the character (integer)
  596.  
  597.         (putc <ch> [<fp>])      PUT A CHARACTER TO A FILE
  598.             <ch>        the character to put (integer)
  599.             <fp>        the file pointer (default is stdout)
  600.             returns     the character (integer)
  601.  
  602.         (fgets [<fp>])  GET A STRING FROM A FILE
  603.             <fp>        the file pointer (default is stdin)
  604.             returns     the input string
  605.  
  606.         (fputs <str> [<fp>]) PUT A STRING TO A FILE
  607.             <str>       the string to output
  608.             <fp>        the file pointer (default is stdout)
  609.             returns     the string
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618.  
  619.         XLISP: An Experimental Object Oriented Language      Page 14
  620.         FUNCTIONS
  621.  
  622.  
  623.         String Functions:
  624.  
  625.         (strcat <expr>...) CONCATENATE STRINGS
  626.             <expr>      string expressions
  627.             returns     result of concatenating the strings
  628.  
  629.         (strlen <expr>) COMPUTE THE LENGTH OF A STRING
  630.             <expr>      the string expression
  631.             returns     the length of the string
  632.  
  633.         (substr <expr> <sexpr> [<lexpr>]) RETURN SUBSTRING
  634.             <expr>      string expression
  635.             <sexpr>     starting position
  636.             <lexpr>     optional length (default is rest of string)
  637.             returns     substring starting at <sexpr> for <lexpr>
  638.  
  639.         (ascii <expr>)  NUMERIC VALUE OF CHARACTER
  640.             <expr>      string expression
  641.             returns     numeric value of first character (according to ASCII)
  642.  
  643.         (chr <expr>)    CHARACTER EQUIVALENT OF ASCII VALUE
  644.             <expr>      numeric expression
  645.             returns     one character string with ASCII equivalent of <expr>
  646.  
  647.         (atoi <expr>)   CONVERT AN ASCII STRING TO AN INTEGER
  648.             <expr>      string expression
  649.             returns     the integer value of the string expression
  650.  
  651.         (itoa <expr>)   CONVERT AN INTEGER TO AN ASCII STRING
  652.             <expr>      integer expression
  653.             returns     the string representation of the integer value
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.         XLISP: An Experimental Object Oriented Language      Page 15
  664.         FUNCTIONS
  665.  
  666.  
  667.         List Functions:
  668.  
  669.         (head <expr>)   RETURN THE HEAD ELEMENT OF A LIST
  670.         or
  671.         (car <expr)
  672.             <expr>      the list
  673.             returns     the first element of the list
  674.  
  675.         (tail <expr>)   RETURN THE TAIL ELEMENTS OF A LIST
  676.         or
  677.         (cdr <expr>)
  678.             <expr>      the list
  679.             returns     the list minus the first element
  680.  
  681.         (list <expr>...)        CREATE A LIST OF VALUES
  682.             <expr>      evaluated expressions to be combined into a list
  683.             returns     the new list
  684.  
  685.         (nth <n> <list>)        RETURN THE NTH ELEMENT OF A LIST
  686.             <n>         the number of the element to return
  687.             <list>      the list to return the nth element of
  688.             returns     the nth element or nil if the list isn't that long
  689.  
  690.         (append <expr>...)      APPEND LISTS
  691.             <expr>      lists whose elements are to be appended
  692.             returns     the new list
  693.  
  694.         (cons <e1> <e2>)        CONSTRUCT A NEW LIST ELEMENT
  695.             <e1>        becomes the head (car) of the new list
  696.             <e2>        becomes the tail (cdr) of the new list
  697.             returns     the new list
  698.  
  699.         (null <expr>)   CHECKS FOR AN EMPTY LIST
  700.             <expr>      the list to check
  701.             returns     t if the list is empty, nil otherwise
  702.  
  703.         (atom <expr>)   CHECKS FOR AN ATOM (ANYTHING THAT ISN'T A LIST)
  704.             <expr>      the expression to check
  705.             returns     t if the value is an atom, nil otherwise
  706.  
  707.         (listp <expr>)  CHECKS FOR A LIST
  708.             <expr>      the expression to check
  709.             returns     t if the value is a list, nil otherwise
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.         XLISP: An Experimental Object Oriented Language      Page 16
  720.         FUNCTIONS
  721.  
  722.  
  723.         (type <expr>)   RETURNS THE TYPE OF THE EXPRESSION
  724.             <expr>      the expression to return the type of
  725.             returns     nil if the value is nil otherwise one of the symbols:
  726.                             SYM  for symbols
  727.                             OBJ  for objects
  728.                             LIST for list nodes
  729.                             KMAP for keymap nodes
  730.                             SUBR for internal subroutine nodes
  731.                             STR  for string nodes
  732.                             INT  for integer nodes
  733.                             FPTR for file pointer nodes
  734.  
  735.         (eq <expr1> <expr2>)    CHECKS FOR THE EXPRESSIONS BEING THE SAME
  736.             <expr1>     the first expression
  737.             <expr2>     the second expression
  738.             returns     t if they are equal, nil otherwise
  739.  
  740.         (equal <expr1> <expr2>) CHECKS FOR THE EXPRESSIONS BEING EQUAL
  741.             <expr1>     the first expression
  742.             <expr2>     the second expression
  743.             returns     t if they are equal, nil otherwise
  744.  
  745.         (read [ <str> ])        READ AN XLISP EXPRESSION
  746.             <str>       the string to use as input (optional)
  747.             returns     the expression read
  748.  
  749.         (reverse <expr>)        REVERSE A LIST
  750.             <expr>      the list to reverse
  751.             returns     a new list in the reverse order
  752.  
  753.         (length <expr>) FIND THE LENGTH OF A LIST
  754.             <expr>      the list to find the length of
  755.             returns     the length
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.         XLISP: An Experimental Object Oriented Language      Page 17
  766.         FUNCTIONS
  767.  
  768.  
  769.         Arithmetic Functions:
  770.  
  771.         (+ <expr>...)   ADD A LIST OF VALUES
  772.             <expr>      expressions to be added
  773.             returns     the result of the addition
  774.  
  775.         (- <expr>...)   SUBTRACT A LIST OF VALUES
  776.             <expr>      expressions to be subtracted
  777.             returns     the result of the subtraction
  778.  
  779.         (* <expr>...)   MULTIPLY A LIST OF VALUES
  780.             <expr>      expressions to be multiplied
  781.             returns     the result of the multiplication
  782.  
  783.         (/ <expr>...)   DIVIDE A LIST OF VALUES
  784.             <expr>      expressions to be divided
  785.             returns     the result of the division
  786.  
  787.         (% <expr>...)   MODulus A LIST OF VALUES
  788.             <expr>      expressions to be MODulused
  789.             returns     the result of mod
  790.  
  791.         (& <expr>...)   THE BITWISE AND OF A LIST OF VALUES
  792.             <expr>      expressions to be ANDed
  793.             returns     the bit by bit ANDing of expressions
  794.  
  795.         (| <expr...)    THE BITWISE OR OF A LIST OF VALUES
  796.             <expr>      expressions to be ORed
  797.             returns     the bit by bit ORing of expressions
  798.  
  799.         (~ <expr>)      THE BITWISE NOT OF A VALUE
  800.             <expr>      expression to be NOTed
  801.             returns     the bit by bit inversion of expression
  802.  
  803.         (min <expr>...) THE SMALLEST OF A LIST OF VALUES
  804.             <expr>      expressions to be checked
  805.             returns     the smallest value of the list
  806.  
  807.         (max <expr>...) THE LARGEST OF A LIST OF VALUES
  808.             <expr>      expressions to be checked
  809.             returns     the largest value of the list
  810.  
  811.         (abs <expr>)    THE ABSOLUTE VALUE OF AN EXPRESSION
  812.             <expr>      integer expression
  813.             returns     the absolute value of the expression
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.         XLISP: An Experimental Object Oriented Language      Page 18
  824.         FUNCTIONS
  825.  
  826.  
  827.         Boolean Functions:
  828.  
  829.         (&& <expr>...)  THE LOGICAL AND OF A LIST OF VALUES
  830.             <expr>      expressions to be ANDed
  831.             returns     the result of anding the expressions
  832.                         (evaluation of expressions stops after the first
  833.                          expression that evaluates to false)
  834.  
  835.         (|| <expr>...)  THE LOGICAL OR OF A LIST OF VALUES
  836.             <expr>      expressions to be ORed
  837.             returns     the result of oring the expressions
  838.                         (evaluation of expressions stops after the first
  839.                          expression that evaluates to true)
  840.  
  841.         (! <expr>)      THE LOGICAL NOT OF A VALUE
  842.             <expr>      expression to be NOTed
  843.             return      logical not of <expr>
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.         XLISP: An Experimental Object Oriented Language      Page 19
  854.         FUNCTIONS
  855.  
  856.  
  857.         Relational Functions:
  858.  
  859.         The relational functions can be used to compare integers and
  860.         strings.   The  functions  '==' and '!=' can also be used to
  861.         compare other types.  The result  of  these  comparisons  is
  862.         computed the same way as for 'eq'.
  863.  
  864.         (< <e1> <e2>)   TEST FOR LESS THAN
  865.             <e1>        the left operand of the comparison
  866.             <e2>        the right operand of the comparison
  867.             returns     the result of comparing <e1> with <e2>
  868.  
  869.         (<= <e1> <e2>)  TEST FOR LESS THAN OR EQUAL TO
  870.             <e1>        the left operand of the comparison
  871.             <e2>        the right operand of the comparison
  872.             returns     the result of comparing <e1> with <e2>
  873.  
  874.         (== <e1> <e2>)  TEST FOR EQUAL TO
  875.             <e1>        the left operand of the comparison
  876.             <e2>        the right operand of the comparison
  877.             returns     the result of comparing <e1> with <e2>
  878.  
  879.         (!= <e1> <e2>)  TEST FOR NOT EQUAL TO
  880.             <e1>        the left operand of the comparison
  881.             <e2>        the right operand of the comparison
  882.             returns     the result of comparing <e1> with <e2>
  883.  
  884.         (>= <e1> <e2>)  TEST FOR GREATER THAN OR EQUAL TO
  885.             <e1>        the left operand of the comparison
  886.             <e2>        the right operand of the comparison
  887.             returns     the result of comparing <e1> with <e2>
  888.  
  889.         (> <e1> <e2>)   TEST FOR GREATER THAN
  890.             <e1>        the left operand of the comparison
  891.             <e2>        the right operand of the comparison
  892.             returns     the result of comparing <e1> with <e2>
  893.  
  894.  
  895. Press ENTER to continue: