home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol118 / xlisp.doc < prev    next >
Encoding:
Text File  |  1984-04-29  |  27.8 KB  |  748 lines

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