[net.sources] xlisp version 1.4

winkler@harvard.ARPA (Dan Winkler) (02/03/85)

Although XLISP 1.2 has just been distributed to this news group, David's 
latest version is actually version 1.4.  

David can now be reached by electronic mail at the Harvard Vax as 
betz@harvard.ARPA or harvard!betz.  

wegrzyn@encore.UUCP (Chuck Wegrzyn) (03/13/85)

This is the start of the xlisp, version 1.4 sources. There
are 5 files in the set. If you have any problems in getting
all the files, please contact me at

	{allegra,decvax,ihnp4}!encore!wegrzyn

P.S. Have fun! Would everyone that uses it please contact me, we
	could from a 'private newsgroup' and exchange modifications,
	programs, information.

#	This is a shell archive.
#	Remove everything above and including the cut line.
#	Then run the rest of the file through sh.
-----cut here-----cut here-----cut here-----cut here-----
#!/bin/sh
# shar:	Shell Archiver
#	Run the following text with /bin/sh to create:
#	xlisp.doc
# This archive created: Wed Mar 13 08:43:51 1985
echo shar: extracting xlisp.doc '(53349 characters)'
sed 's/^XX//' << \SHAR_EOF > xlisp.doc
XX
XX
XX
XX
XX
XX            XLISP: An Experimental Object Oriented Language
XX
XX                              Version 1.4
XX
XX                            January 1, 1985
XX
XX
XX                                   by
XX                               David Betz
XX                           114 Davenport Ave.
XX                         Manchester, NH  03103
XX
XX                         (603) 625-4691 (home)
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                 Page 2
XX      TABLE OF CONTENTS
XX
XX
XX              1.0     INTRODUCTION . . . . . . . . . . . . . . . . . . . . 3
XX              2.0     A NOTE FROM THE AUTHOR . . . . . . . . . . . . . . . 4
XX              3.0     XLISP COMMAND LOOP . . . . . . . . . . . . . . . . . 5
XX              4.0     BREAK COMMAND LOOP . . . . . . . . . . . . . . . . . 6
XX              5.0     DATA TYPES . . . . . . . . . . . . . . . . . . . . . 7
XX              6.0     THE EVALUATOR  . . . . . . . . . . . . . . . . . . . 8
XX              7.0     LEXICAL CONVENTIONS  . . . . . . . . . . . . . . . . 9
XX              8.0     OBJECTS  . . . . . . . . . . . . . . . . . . . . .  10
XX              9.0     SYMBOLS  . . . . . . . . . . . . . . . . . . . . .  13
XX              10.0    EVALUATION FUNCTIONS . . . . . . . . . . . . . . .  14
XX              11.0    SYMBOL FUNCTIONS . . . . . . . . . . . . . . . . .  15
XX              12.0    PROPERTY LIST FUNCTIONS  . . . . . . . . . . . . .  17
XX              13.0    LIST FUNCTIONS . . . . . . . . . . . . . . . . . .  18
XX              14.0    DESTRUCTIVE LIST FUNCTIONS . . . . . . . . . . . .  21
XX              15.0    PREDICATE FUNCTIONS  . . . . . . . . . . . . . . .  22
XX              16.0    CONTROL FUNCTIONS  . . . . . . . . . . . . . . . .  24
XX              17.0    LOOPING FUNCTIONS  . . . . . . . . . . . . . . . .  25
XX              18.0    THE PROGRAM FEATURE  . . . . . . . . . . . . . . .  26
XX              19.0    DEBUGGING AND ERROR HANDLING . . . . . . . . . . .  27
XX              20.0    ARITHMETIC FUNCTIONS . . . . . . . . . . . . . . .  28
XX              21.0    BITWISE LOGICAL FUNCTIONS  . . . . . . . . . . . .  29
XX              22.0    RELATIONAL FUNCTIONS . . . . . . . . . . . . . . .  30
XX              23.0    STRING FUNCTIONS . . . . . . . . . . . . . . . . .  31
XX              24.0    INPUT/OUTPUT FUNCTIONS . . . . . . . . . . . . . .  32
XX              25.0    FILE I/O FUNCTIONS . . . . . . . . . . . . . . . .  33
XX              26.0    SYSTEM FUNCTIONS . . . . . . . . . . . . . . . . .  34
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                 Page 3
XX      INTRODUCTION
XX
XX
XX      1.0  INTRODUCTION
XX
XX      XLISP is an experimental programming language combining some
XX      of  the  features  of LISP with an object oriented extension
XX      capability.  It was  implemented  to  allow  experimentation
XX      with  object oriented programming on small computers.  There
XX      are currently implementations running on  the  PDP-11  under
XX      UNIX  V7, on the VAX-11 under VAX/VMS and Berkeley VAX/UNIX,
XX      and on the 8088/8086 under CP/M-86 or MS-DOS.  A version  is
XX      currently  being  developed for the 68000 under CP/M-68K and
XX      for the Apple Macintosh.  It is completely  written  in  the
XX      programming  language  'C'  and is easily extended with user
XX      written built-in functions and classes.  It is available  in
XX      source   form   free  of  charge  to  non-commercial  users.
XX      Prospective commercial users should contact the  author  for
XX      permission to use XLISP.
XX
XX      Many traditional LISP functions are built  into  XLISP.   In
XX      addition,  XLISP defines the objects 'Object' and 'Class' as
XX      primitives.   'Object'  is  the  only  class  that  has   no
XX      superclass  and  hence  is  the  root of the class heirarchy
XX      tree.  'Class'  is  the  class  of  which  all  classes  are
XX      instances  (it  is  the  only  object that is an instance of
XX      itself).
XX
XX      This document is intended  to  be  a  brief  description  of
XX      XLISP.    It   assumes  some  knowledge  of  LISP  and  some
XX      understanding   of   the   concepts   of   object   oriented
XX      programming.
XX
XX      Version 1.2 of XLISP differs from  version  1.1  in  several
XX      ways.   It  supports  many  more Lisp functions.  Also, many
XX      version 1.1  functions  have  been  renamed  and/or  changed
XX      slightly  to follow traditional Lisp usage.  One of the most
XX      frequently reported problems in version  1.1  resulted  from
XX      many  functions being named after their equivilent functions
XX      in the C language.  This turned  out  to  be  confusing  for
XX      people who were trying to learn XLISP using traditional LISP
XX      texts as references.  Version 1.2 renames these functions to
XX      be  compatible  with  more  traditional  dialects  of  LISP.
XX      Version 1.3 introduces many new  LISP  functions  and  moves
XX      closer  to the goal of being compatible with the Common Lisp
XX      standard.  Version 1.4 introduces user  error  handling  and
XX      breakpoint  support  as  well as more Common Lisp compatible
XX      functions.
XX
XX      A recommended text for learning LISP programming is the book
XX      "LISP"  by Winston and Horn and published by Addison Wesley.
XX      The first edition of this book is based on MacLisp  and  the
XX      second  edition is based on Common Lisp.  Future versions of
XX      XLISP will continue to migrate  towards  compatibility  with
XX      Common Lisp.
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                 Page 4
XX      A NOTE FROM THE AUTHOR
XX
XX
XX      2.0  A NOTE FROM THE AUTHOR
XX
XX      If you have any problems with XLISP, feel free to contact me
XX      for  help  or  advice.   Please remember that since XLISP is
XX      available in source form in  a  high  level  language,  many
XX      users  have  been  making versions available on a variety of
XX      machines.  If you call to report a problem with  a  specific
XX      version,  I may not be able to help you if that version runs
XX      on a machine to which I don't have access.  Please have  the
XX      version  number  of the version that you are running readily
XX      accessible before calling me.
XX
XX      If you find a bug  in  XLISP,  first  try  to  fix  the  bug
XX      yourself  using  the  source  code  provided.   If  you  are
XX      successful in fixing the bug, send the bug report along with
XX      the  fix to me.  If you don't have access to a C compiler or
XX      are unable to fix a bug, please send the bug  report  to  me
XX      and I'll try to fix it.
XX
XX      Any suggestions for improvements  will  be  welcomed.   Feel
XX      free  to  extend  the  language  in  whatever way suits your
XX      needs.  However, PLEASE DO  NOT  RELEASE  ENHANCED  VERSIONS
XX      WITHOUT  CHECKING  WITH  ME  FIRST!!  I would like to be the
XX      clearing house for new features added to XLISP.  If you want
XX      to  add  features for your own personal use, go ahead.  But,
XX      if you want to distribute your enhanced version, contact  me
XX      first.  Please remember that the goal of XLISP is to provide
XX      a language to learn and  experiment  with  LISP  and  object
XX      oriented programming on small computers.
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                 Page 5
XX      XLISP COMMAND LOOP
XX
XX
XX      3.0  XLISP COMMAND LOOP
XX
XX      When XLISP is started, it first  tries  to  load  "init.lsp"
XX      from  the  default directory.  It then loads any files named
XX      as parameters on the command line (after appending ".lsp" to
XX      their names).  It then issues the following prompt:
XX
XX      >
XX
XX      This indicates that XLISP is waiting for an expression to be
XX      typed.   When  an  incomplete expression has been typed (one
XX      where the left and right parens don't match)  XLISP  changes
XX      its prompt to:
XX
XX      n>
XX
XX      where n is an integer indicating how  many  levels  of  left
XX      parens remain unclosed.
XX
XX      When a complete expression has been entered, XLISP  attempts
XX      to  evaluate  that  expression.  If the expression evaluates
XX      successfully, XLISP prints the result of the evaluation  and
XX      then  returns  to  the  initial  prompt  waiting for another
XX      expression to be typed.
XX
XX      Input can be aborted at any time by typing the CONTROL-G key
XX      (it may be necessary to follow CONTROL-G by RETURN).
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                 Page 6
XX      BREAK COMMAND LOOP
XX
XX
XX      4.0  BREAK COMMAND LOOP
XX
XX      When  XLISP  encounters  an  error   while   evaluating   an
XX      expression, it attempts to handle the error in the following
XX      way:
XX
XX      If  the  symbol  '*breakenable*'  is   true,   the   message
XX      corresponding  to  the  error  is  printed.  If the error is
XX      correctable, the correction  message  is  printed.   If  the
XX      symbol '*tracenable*' is true, a trace back is printed.  The
XX      number of entries printed depends on the value of the symbol
XX      '*tracelimit*'.   If  this  symbol is set to something other
XX      than a number, the  entire  trace  back  stack  is  printed.
XX      XLISP  then  enters a read/eval/print loop to allow the user
XX      to examine the state of the interpreter in  the  context  of
XX      the  error.   This  loop  differs  from the normal top-leval
XX      read/eval/print loop in that if the user  types  the  symbol
XX      'continue' XLISP will continue from a correctable error.  If
XX      the user types the symbol 'quit' XLISP will abort the  break
XX      loop  and return to the top level or the next lower numbered
XX      break loop.  When in a break loop, XLISP prefixes the  break
XX      level to the normal prompt.
XX
XX      If the symbol '*breakenable*' is  nil,  XLISP  looks  for  a
XX      surrounding   errset  function.   If  one  is  found,  XLISP
XX      examines the value of the print flag.  If this flag is true,
XX      the error message is printed.  In any case, XLISP causes the
XX      errset function call to return nil.
XX
XX      If there is no surrounding errset function, XLISP prints the
XX      error message and returns to the top level.
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                 Page 7
XX      DATA TYPES
XX
XX
XX      5.0  DATA TYPES
XX
XX      There are several different data types  available  to  XLISP
XX      programmers.
XX
XX
XX            o  lists
XX
XX            o  symbols
XX
XX            o  strings
XX
XX            o  integers
XX
XX            o  objects
XX
XX            o  file pointers
XX
XX            o  subrs/fsubrs (built-in functions)
XX
XX      Another data type is the stream.  A stream is  a  list  node
XX      whose car points to the head of a list of integers and whose
XX      cdr points to the last list node  of  the  list.   An  empty
XX      stream  is  a  list node whose car and cdr are nil.  Each of
XX      the integers in the  list  represents  a  character  in  the
XX      stream.   When  a character is read from a stream, the first
XX      integer from the head of the list is removed  and  returned.
XX      When  a  character  is  written  to  a  stream,  the integer
XX      representing the character code of the character is appended
XX      to  the  end of the list.  When a function indicates that it
XX      takes an input source as a  parameter,  this  parameter  can
XX      either  be  an  input  file pointer or a stream.  Similarly,
XX      when a function indicates that it takes an output sink as  a
XX      parameter,  this  parameter  can  either  be  an output file
XX      pointer or a stream.
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                 Page 8
XX      THE EVALUATOR
XX
XX
XX      6.0  THE EVALUATOR
XX
XX      The process of evaluation in XLISP:
XX
XX            o  Integers,  strings,  objects,  file  pointers,  and
XX               subrs evaluate to themselves
XX
XX            o  Symbols evaluate to the value associated with their
XX               current binding
XX
XX            o  Lists are evaluated by evaluating the first element
XX               of the list
XX
XX                o  If it evaluates to a subr, the  remaining  list
XX                   elements  are  evaluated and the subr is called
XX                   with these evaluated expressions as arguments.
XX
XX                o  If it evaluates  to  an  fsubr,  the  fsubr  is
XX                   called  using  the  remaining  list elements as
XX                   arguments  (they  are  evaluated  by  the  subr
XX                   itself if necessary)
XX
XX                o  If it evaluates to a list and the  car  of  the
XX                   list  is  'lambda', the remaining list elements
XX                   are evaluated and the resulting expressions are
XX                   bound  to  the  formal  arguments of the lambda
XX                   expression.   The  body  of  the  function   is
XX                   executed within this new binding environment.
XX
XX                o  If it evaluates to a list and the  car  of  the
XX                   list  is  'macro',  the remaining list elements
XX                   are bound to the formal arguments of the  macro
XX                   expression.    The  body  of  the  function  is
XX                   executed within this new  binding  environment.
XX                   The result of this evaluation is considered the
XX                   macro expansion.  This result is then evaluated
XX                   in place of the original expression.
XX
XX                o  If it evaluates to an object, the  second  list
XX                   element  is  evaluated  and  used  as a message
XX                   selector.  The message formed by combining  the
XX                   selector  with the values of the remaining list
XX                   elements is sent to the object.
XX
XX
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                 Page 9
XX      LEXICAL CONVENTIONS
XX
XX
XX      7.0  LEXICAL CONVENTIONS
XX
XX      The following conventions are followed when  entering  XLISP
XX      programs:
XX
XX      Comments in XLISP code begin with a semi-colon character and
XX      continue to the end of the line.
XX
XX      Symbol names  in  XLISP  can  consist  of  any  sequence  of
XX      non-blank printable characters except the following:
XX
XX              ( ) ' ` , " ;
XX
XX      Upper and lower case characters are distinct.   The  symbols
XX      'CAR' and 'car' are not the same.  The names of all built-in
XX      functions are in lower case.   The  names  of  all  built-in
XX      objects  are  lower  case  with  an initial capital.  Symbol
XX      names must not begin with a digit.
XX
XX      Integer literals consist of a sequence of digits  optionally
XX      beginning with a '+' or '-'.  The range of values an integer
XX      can represent is limited by the size of a  C  'int'  on  the
XX      machine that XLISP is running on.
XX
XX      Literal strings are sequences of  characters  surrounded  by
XX      double  quotes.   Within quoted strings the '\' character is
XX      used to allow non-printable characters to be included.   The
XX      codes recognized are:
XX
XX              \\      means the character '\'
XX              \n      means newline
XX              \t      means tab
XX              \r      means return
XX              \e      means escape
XX              \nnn    means the character whose octal code is nnn
XX
XX      XLISP defines several useful read macros:
XX
XX              '<expr>  == (quote <expr>)
XX              #'<expr> == (function <expr>)
XX              `<expr>  == (backquote <expr>)
XX              ,<expr>  == (comma <expr>)
XX              ,@<expr> == (comma-at <expr>)
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                Page 10
XX      OBJECTS
XX
XX
XX      8.0  OBJECTS
XX
XX      Definitions:
XX
XX            o  selector - a symbol used to select  an  appropriate
XX               method
XX
XX            o  message - a selector and a list of actual arguments
XX
XX            o  method - the code that implements a message
XX
XX      Since XLISP was  created  to  provide  a  simple  basis  for
XX      experimenting  with  object oriented programming, one of the
XX      primitive data types included was 'object'.   In  XLISP,  an
XX      object  consists of a data structure containing a pointer to
XX      the object's class as well as a list containing  the  values
XX      of the object's instance variables.
XX
XX      Officially, there is no way to see inside an object (look at
XX      the  values  of  its  instance  variables).  The only way to
XX      communicate with an object is by sending it a message.  When
XX      the  XLISP  evaluator  evaluates  a  list the value of whose
XX      first element is an object, it interprets the value  of  the
XX      second  element  of the list (which must be a symbol) as the
XX      message selector.  The evaluator determines the class of the
XX      receiving object and attempts to find a method corresponding
XX      to the message selector in the set of messages  defined  for
XX      that  class.   If  the  message is not found in the object's
XX      class and the class has a super-class, the search  continues
XX      by  looking  at  the  messages  defined for the super-class.
XX      This process continues from  one  super-class  to  the  next
XX      until  a  method  for the message is found.  If no method is
XX      found, an error occurs.
XX
XX      When a method is found, the evaluator  binds  the  receiving
XX      object  to  the  symbol 'self', binds the class in which the
XX      method was found to the symbol 'msgclass', and evaluates the
XX      method  using the remaining elements of the original list as
XX      arguments  to  the  method.   These  arguments  are   always
XX      evaluated prior to being bound to their corresponding formal
XX      arguments.  The result of evaluating the method becomes  the
XX      result of the expression.
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                Page 11
XX      OBJECTS
XX
XX
XX      Classes:
XX
XX      Object  THE TOP OF THE CLASS HEIRARCHY
XX
XX          Messages:
XX
XX              show    SHOW AN OBJECT'S INSTANCE VARIABLES
XX                  returns     the object
XX
XX              class   RETURN THE CLASS OF AN OBJECT
XX                  returns     the class of the object
XX
XX              isnew   THE DEFAULT OBJECT INITIALIZATION ROUTINE
XX                  returns     the object
XX
XX              sendsuper <sel> [<args>...] SEND SUPERCLASS A MESSAGE
XX                  <sel>       the message selector
XX                  <args>      the message arguments
XX                  returns     the result of sending the message
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                Page 12
XX      OBJECTS
XX
XX
XX      Class   THE CLASS OF ALL OBJECT CLASSES (including itself)
XX
XX          Messages:
XX
XX              new     CREATE A NEW INSTANCE OF A CLASS
XX                  returns     the new class object
XX
XX              isnew [<scls>]  INITIALIZE A NEW CLASS
XX                  <scls>      the superclass
XX                  returns     the new class object
XX
XX              answer <msg> <fargs> <code>     ADD A MESSAGE TO A CLASS
XX                  <msg>       the message symbol
XX                  <fargs>     the formal argument list
XX                                this list is of the form:
XX                                  (<farg>...
XX                                   [&optional <oarg>...]
XX                                   [&rest <rarg>]
XX                                   [&aux <aux>...])
XX                                where
XX                                  <farg>   a formal argument
XX                                  <oarg>   an optional argument (default is nil)
XX                                  <rarg>   bound to the rest of the arguments
XX                                  <aux>    a auxiliary variable (set to nil)
XX                  <code>      a list of executable expressions
XX                  returns     the object
XX
XX              ivars <vars>    DEFINE THE LIST OF INSTANCE VARIABLES
XX                  <vars>      the list of instance variable symbols
XX                  returns     the object
XX
XX              cvars <vars>    DEFINE THE LIST OF CLASS VARIABLES
XX                  <vars>      the list of class variable symbols
XX                  returns     the object
XX
XX
XX      When a new instance of a class is  created  by  sending  the
XX      message  'new'  to  an  existing  class, the message 'isnew'
XX      followed by whatever parameters were  passed  to  the  'new'
XX      message is sent to the newly created object.
XX
XX      When a new class is created by sending the 'new' message  to
XX      the  object  'Class', an optional parameter may be specified
XX      indicating  the  superclass  of  the  new  class.   If  this
XX      parameter  is  omitted,  the new class will be a subclass of
XX      'Object'.  A class inherits all  instance  variables,  class
XX      variables, and methods from its super-class.
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                Page 13
XX      SYMBOLS
XX
XX
XX      9.0  SYMBOLS
XX
XX
XX            o  self  -  the  current  object  (within  a   message
XX               context)
XX
XX            o  msgclass - the class in which  the  current  method
XX               was found
XX
XX            o  *oblist* - the object list
XX
XX            o  *keylist* - the keyword list
XX
XX            o  *standard-input* - the standard input file
XX
XX            o  *standard-output* - the standard output file
XX
XX            o  *breakenable* - flag controlling entering the break
XX               loop on errors
XX
XX            o  *tracenable* - flag controlling trace back printout
XX               on errors and breaks
XX
XX            o  *tracelimit* - maximum number of  levels  of  trace
XX               back information printed on errors and breaks
XX
XX            o  *evalhook* -  user  substitute  for  the  evaluator
XX               function
XX
XX            o  *applyhook* - (not yet implemented)
XX
XX            o  *unbound* - indicator for unbound symbols
XX
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                Page 14
XX      EVALUATION FUNCTIONS
XX
XX
XX      10.0  EVALUATION FUNCTIONS
XX
XX      (eval <expr>)  EVALUATE AN XLISP EXPRESSION
XX          <expr>      the expression to be evaluated
XX          returns     the result of evaluating the expression
XX
XX      (apply <fun> <args>)  APPLY A FUNCTION TO A LIST OF ARGUMENTS
XX          <fun>       the function to apply (or function symbol)
XX          <args>      the argument list
XX          returns     the result of applying the function to the argument list
XX
XX      (funcall <fun> <arg>...)  CALL A FUNCTION WITH ARGUMENTS
XX          <fun>       the function to call (or function symbol)
XX          <arg>       arguments to pass to the function
XX          returns     the result of calling the function with the arguments
XX
XX      (quote <expr>)  RETURN AN EXPRESSION UNEVALUATED
XX          <expr>      the expression to be quoted (quoted)
XX          returns     <expr> unevaluated
XX
XX      (function <expr>)  QUOTE A FUNCTION (THIS IS THE SAME AS QUOTE)
XX          <expr>      the function to be quoted (quoted)
XX          returns     <expr> unevaluated
XX
XX      (backquote <expr>)  FILL IN A TEMPLATE
XX          <expr>      the template
XX          returns     a copy of the template with comma and comma-at expressions
XX                      expanded (see the Common Lisp reference manual)
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                Page 15
XX      SYMBOL FUNCTIONS
XX
XX
XX      11.0  SYMBOL FUNCTIONS
XX
XX      (set <sym> <expr>)  SET THE VALUE OF A SYMBOL
XX          <sym>       the symbol being set
XX          <expr>      the new value
XX          returns     the new value
XX
XX      (setq [<sym> <expr>]...)  SET THE VALUE OF A SYMBOL
XX          <sym>       the symbol being set (quoted)
XX          <expr>      the new value
XX          returns     the new value
XX
XX      (setf [<place> <expr>]...)  SET THE VALUE OF A FIELD
XX          <place>     the field specifier (quoted):
XX                          <sym>                set the value of a symbol
XX                          (car <expr>)         set the car of a list node
XX                          (cdr <expr>)         set the cdr of a list node
XX                          (get <sym> <prop>)   set the value of a property
XX                          (symbol-value <sym>) set the value of a symbol
XX                          (symbol-plist <sym>) set the property list of a symbol
XX          <value>     the new value
XX          returns     the new value
XX
XX      (defun <sym> <fargs> <expr>...)  DEFINE A FUNCTION
XX      (defmacro <sym> <fargs> <expr>...)  DEFINE A MACRO
XX          <sym>       symbol being defined (quoted)
XX          <fargs>     list of formal arguments (quoted)
XX                        this list is of the form:
XX                          (<farg>...
XX                           [&optional <oarg>...]
XX                           [&rest <rarg>]
XX                           [&aux <aux>...])
XX                        where
XX                          <farg>      is a formal argument
XX                          <oarg>      is an optional argument (default is nil)
XX                          <rarg>      bound to the rest of the arguments
XX                          <aux>       is an auxiliary variable (set to nil)
XX          <expr>      expressions constituting the body of the
XX                      function (quoted)
XX          returns     the function symbol
XX
XX      (gensym [<tag>])  GENERATE A SYMBOL
XX          <tag>       string or number
XX          returns     the new symbol
XX
XX      (intern <pname>)  MAKE AN INTERNED SYMBOL
XX          <pname>     the symbol's print name string
XX          returns     the new symbol
XX
XX      (make-symbol <pname>)  MAKE AN UNINTERNED SYMBOL
XX          <pname>     the symbol's print name string
XX          returns     the new symbol
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                Page 16
XX      SYMBOL FUNCTIONS
XX
XX
XX      (symbol-name <sym>)  GET THE PRINT NAME OF A SYMBOL
XX          <sym>       the symbol
XX          returns     the symbol's print name
XX
XX      (symbol-value <sym>)  GET THE VALUE OF A SYMBOL
XX          <sym>       the symbol
XX          returns     the symbol's value
XX
XX      (symbol-plist <sym>)  GET THE PROPERTY LIST OF A SYMBOL
XX          <sym>       the symbol
XX          returns     the symbol's property list
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                Page 17
XX      PROPERTY LIST FUNCTIONS
XX
XX
XX      12.0  PROPERTY LIST FUNCTIONS
XX
XX      (get <sym> <prop>)  GET THE VALUE OF A PROPERTY
XX          <sym>       the symbol
XX          <prop>      the property symbol
XX          returns     the property value or nil
XX
XX      (remprop <prop> <sym>)  REMOVE A PROPERTY
XX          <sym>       the symbol
XX          <prop>      the property symbol
XX          returns     nil
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                Page 18
XX      LIST FUNCTIONS
XX
XX
XX      13.0  LIST FUNCTIONS
XX
XX      (car <expr>)  RETURN THE CAR OF A LIST NODE
XX          <expr>      the list node
XX          returns     the car of the list node
XX
XX      (cdr <expr>)  RETURN THE CDR OF A LIST NODE
XX          <expr>      the list node
XX          returns     the cdr of the list node
XX
XX      (caar <expr>) == (car (car <expr>))
XX      (cadr <expr>) == (car (cdr <expr>))
XX      (cdar <expr>) == (cdr (car <expr>))
XX      (cddr <expr>) == (cdr (cdr <expr>))
XX
XX      (cons <expr1> <expr2>)  CONSTRUCT A NEW LIST NODE
XX          <expr1>     the car of the new list node
XX          <expr2>     the cdr of the new list node
XX          returns     the new list node
XX
XX      (list <expr>...)  CREATE A LIST OF VALUES
XX          <expr>      expressions to be combined into a list
XX          returns     the new list
XX
XX      (append <expr>...)  APPEND LISTS
XX          <expr>      lists whose elements are to be appended
XX          returns     the new list
XX
XX      (reverse <expr>)  REVERSE A LIST
XX          <expr>      the list to reverse
XX          returns     a new list in the reverse order
XX
XX      (last <list>)  RETURN THE LAST LIST NODE OF A LIST
XX          <list>      the list
XX          returns     the last list node in the list
XX
XX      (member <expr> <list> [<key> <test>])  FIND AN EXPRESSION IN A LIST
XX          <expr>      the expression to find
XX          <list>      the list to search
XX          <key>       the keyword :test or :test-not
XX          <test>      the test function (defaults to eql)
XX          returns     the remainder of the list starting with the expression
XX
XX      (assoc <expr> <alist> [<key> <test>])  FIND AN EXPRESSION IN AN A-LIST
XX          <expr>      the expression to find
XX          <alist>     the association list
XX          <key>       the keyword :test or :test-not
XX          <test>      the test function (defaults to eql)
XX          returns     the alist entry or nil
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                Page 19
XX      LIST FUNCTIONS
XX
XX
XX      (remove <expr> <list> [<key> <test>])  REMOVE AN EXPRESSION FROM A LIST
XX          <expr>      the expression to delete
XX          <list>      the list
XX          <key>       the keyword :test or :test-not
XX          <test>      the test function (defaults to eql)
XX          returns     the list with the matching expressions deleted
XX
XX      (length <expr>)  FIND THE LENGTH OF A LIST
XX          <expr>      the list
XX          returns     the length of the list
XX
XX      (nth <n> <list>)  RETURN THE NTH ELEMENT OF A LIST
XX          <n>         the number of the element to return (zero origin)
XX          <list>      the list
XX          returns     the nth element or nil if the list isn't that long
XX
XX      (nthcdr <n> <list>)  RETURN THE NTH CDR OF A LIST
XX          <n>         the number of the element to return (zero origin)
XX          <list>      the list
XX          returns     the nth cdr or nil if the list isn't that long
XX
XX      (mapc <fcn> <list1>...<listn>)  APPLY FUNCTION TO SUCCESSIVE CARS
XX          <fcn>       the function or function name
XX          <list1..n>  a list for each argument of the function
XX          returns     the first list of arguments
XX
XX      (mapcar <fcn> <list1>...<listn>)  APPLY FUNCTION TO SUCCESSIVE CARS
XX          <fcn>       the function or function name
XX          <list1..n>  a list for each argument of the function
XX          returns     the list of values returned by each function invocation
XX
XX      (mapl <fcn> <list1>...<listn>)  APPLY FUNCTION TO SUCCESSIVE CDRS
XX          <fcn>       the function or function name
XX          <list1..n>  a list for each argument of the function
XX          returns     the first list of arguments
XX
XX      (maplist <fcn> <list1>...<listn>)  APPLY FUNCTION TO SUCCESSIVE CDRS
XX          <fcn>       the function or function name
XX          <list1..n>  a list for each argument of the function
XX          returns     the list of values returned by each function invocation
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                Page 20
XX      LIST FUNCTIONS
XX
XX
XX      (subst <to> <from> <expr> [<key> <test>])  SUBSTITUTE EXPRESSIONS
XX          <to>        the new expression
XX          <from>      the old expression
XX          <expr>      the expression in which to do the substitutions
XX          <key>       the keyword :test or :test-not
XX          <test>      the test function (defaults to eql)
XX          returns     the expression with substitutions
XX
XX      (sublis <alist> <expr> [<key> <test>])  SUBSTITUTE USING AN A-LIST
XX          <alist>     the association list
XX          <expr>      the expression in which to do the substitutions
XX          <key>       the keyword :test or :test-not
XX          <test>      the test function (defaults to eql)
XX          returns     the expression with substitutions
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                Page 21
XX      DESTRUCTIVE LIST FUNCTIONS
XX
XX
XX      14.0  DESTRUCTIVE LIST FUNCTIONS
XX
XX      (rplaca <list> <expr>)  REPLACE THE CAR OF A LIST NODE
XX          <list>      the list node
XX          <expr>      the new value for the car of the list node
XX          returns     the list node after updating the car
XX
XX      (rplacd <list> <expr>)  REPLACE THE CDR OF A LIST NODE
XX          <list>      the list node
XX          <expr>      the new value for the cdr of the list node
XX          returns     the list node after updating the cdr
XX
XX      (nconc <list>...)  DESTRUCTIVELY CONCATENATE LISTS
XX          <list>      lists to concatenate
XX          returns     the result of concatenating the lists
XX
XX      (delete <expr> <list> [<key> <test>])  DELETE AN EXPRESSION FROM A LIST
XX          <expr>      the expression to delete
XX          <list>      the list
XX          <key>       the keyword :test or :test-not
XX          <test>      the test function (defaults to eql)
XX          returns     the list with the matching expressions deleted
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                Page 22
XX      PREDICATE FUNCTIONS
XX
XX
XX      15.0  PREDICATE FUNCTIONS
XX
XX      (atom <expr>)  IS THIS AN ATOM?
XX          <expr>      the expression to check
XX          returns     t if the value is an atom, nil otherwise
XX
XX      (symbolp <expr>)  IS THIS A SYMBOL?
XX          <expr>      the expression to check
XX          returns     t if the expression is a symbol, nil otherwise
XX
XX      (numberp <expr>)  IS THIS A NUMBER?
XX          <expr>      the expression to check
XX          returns     t if the expression is a symbol, nil otherwise
XX
XX      (null <expr>)  IS THIS AN EMPTY LIST?
XX          <expr>      the list to check
XX          returns     t if the list is empty, nil otherwise
XX
XX      (not <expr>)  IS THIS FALSE?
XX          <expr>      the expression to check
XX          return      t if the expression is nil, nil otherwise
XX
XX      (listp <expr>)  IS THIS A LIST?
XX          <expr>      the expression to check
XX          returns     t if the value is a list node or nil, nil otherwise
XX
XX      (consp <expr>)  IS THIS A NON-EMPTY LIST?
XX          <expr>      the expression to check
XX          returns     t if the value is a list node, nil otherwise
XX
XX      (boundp <sym>)  IS THIS A BOUND SYMBOL?
XX          <sym>       the symbol
XX          returns     t if a value is bound to the symbol, nil otherwise
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                Page 23
XX      PREDICATE FUNCTIONS
XX
XX
XX      (minusp <expr>)  IS THIS NUMBER NEGATIVE?
XX          <expr>      the number to test
XX          returns     t if the number is negative, nil otherwise
XX
XX      (zerop <expr>)  IS THIS NUMBER ZERO?
XX          <expr>      the number to test
XX          returns     t if the number is zero, nil otherwise
XX
XX      (plusp <expr>)  IS THIS NUMBER POSITIVE?
XX          <expr>      the number to test
XX          returns     t if the number is positive, nil otherwise
XX
XX      (evenp <expr>)  IS THIS NUMBER EVEN?
XX          <expr>      the number to test
XX          returns     t if the number is even, nil otherwise
XX
XX      (oddp <expr>)  IS THIS NUMBER ODD?
XX          <expr>      the number to test
XX          returns     t if the number is odd, nil otherwise
XX
XX      (eq <expr1> <expr2>)  ARE THE EXPRESSIONS IDENTICAL?
XX          <expr1>     the first expression
XX          <expr2>     the second expression
XX          returns     t if they are equal, nil otherwise
XX
XX      (eql <expr1> <expr2>)  ARE THE EXPRESSIONS IDENTICAL?
XX                              (WORKS WITH NUMBERS AND STRINGS)
XX          <expr1>     the first expression
XX          <expr2>     the second expression
XX          returns     t if they are equal, nil otherwise
XX
XX      (equal <expr1> <expr2>)  ARE THE EXPRESSIONS EQUAL?
XX          <expr1>     the first expression
XX          <expr2>     the second expression
XX          returns     t if they are equal, nil otherwise
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                Page 24
XX      CONTROL FUNCTIONS
XX
XX
XX      16.0  CONTROL FUNCTIONS
XX
XX      (cond <pair>...)  EVALUATE CONDITIONALLY
XX          <pair>      pair consisting of:
XX                          (<pred> <expr>...)
XX                        where
XX                          <pred>      is a predicate expression
XX                          <expr>      evaluated if the predicate
XX                                      is not nil
XX          returns     the value of the first expression whose predicate
XX                      is not nil
XX
XX      (and <expr>...)  THE LOGICAL AND OF A LIST OF EXPRESSIONS
XX          <expr>...   the expressions to be ANDed
XX          returns     nil if any expression evaluates to nil,
XX                      otherwise the value of the last expression
XX                      (evaluation of expressions stops after the first
XX                       expression that evaluates to nil)
XX
XX      (or <expr>...)  THE LOGICAL OR OF A LIST OF EXPRESSIONS
XX          <expr>...   the expressions to be ORed
XX          returns     nil if all expressions evaluate to nil,
XX                      otherwise the value of the first non-nil expression
XX                      (evaluation of expressions stops after the first
XX                       expression that does not evaluate to nil)
XX
XX      (if <texpr> <expr1> [<expr2>])  EXECUTE EXPRESSIONS CONDITIONALLY
XX          <texpr>     the test expression
XX          <expr1>     the expression to be evaluated if texpr is non-nil
XX          <expr2>     the expression to be evaluated if texpr is nil
XX          returns     the value of the selected expression
XX
XX      (let (<binding>...) <expr>...)  BIND SYMBOLS AND EVALUATE EXPRESSIONS
XX      (let* (<binding>...) <expr>...)  LET WITH SEQUENTIAL BINDING
XX          <binding>   the variable bindings each of which is either:
XX                      1)  a symbol (which is initialized to nil)
XX                      2)  a list whose car is a symbol and whose cadr
XX                              is an initialization expression
XX          <expr>...   the expressions to be evaluated
XX          returns     the value of the last expression
XX
XX      (catch <sym> [<expr>]...)  EVALUATE EXPRESSIONS AND CATCH THROWS
XX          <sym>       the catch tag
XX          <expr>...   expressions to evaluate
XX          returns     the value of the last expression the throw expression
XX
XX      (throw <sym> [<expr>])  THROW TO A CATCH
XX          <sym>       the catch tag
XX          <expr>      the value for the catch to return (defaults to nil)
XX          returns     never returns
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                Page 25
XX      LOOPING FUNCTIONS
XX
XX
XX      17.0  LOOPING FUNCTIONS
XX
XX      (do ([<binding>]...) (<texpr> [<rexpr>]...) [<expr>]...)
XX      (do* ([<binding>]...) (<texpr> [<rexpr>]...) [<expr>]...)
XX          <binding>   the variable bindings each of which is either:
XX                      1)  a symbol (which is initialized to nil)
XX                      2)  a list of the form: (<sym> <init> [<step>])
XX                          where:
XX                              <sym>  is the symbol to bind
XX                              <init> is the initial value of the symbol
XX                              <step> is a step expression
XX          <texpr>     the termination test expression
XX          <rexpr>...  result expressions (the default is nil)
XX          <expr>...   the body of the loop (treated like an implicit prog)
XX          returns     the value of the last result expression
XX
XX      (dolist (<sym> <expr> [<rexpr>]) [<expr>]...)  LOOP THROUGH A LIST
XX          <sym>       the symbol to bind to each list element
XX          <expr>      the list expression
XX          <rexpr>     the result expression (the default is nil)
XX          <expr>...   the body of the loop (treated like an implicit prog)
XX
XX      (dotimes (<sym> <expr> [<rexpr>]) [<expr>]...)  LOOP FROM ZERO TO N-1
XX          <sym>       the symbol to bind to each value from 0 to n-1
XX          <expr>      the number of times to loop
XX          <rexpr>     the result expression (the default is nil)
XX          <expr>...   the body of the loop (treated like an implicit prog)
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                Page 26
XX      THE PROGRAM FEATURE
XX
XX
XX      18.0  THE PROGRAM FEATURE
XX
XX      (prog (<binding>...) [<expr>]...)  THE PROGRAM FEATURE
XX      (prog* (<binding>...) [<expr>]...)  PROG WITH SEQUENTIAL BINDING
XX          <binding>   the variable bindings each of which is either:
XX                      1)  a symbol (which is initialized to nil)
XX                      2)  a list whose car is a symbol and whose cadr
XX                              is an initialization expression
XX          <expr>      expressions to evaluate or tags (symbols)
XX          returns     nil or the argument passed to the return function
XX
XX      (go <sym>)  GO TO A TAG WITHIN A PROG CONSTRUCT
XX          <sym>       the tag (quoted)
XX          returns     never returns
XX
XX      (return [<expr>])  CAUSE A PROG CONSTRUCT TO RETURN A VALUE
XX          <expr>      the value (defaults to nil)
XX          returns     never returns
XX
XX      (prog1 <expr1> [<expr>]...)  EXECUTE EXPRESSIONS SEQUENTIALLY
XX          <expr1>     the first expression to evaluate
XX          <expr>...   the remaining expressions to evaluate
XX          returns     the value of the first expression
XX
XX      (prog2 <expr1> <expr2> [<expr>]...)  EXECUTE EXPRESSIONS SEQUENTIALLY
XX          <expr1>     the first expression to evaluate
XX          <expr2>     the second expression to evaluate
XX          <expr>...   the remaining expressions to evaluate
XX          returns     the value of the second expression
XX
XX      (progn [<expr>]...)  EXECUTE EXPRESSIONS SEQUENTIALLY
XX          <expr>...   the expressions to evaluate
XX          returns     the value of the last expression (or nil)
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                Page 27
XX      DEBUGGING AND ERROR HANDLING
XX
XX
XX      19.0  DEBUGGING AND ERROR HANDLING
XX
XX      (error <emsg> [<arg>])  SIGNAL A NON-CORRECTABLE ERROR
XX          <emsg>      the error message string
XX          <arg>       the argument expression (printed after the message)
XX          returns     never returns
XX
XX      (cerror <cmsg> <emsg> [<arg>])  SIGNAL A CORRECTABLE ERROR
XX          <cmsg>      the continue message string
XX          <emsg>      the error message string
XX          <arg>       the argument expression (printed after the message)
XX          returns     nil when continued from the break loop
XX
XX      (break [<bmsg> [<arg>]])  ENTER A BREAK LOOP
XX          <bmsg>      the break message string (defaults to "**BREAK**")
XX          <arg>       the argument expression (printed after the message)
XX          returns     nil when continued from the break loop
XX
XX      (errset <expr> [<pflag>])  TRAP ERRORS
XX          <expr>      the expression to execute
XX          <pflag>     flag to control printing of the error message
XX          returns     the value of the last expression consed with nil
XX                      or nil on error
XX
XX      (baktrace [<n>])  PRINT N LEVELS OF TRACE BACK INFORMATION
XX          <n>         the number of levels (defaults to all levels)
XX          returns     nil
XX
XX      (evalhook <expr> <ehook> <ahook>)  EVALUATE AN EXPRESSION WITH HOOKS
XX          <expr>      the expression to evaluate
XX          <ehook>     the value for *evalhook*
XX          <ahook>     the value for *applyhook*
XX          returns     the result of evaluating the expression
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                Page 28
XX      ARITHMETIC FUNCTIONS
XX
XX
XX      20.0  ARITHMETIC FUNCTIONS
XX
XX      (+ <expr>...)  ADD A LIST OF NUMBERS
XX          <expr>...   the numbers
XX          returns     the result of the addition
XX
XX      (- <expr>...)  SUBTRACT A LIST OF NUMBERS OR NEGATE A SINGLE NUMBER
XX          <expr>...   the numbers
XX          returns     the result of the subtraction
XX
XX      (* <expr>...)  MULTIPLY A LIST OF NUMBERS
XX          <expr>...   the numbers
XX          returns     the result of the multiplication
XX
XX      (/ <expr>...)  DIVIDE A LIST OF NUMBERS
XX          <expr>...   the numbers
XX          returns     the result of the division
XX
XX      (1+ <expr>)  ADD ONE TO A NUMBER
XX          <expr>      the number
XX          returns     the number plus one
XX
XX      (1- <expr>)  SUBTRACT ONE FROM A NUMBER
XX          <expr>      the number
XX          returns     the number minus one
XX
XX      (rem <expr>...)  REMAINDER OF A LIST OF NUMBERS
XX          <expr>...   the numbers
XX          returns     the result of the remainder operation
XX
XX      (min <expr>...)  THE SMALLEST OF A LIST OF NUMBERS
XX          <expr>...   the expressions to be checked
XX          returns     the smallest number in the list
XX
XX      (max <expr>...)  THE LARGEST OF A LIST OF NUMBERS
XX          <expr>...   the expressions to be checked
XX          returns     the largest number in the list
XX
XX      (abs <expr>)  THE ABSOLUTE VALUE OF A NUMBER
XX          <expr>      the number
XX          returns     the absolute value of the number
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                Page 29
XX      BITWISE LOGICAL FUNCTIONS
XX
XX
XX      21.0  BITWISE LOGICAL FUNCTIONS
XX
XX      (bit-and <expr>...)  THE BITWISE AND OF A LIST OF NUMBERS
XX          <expr>      the numbers
XX          returns     the result of the and operation
XX
XX      (bit-ior <expr...)  THE BITWISE INCLUSIVE OR OF A LIST OF NUMBERS
XX          <expr>      the numbers
XX          returns     the result of the inclusive or operation
XX
XX      (bit-xor <expr...)  THE BITWISE EXCLUSIVE OR OF A LIST OF NUMBERS
XX          <expr>      the numbers
XX          returns     the result of the exclusive or operation
XX
XX      (bit-not <expr>)  THE BITWISE NOT OF A NUMBER
XX          <expr>      the number
XX          returns     the bitwise inversion of number
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                Page 30
XX      RELATIONAL FUNCTIONS
XX
XX
XX      22.0  RELATIONAL FUNCTIONS
XX
XX      The relational functions can be used to compare integers  or
XX      strings.   The  functions  '='  and '/=' can also be used to
XX      compare other types.  The result  of  these  comparisons  is
XX      computed the same way as for 'eq'.
XX
XX      (< <e1> <e2>)  TEST FOR LESS THAN
XX          <e1>        the left operand of the comparison
XX          <e2>        the right operand of the comparison
XX          returns     the result of comparing <e1> with <e2>
XX
XX      (<= <e1> <e2>)  TEST FOR LESS THAN OR EQUAL TO
XX          <e1>        the left operand of the comparison
XX          <e2>        the right operand of the comparison
XX          returns     the result of comparing <e1> with <e2>
XX
XX      (= <e1> <e2>)  TEST FOR EQUAL TO
XX          <e1>        the left operand of the comparison
XX          <e2>        the right operand of the comparison
XX          returns     the result of comparing <e1> with <e2>
XX
XX      (/= <e1> <e2>)  TEST FOR NOT EQUAL TO
XX          <e1>        the left operand of the comparison
XX          <e2>        the right operand of the comparison
XX          returns     the result of comparing <e1> with <e2>
XX
XX      (>= <e1> <e2>)  TEST FOR GREATER THAN OR EQUAL TO
XX          <e1>        the left operand of the comparison
XX          <e2>        the right operand of the comparison
XX          returns     the result of comparing <e1> with <e2>
XX
XX      (> <e1> <e2>)  TEST FOR GREATER THAN
XX          <e1>        the left operand of the comparison
XX          <e2>        the right operand of the comparison
XX          returns     the result of comparing <e1> with <e2>
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                Page 31
XX      STRING FUNCTIONS
XX
XX
XX      23.0  STRING FUNCTIONS
XX
XX      (strcat <expr>...)  CONCATENATE STRINGS
XX          <expr>...   the strings to concatenate
XX          returns     the result of concatenating the strings
XX
XX      (strlen <expr>)  COMPUTE THE LENGTH OF A STRING
XX          <expr>      the string
XX          returns     the length of the string
XX
XX      (substr <expr> <sexpr> [<lexpr>]) EXTRACT A SUBSTRING
XX          <expr>      the string
XX          <sexpr>     the starting position
XX          <lexpr>     the length (default is rest of string)
XX          returns     substring starting at <sexpr> for <lexpr>
XX
XX      (ascii <expr>)  NUMERIC VALUE OF CHARACTER
XX          <expr>      the string
XX          returns     the ascii code of the first character
XX
XX      (chr <expr>)  CHARACTER EQUIVALENT OF ASCII VALUE
XX          <expr>      the numeric expression
XX          returns     a one character string whose first character is <expr>
XX
XX      (atoi <expr>)  CONVERT AN ASCII STRING TO AN INTEGER
XX          <expr>      the string
XX          returns     the integer value of the string expression
XX
XX      (itoa <expr>)  CONVERT AN INTEGER TO AN ASCII STRING
XX          <expr>      the integer
XX          returns     the string representation of the integer value
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                Page 32
XX      INPUT/OUTPUT FUNCTIONS
XX
XX
XX      24.0  INPUT/OUTPUT FUNCTIONS
XX
XX      (read [<source> [<eof>]])  READ AN XLISP EXPRESSION
XX          <source>    the input source (default is standard input)
XX          <eof>       the value to return on end of file (default is nil)
XX          returns     the expression read
XX
XX      (print <expr> [<sink>])  PRINT A LIST OF VALUES ON A NEW LINE
XX          <expr>      the expressions to be printed
XX          <sink>      the output sink (default is standard output)
XX          returns     nil
XX
XX      (prin1 <expr> [<sink>])  PRINT A LIST OF VALUES
XX          <expr>      the expressions to be printed
XX          <sink>      the output sink (default is standard output)
XX          returns     nil
XX
XX      (princ <expr> [<sink>])  PRINT A LIST OF VALUES WITHOUT QUOTING
XX          <expr>      the expressions to be printed
XX          <sink>      the output sink (default is standard output)
XX          returns     nil
XX
XX      (terpri [<sink>])  TERMINATE THE CURRENT PRINT LINE
XX          <sink>      the output sink (default is standard output)
XX          returns     nil
XX
XX      (flatsize <expr>)  LENGTH OF PRINTED REPRESENTATION USING PRIN1
XX          <expr>      the expression
XX          returns     the length
XX
XX      (flatc <expr>)  LENGTH OF PRINTED REPRESENTATION USING PRINC
XX          <expr>      the expression
XX          returns     the length
XX
XX      (explode <expr>)  CHARACTERS IN PRINTED REPRESENTATION USING PRIN1
XX          <expr>      the expression
XX          returns     the list of characters
XX
XX      (explodec <expr>)  CHARACTERS IN PRINTED REPRESENTATION USING PRINC
XX          <expr>      the expression
XX          returns     the list of characters
XX
XX      (maknam <list>)  BUILD AN UNINTERNED SYMBOL FROM A LIST OF CHARACTERS
XX          <list>      list of characters in symbol name
XX          returns     the symbol
XX
XX      (implode <list>)  BUILD AN INTERNED SYMBOL FROM A LIST OF CHARACTERS
XX          <list>      list of characters in symbol name
XX          returns     the symbol
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                Page 33
XX      FILE I/O FUNCTIONS
XX
XX
XX      25.0  FILE I/O FUNCTIONS
XX
XX      (openi <fname>)  OPEN AN INPUT FILE
XX          <fname>     the file name string
XX          returns     a file pointer
XX
XX      (openo <fname>)  OPEN AN OUTPUT FILE
XX          <fname>     the file name string
XX          returns     a file pointer
XX
XX      (close <fp>)  CLOSE A FILE
XX          <fp>        the file pointer
XX          returns     nil
XX
XX      (read-char [<source>])  READ A CHARACTER FROM A FILE OR STREAM
XX          <source>    the input source (default is standard input)
XX          returns     the character (integer)
XX
XX      (peek-char [<flag> [<source>]])  PEEK AT THE NEXT CHARACTER
XX          <flag>      flag for skipping white space (default is nil)
XX          <source>    the input source (default is standard input)
XX          returns     the character (integer)
XX
XX      (write-char <ch> [<sink>])  WRITE A CHARACTER TO A FILE OR STREAM
XX          <ch>        the character to put (integer)
XX          <sink>      the output sink (default is standard output)
XX          returns     the character (integer)
XX
XX      (readline [<source>])  READ A LINE FROM A FILE OR STREAM
XX          <source>    the input source (default is standard input)
XX          returns     the input string
XX
XX
XX
XX      XLISP: An Experimental Object Oriented Language                Page 34
XX      SYSTEM FUNCTIONS
XX
XX
XX      26.0  SYSTEM FUNCTIONS
XX
XX      (load <fname> [<vflag> [<pflag>]])  LOAD AN XLISP SOURCE FILE
XX          <fname>     the filename string (".lsp" is appended)
XX          <vflag>     the verbose flag (default is t)
XX          <pflag>     the print flag (default is nil)
XX          returns     the filename
XX
XX      (gc)  FORCE GARBAGE COLLECTION
XX          returns     nil
XX
XX      (expand <num>)  EXPAND MEMORY BY ADDING SEGMENTS
XX          <num>       the number of segments to add
XX          returns     the number of segments added
XX
XX      (alloc <num>)  CHANGE NUMBER OF NODES TO ALLOCATE IN EACH SEGMENT
XX          <num>       the number of nodes to allocate
XX          returns     the old number of nodes to allocate
XX
XX      (mem)  SHOW MEMORY ALLOCATION STATISTICS
XX          returns     nil
XX
XX      (type <expr>)  RETURNS THE TYPE OF THE EXPRESSION
XX          <expr>      the expression to return the type of
XX          returns     nil if the value is nil otherwise one of the symbols:
XX                          SYM   for symbols
XX                          OBJ   for objects
XX                          LIST  for list nodes
XX                          SUBR  for subroutine nodes with evaluated arguments
XX                          FSUBR for subroutine nodes with unevaluated arguments
XX                          STR   for string nodes
XX                          INT   for integer nodes
XX                          FPTR  for file pointer nodes
XX
XX      (exit)  EXIT XLISP
XX          returns     never returns
XX
SHAR_EOF
if test 53349 -ne "`wc -c xlisp.doc`"
then
echo shar: error transmitting xlisp.doc '(should have been 53349 characters)'
fi
#	End of shell archive
exit 0