home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / lisp / interpre / xlispplu / docs / cldoc.txt < prev    next >
Text File  |  1992-01-14  |  216KB  |  5,263 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.                     XLISP-PLUS: Another Object-oriented Lisp
  17.  
  18.                                   Version 2.1d
  19.  
  20.                                  January 2, 1992
  21.  
  22.                                     Tom Almy
  23.                              toma@sail.labs.tek.com
  24.  
  25.  
  26.      Portions of this manual and software are from XLISP which is Copyright
  27.      (c) 1988, by  David Michael Betz, all rights reserved. Mr. Betz grants
  28.      permission for unrestricted non-commercial use. Portions of XLISP-PLUS
  29.      from XLISP-STAT  are Copyright (c)  1988, Luke Tierney.  UNIXSTUF.C is
  30.      from  Winterp 1.0,  Copyright 1989  Hewlett-Packard Company  (by Niels
  31.      Mayer).  Other  enhancements  and   bug  fixes  are  provided  without
  32.      restriction  by  Tom  Almy,  Mikael  Pettersson,  Neal  Holtz,  Johnny
  33.      Greenblatt, Ken Whedbee, Blake McBride, and Pete Yadlowsky. See source
  34.      code for details.
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.      Table of Contents
  45.  
  46.      XLISP-PLUS: Another Object-oriented Lisp  . . . . . . . . . . . .    1
  47.  
  48.      INTRODUCTION  . . . . . . . . . . . . . . . . . . . . . . . . . .    1
  49.  
  50.      XLISP COMMAND LOOP  . . . . . . . . . . . . . . . . . . . . . . .    2
  51.  
  52.      BREAK COMMAND LOOP  . . . . . . . . . . . . . . . . . . . . . . .    4
  53.  
  54.      DATA TYPES  . . . . . . . . . . . . . . . . . . . . . . . . . . .    5
  55.  
  56.      THE EVALUATOR . . . . . . . . . . . . . . . . . . . . . . . . . .    8
  57.  
  58.      HOOK FUNCTIONS  . . . . . . . . . . . . . . . . . . . . . . . . .    9
  59.  
  60.      LEXICAL CONVENTIONS . . . . . . . . . . . . . . . . . . . . . . .   10
  61.  
  62.      READTABLES  . . . . . . . . . . . . . . . . . . . . . . . . . . .   12
  63.  
  64.      SYMBOL CASE CONTROL . . . . . . . . . . . . . . . . . . . . . . .   14
  65.  
  66.      LAMBDA LISTS  . . . . . . . . . . . . . . . . . . . . . . . . . .   16
  67.  
  68.      OBJECTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   18
  69.  
  70.      SYMBOLS . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   22
  71.  
  72.      EVALUATION FUNCTIONS  . . . . . . . . . . . . . . . . . . . . . .   24
  73.  
  74.      SYMBOL FUNCTIONS  . . . . . . . . . . . . . . . . . . . . . . . .   26
  75.  
  76.      PROPERTY LIST FUNCTIONS . . . . . . . . . . . . . . . . . . . . .   30
  77.  
  78.      HASH TABLE FUNCTIONS  . . . . . . . . . . . . . . . . . . . . . .   31
  79.  
  80.      ARRAY FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . . . .   32
  81.  
  82.      SEQUENCE FUNCTIONS  . . . . . . . . . . . . . . . . . . . . . . .   33
  83.  
  84.      LIST FUNCTIONS  . . . . . . . . . . . . . . . . . . . . . . . . .   38
  85.  
  86.      DESTRUCTIVE LIST FUNCTIONS  . . . . . . . . . . . . . . . . . . .   42
  87.  
  88.      ARITHMETIC FUNCTIONS  . . . . . . . . . . . . . . . . . . . . . .   43
  89.  
  90.      BITWISE LOGICAL FUNCTIONS . . . . . . . . . . . . . . . . . . . .   48
  91.  
  92.      STRING FUNCTIONS  . . . . . . . . . . . . . . . . . . . . . . . .   49
  93.  
  94.      CHARACTER FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . .   51
  95.  
  96.      STRUCTURE FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . .   53
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.      XLISP 2.1d                 Table of Contents
  105.  
  106.  
  107.      OBJECT FUNCTIONS  . . . . . . . . . . . . . . . . . . . . . . . .   55
  108.  
  109.      PREDICATE FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . .   57
  110.  
  111.      CONTROL CONSTRUCTS  . . . . . . . . . . . . . . . . . . . . . . .   61
  112.  
  113.      LOOPING CONSTRUCTS  . . . . . . . . . . . . . . . . . . . . . . .   64
  114.  
  115.      THE PROGRAM FEATURE . . . . . . . . . . . . . . . . . . . . . . .   65
  116.  
  117.      INPUT/OUTPUT FUNCTIONS  . . . . . . . . . . . . . . . . . . . . .   67
  118.  
  119.      THE FORMAT FUNCTION . . . . . . . . . . . . . . . . . . . . . . .   69
  120.  
  121.      FILE I/O FUNCTIONS  . . . . . . . . . . . . . . . . . . . . . . .   72
  122.  
  123.      STRING STREAM FUNCTIONS . . . . . . . . . . . . . . . . . . . . .   76
  124.  
  125.      DEBUGGING AND ERROR HANDLING FUNCTIONS  . . . . . . . . . . . . .   78
  126.  
  127.      SYSTEM FUNCTIONS  . . . . . . . . . . . . . . . . . . . . . . . .   80
  128.  
  129.      ADDITIONAL FUNCTIONS AND UTILITIES  . . . . . . . . . . . . . . .   85
  130.  
  131.      BUG FIXES AND EXTENSIONS  . . . . . . . . . . . . . . . . . . . .   89
  132.  
  133.      EXAMPLES: FILE I/O FUNCTIONS  . . . . . . . . . . . . . . . . . .   97
  134.  
  135.      INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   99
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.      XLISP 2.1d                   INTRODUCTION                       Page 1
  144.  
  145.  
  146.  
  147.  
  148.      INTRODUCTION
  149.  
  150.      XLISP-PLUS is an  enhanced version  of David Michael  Betz's XLISP  to
  151.      have additional features of Common Lisp. XLISP-PLUS is distributed for
  152.      the  IBM-PC family  and for UNIX,  but can  be easily  ported to other
  153.      platforms.  Complete  source code  is proved  (in  "C") to  allow easy
  154.      modification and extension.
  155.  
  156.      Since XLISP-PLUS is based  on XLISP, most XLISP  programs will run  on
  157.      XLISP-PLUS. Since XLISP-PLUS incorporates many more features of Common
  158.      Lisp,  many small Common Lisp applications will run on XLISP-PLUS with
  159.      little modification. See the  section starting on page 89  for details
  160.      of the differences between XLISP and XLISP-PLUS.
  161.  
  162.      Many  Common Lisp  functions are  built into XLISP-PLUS.  In addition,
  163.      XLISP defines the objects 'Object' and 'Class' as primitives. 'Object'
  164.      is the only class that has no superclass and hence is the root  of the
  165.      class heirarchy tree. 'Class'  is the class  of which all classes  are
  166.      instances (it is the only object that is an instance of itself).
  167.  
  168.      This  document is a brief  description of XLISP-PLUS.  It assumes some
  169.      knowledge  of LISP and some  understanding of the  concepts of object-
  170.      oriented programming.
  171.  
  172.      You will probably also need  a copy of "Common Lisp: The  Language" by
  173.      Guy  L. Steele, Jr., published by Digital  Press to use as a reference
  174.      for some of the Common Lisp functions  that are described only briefly
  175.      in this document.
  176.  
  177.      XLISP-PLUS  has a number of compilation options to to eliminate groups
  178.      of functions  and  to tailor  itself to  various environments.  Unless
  179.      otherwise indicated this  manual assumes all  options are enabled  and
  180.      the  system dependent code  is as  complete as  that provided  for the
  181.      MS/DOS environment. Assistance for using  or porting XLISP-PLUS can be
  182.      obtained on the  USENET newsgroup comp.lang.lisp.x,  or by writing  to
  183.      Tom Almy at the Internet address toma@sail.labs.tek.com. You  can also
  184.      reach  Tom by writing  to him at  17830 SW Shasta  Trail, Tualatin, OR
  185.      97062, USA.
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.      XLISP 2.1d                XLISP COMMAND LOOP                    Page 2
  194.  
  195.  
  196.  
  197.      XLISP COMMAND LOOP
  198.  
  199.      When   XLISP  is  started,  it  first  tries  to  load  the  workspace
  200.      "xlisp.wks", or  an alternative  file specified with  the "-wfilename"
  201.      option, from the current directory. If that file doesn't exist, or the
  202.      "-w" flag is in  the command line, XLISP builds an  initial workspace,
  203.      empty except for the built-in functions and symbols.
  204.  
  205.      Then,  providing  providing  no  workspace  file was  loaded,    XLISP
  206.      attempts  to load "init.lsp" from the current directory. It then loads
  207.      any files named  as parameters  on the command  line (after  appending
  208.      ".lsp"  to their names). If the "-v" flag is in the command line, then
  209.      the  files are loaded verbosely.  The option "-tfilename"  will open a
  210.      transcript file of the name "filename".
  211.  
  212.      XLISP then issues the following prompt (unless standard input has been
  213.      redirected):
  214.  
  215.      >
  216.  
  217.      This indicates that XLISP is waiting for an expression to be typed.
  218.  
  219.      When  a  complete  expression  has  been  entered, XLISP  attempts  to
  220.      evaluate  that expression. If  the expression  evaluates successfully,
  221.      XLISP prints the result and then returns for another expression.
  222.  
  223.      The  following control characters can  be used while  XLISP is waiting
  224.      for input:
  225.  
  226.           Backspace delete last character
  227.           Del       delete last character
  228.           tab       tabs over (treated as space by XLISP reader)
  229.           ctrl-C    goto top level
  230.           ctrl-G    cleanup and return one level
  231.           ctrl-Z    end of file (returns one level or exits program)
  232.           ctrl-P    proceed (continue)
  233.           ctrl-T    print information (added function by TAA)
  234.  
  235.      Under MS-DOS the following control characters can be typed while XLISP
  236.      is executing  (providing standard input  has not been  redirected away
  237.      from the console):
  238.  
  239.           ctrl-B    BREAK -- enter break loop
  240.           ctrl-S    Pause until another key is struck
  241.           ctrl-C    go to top level (if lucky: ctrl-B,ctrl-C is safer)
  242.           ctrl-T    print information
  243.  
  244.      Under MS-DOS if the global variable *dos-input* is set non-NIL, DOS is
  245.      used to read  entire input lines. Operation this way  is convenient if
  246.      certain DOS utilities, such as CED, are used, or if XLISP is run under
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.      XLISP 2.1d                XLISP COMMAND LOOP                    Page 3
  255.  
  256.  
  257.      an editor like  EPSILON. In this case, normal command  line editing is
  258.      available, but the control  keys will not work (in  particular, ctrl-C
  259.      will cause the program  to exit!). Use the XLISP  functions top-level,
  260.      clean-up, and continue instead of ctrl-C, ctrl-G, and ctrl-P.
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.      XLISP 2.1d                BREAK COMMAND LOOP                    Page 4
  269.  
  270.  
  271.  
  272.      BREAK COMMAND LOOP
  273.  
  274.      When  XLISP encounters  an error  while evaluating  an  expression, it
  275.      attempts to handle the error in the following way:
  276.  
  277.      If the symbol  '*breakenable*' is true,  the message corresponding  to
  278.      the  error is  printed. If  the error  is correctable,  the correction
  279.      message is printed.
  280.  
  281.      If the symbol  '*tracenable*' is  true, a trace  back is printed.  The
  282.      number  of  entries  printed  depends  on  the  value  of  the  symbol
  283.      '*tracelimit*'.  If this  symbol  is set  to  something other  than  a
  284.      number, the entire trace back stack is printed.
  285.  
  286.      XLISP then enters  a read/eval/print loop to allow the user to examine
  287.      the state  of the interpreter in  the context of the  error. This loop
  288.      differs  from the normal top-level read/eval/print loop in that if the
  289.      user  invokes  the function  'continue',  XLISP will  continue  from a
  290.      correctable error. If the user invokes the function  'clean-up', XLISP
  291.      will abort  the break loop  and return  to the top  level or  the next
  292.      lower numbered break loop.  When in a break  loop, XLISP prefixes  the
  293.      break level to the normal prompt.
  294.  
  295.      If  the symbol '*breakenable*' is  NIL, XLISP looks  for a surrounding
  296.      errset  function. If  one is  found, XLISP examines  the value  of the
  297.      print flag. If this flag is true, the error message is printed. In any
  298.      case, XLISP causes the errset function call to return NIL.
  299.  
  300.      If there is  no surrounding  errset function, XLISP  prints the  error
  301.      message and returns to the top level.
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.      XLISP 2.1d                    DATA TYPES                        Page 5
  310.  
  311.  
  312.  
  313.      DATA TYPES
  314.  
  315.      There  are  several  different  data  types  available  to  XLISP-PLUS
  316.      programmers. Typical implementation  limits are shown for  32 bit word
  317.      systems.   Values  in  square   brackets  apply   to  16   bit  MS-DOS
  318.      implementations.
  319.  
  320.      All data nodes are  effectively cons cells consisting of  two pointers
  321.      and and one  or two bytes of identification  flags (9 or 10  bytes per
  322.      cell). Node space is managed and garbage collected by XLISP. Array and
  323.      string storage  is either allocated  by the  C runtime or  managed and
  324.      garbaged collected  by  XLISP  (compilation option).  If  C  does  the
  325.      allocation,  memory  fragmentation  can occur.  Fragmentation  can  be
  326.      eliminated by saving the image and restarting XLISP-PLUS.
  327.  
  328.  
  329.      ∙    NIL
  330.           Unlike  the original XLISP, NIL is  a symbol (although not in the
  331.           *obarray*), to allowing setting its properties.
  332.      ∙    lists
  333.           Either NIL or a  CDR-linked list of cons  cells, terminated by  a
  334.           symbol  (typically NIL).  Circular lists  are allowable,  but can
  335.           cause  problems with  some functions  so they  must be  used with
  336.           care.
  337.      ∙    arrays
  338.           The CDR field  of an  array points to  the dynamically  allocated
  339.           data  array, while  the CAR  contains the  integer length  of the
  340.           array. Elements in  the data  array are pointers  to other  cells
  341.           [Size limited to about 16360].
  342.      ∙    character strings
  343.           Implemented like arrays, except string  array is byte indexed and
  344.           contains the  actual characters. Note that  unlike the underlying
  345.           C, the null character (value 0)  is valid. [Size limited to about
  346.           65500]
  347.      ∙    symbols
  348.           Implemented  as a 4 element  array. The elements  are value cell,
  349.           function cell, property list, and print name (a  character string
  350.           node).  Print names are limited to 100 characters. There are also
  351.           flags  for constant and special.  Values bound to special symbols
  352.           (declared  with DEFVAR  or  DEFPARAMETER) are  always dynamically
  353.           bound, rather than being lexically bound.
  354.      ∙    fixnums (integers)
  355.           Small integers (> -129 and <256) are statically allocated and are
  356.           thus always  EQ integers of the same value. The CAR field is used
  357.           to hold the value, which is a 32 bit signed integer.
  358.      ∙    ratios
  359.           The CAR field is used  to hold the numerator while the  CDR field
  360.           is used to hold the denominator. The numerator is a 32 bit signed
  361.           value while the denominator is a 31 bit positive value.
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.      XLISP 2.1d                    DATA TYPES                        Page 6
  370.  
  371.  
  372.      ∙    characters
  373.           All  characters   are  statically  allocated  and   are  thus  EQ
  374.           characters of the same value.  The CAR field is used to  hold the
  375.           value. In XLISP characters are "unsigned" and thus range in value
  376.           from 0 to 255.
  377.      ∙    flonums (floating point numbers)
  378.           The CAR  and CDR fields hold  the value, which is  typically a 64
  379.           bit IEEE floating point number.
  380.      ∙    complex numbers
  381.           Part  of   the  math  extension  compilation  option.  Internally
  382.           implemented  as an  array of  the real  and imaginary  parts. The
  383.           parts  can be either both  fixnums or both  flonums. Any function
  384.           which would return an fixnum complex number with a zero imaginary
  385.           part returns just the fixnum.
  386.      ∙    objects
  387.           Implemented  as  an array  of  instance variable  count  plus one
  388.           elements. The  first element  is the  object's  class, while  the
  389.           remaining arguments are the instance variables.
  390.      ∙    streams (file)
  391.           The  CAR and CDR fields are  used in a system  dependent way as a
  392.           file pointer.
  393.      ∙    streams (unnamed -- string)
  394.           Implemented as a tconc-style list of characters.
  395.      ∙    subrs (built-in functions)
  396.           The CAR field points to the actual code to execute, while the CDR
  397.           field is an internal pointer to the name of the function.
  398.      ∙    fsubrs (special forms)
  399.           Same implementation as subrs.
  400.      ∙    closures (user defined functions)
  401.           Implemented as an array of 11 elements:
  402.           1.   name symbol or NIL
  403.           2.   'lambda or 'macro
  404.           3.   list of required arguments
  405.           4.   optional arguments  as list of  (<arg> <init> <specified-p>)
  406.                triples.
  407.           5.   &rest argument
  408.           6.   &key arguments as list of (<key> <arg> <init> <specified-p>)
  409.                quadruples.
  410.           7.   &aux arguments as list of (<arg> <init>) pairs.
  411.           8.   function body
  412.           9.   value environment (see page 79 for format)
  413.           10.  function environment
  414.           11.  argument list (unprocessed)
  415.      ∙    structures
  416.           Implemented as an array with first element being a pointer to the
  417.           structure  name  string, and  the  remaining  elements being  the
  418.           structure elements.
  419.      ∙    hash-tables
  420.           Implemented as a  structure of varying length with no generalized
  421.           accessing  functions, but  with a  special print  function (print
  422.           functions not available for standard structures).
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430.      XLISP 2.1d                    DATA TYPES                        Page 7
  431.  
  432.  
  433.      ∙    random-states
  434.           Implemented as a  structure with  a single element  which is  the
  435.           random state (here  a fixnum, but could change  without impacting
  436.           xlisp programs).
  437.  
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.      XLISP 2.1d                   THE EVALUATOR                      Page 8
  445.  
  446.  
  447.  
  448.      THE EVALUATOR
  449.  
  450.      The process of evaluation in XLISP:
  451.  
  452.      Strings, characters, numbers of any type, objects, arrays, structures,
  453.      streams, subrs, fsubrs and closures evaluate to themselves.
  454.  
  455.      Symbols act as  variables and  are evaluated by  retrieving the  value
  456.      associated with their current binding.
  457.  
  458.      Lists are  evaluated by examining  the first  element of the  list and
  459.      then taking one of the following actions:
  460.  
  461.           If  it is  a  symbol, the  functional  binding of  the  symbol is
  462.           retrieved.
  463.  
  464.           If it is  a lambda expression, a  closure is constructed for  the
  465.           function described by the lambda expression.
  466.  
  467.           If it is a subr, fsubr or closure, it stands for itself.
  468.  
  469.           Any other value is an error.
  470.  
  471.      Then, the value produced by the previous step is examined:
  472.  
  473.           If it  is a  subr or  closure, the  remaining  list elements  are
  474.           evaluated and the subr  or closure is applied to  these evaluated
  475.           expressions.
  476.  
  477.           If it  is an fsubr, the  fsubr is called with  the remaining list
  478.           elements as arguments (unevaluated).
  479.  
  480.           If  it is a macro, the macro  is expanded with the remaining list
  481.           elements as arguments (unevaluated).  The macro expansion is then
  482.           evaluated  in place  of the  original macro  call. If  the symbol
  483.           *displace-macros*  is  not  NIL,  then the  expanded  macro  will
  484.           (destructively) replace the original macro expression. This means
  485.           that the macro will only be  expanded once, but the original code
  486.           will be lost.  The displacement  will not take  place unless  the
  487.           macro expands into  a list.  The standard XLISP  practice is  the
  488.           macro  will be expanded  each time  the expression  is evaluated,
  489.           which negates some of the advantages of using macros.
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.      XLISP 2.1d                  HOOK FUNCTIONS                      Page 9
  498.  
  499.  
  500.  
  501.      HOOK FUNCTIONS
  502.  
  503.      The  evalhook  and  applyhook  facility are  useful  for  implementing
  504.      debugging programs or  just observing  the operation of  XLISP. It  is
  505.      possible to control evaluation of forms in any context.
  506.  
  507.      If the symbol '*evalhook*' is bound to a function  closure, then every
  508.      call  of  eval  will  call  this  function.  The  function  takes  two
  509.      arguements, the form to be evaluated and execution environment. During
  510.      the  execution  of this  function,  *evalhook*  (and *applyhook*)  are
  511.      dynamically bound to NIL to prevent undesirable recursion. This "hook"
  512.      function returns the result of the evaluation.
  513.  
  514.      If  the  symbol  '*applyhook*' is  bound  to  a  function, then  every
  515.      function application within an eval will call this function (note that
  516.      the function apply, and others which  do not use eval, will not invoke
  517.      the  apply  hook function).  The  function  takes two  arguments,  the
  518.      function closure and the  argument list (which is  already evaluated).
  519.      During execution  of this hook function,  *applyhook* (and *evalhook*)
  520.      are  dynamically bound  to NIL  to  prevent undesired  recursion. This
  521.      function is to return the result of the function application.
  522.  
  523.      Note that the hook functions cannot reset *evalhook* or *applyhook* to
  524.      NIL, because upon exit these values will be reset. An excape mechanism
  525.      is  provided --  execution of  'top-level', or  any error  that causes
  526.      return  to the  top  level, will  unhook  the functions.  Applications
  527.      should  bind   these  values   either  via  'progv',   'evalhook',  or
  528.      'applyhook'.
  529.  
  530.      The  functions  'evalhook'  and  'applyhook'  allowed  for  controlled
  531.      application of the hook functions. The form supplied as an argument to
  532.      'evalhook', or the function application given to  'applyhook', are not
  533.      hooked themselves,  but any subsidiary forms and  applications are. In
  534.      addition, by supplying NIL  values for the hook functions,  'evalhook'
  535.      can be  used to execute a form within a specific environment passed as
  536.      an argument.
  537.  
  538.      An additional hook function  exists for the garbage collector.  If the
  539.      symbol  '*gc-hook*'  is bound  to a  function,  then this  function is
  540.      called after every garbage collection. The function has two arguments.
  541.      The first is the total number  of nodes, and the second is the  number
  542.      of nodes  free. The return value  is ignored. During  the execution of
  543.      the  function, *gc-hook*  is  dynamically  bound  to  NIL  to  prevent
  544.      undesirable recursion.
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.      XLISP 2.1d                LEXICAL CONVENTIONS                  Page 10
  553.  
  554.  
  555.  
  556.      LEXICAL CONVENTIONS
  557.  
  558.      The  following  conventions  must  be  followed  when  entering  XLISP
  559.      programs:
  560.  
  561.      Comments  in XLISP code begin with a semi-colon character and continue
  562.      to the end of the line.
  563.  
  564.      Except  when  escape sequences  are used,  symbol  names in  XLISP can
  565.      consist  of any sequence of non-blank  printable characters except the
  566.      terminating macro characters:
  567.  
  568.           ( ) ' ` , " ;
  569.  
  570.      and the escape characters:
  571.  
  572.           \ |
  573.  
  574.      In addition, the first character may not be '#' (non-terminating macro
  575.      character),  nor may the symbol  have identical syntax  with a numeric
  576.      literal.  Uppercase  and lowercase  characters  are not  distinguished
  577.      within  symbol names  because,  by default,  lowercase characters  are
  578.      mapped to uppercase on input.
  579.  
  580.      Any  printing character, including whitespace, may be part of a symbol
  581.      name  when  escape characters  are  used.  The backslash  escapes  the
  582.      following  character,  while multiple  characters  can  be escaped  by
  583.      placing them between vertical bars. At all times the backslash must be
  584.      used to escape either escape characters.
  585.  
  586.      For  semantic reasons, certain  chararacter sequences should/can never
  587.      be used as symbols in XLISP. A single period is  used to denote dotted
  588.      lists.  The symbol NIL represents an empty list. Symbols starting with
  589.      a  colon are keywords,   and will always  evaluate to themselves. Thus
  590.      they  should not  be used  as regular  symbols. The  symbol T  is also
  591.      reserved for use as the truth value.
  592.  
  593.      Fixnum (integer) literals  consist of a sequence of  digits optionally
  594.      beginning with a sign ('+' or '-'). The range of values an integer can
  595.      represent is limited by the size of a C 'long' on the machine on which
  596.      XLISP is running. 
  597.  
  598.      Ratio  literals consist of two  integer literals separated  by a slash
  599.      character ('/'). The second number, the denominator, must be positive.
  600.      Ratios are automatically reduced to their cannonical form; if they are
  601.      integral, then they are reduced to an integer.
  602.  
  603.      Flonum  (floating  point) literals  consist  of a  sequence  of digits
  604.      optionally beginning  with a sign  ('+' or  '-') and including  one or
  605.      both of an embedded decimal point or a trailing exponent. The optional
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612.  
  613.      XLISP 2.1d                LEXICAL CONVENTIONS                  Page 11
  614.  
  615.  
  616.      exponent is denoted by an 'E' or  'e' followed by an optional sign and
  617.      one or  more digits. The range  of values a floating  point number can
  618.      represent is limited by the size  of a C 'double' on most machines  on
  619.      which XLISP is running.
  620.  
  621.      Numeric literals cannot have embedded  escape characters. If they  do,
  622.      they are  treated as symbols. Thus  '12\3' is a symbol  even though it
  623.      would appear to be identical to '123'.
  624.  
  625.      Complex literals are constructed using a read-macro of the format #C(r
  626.      i), where r is the real part and i  is the imaginary part. The numeric
  627.      fields can  be any valid fixnum,  ratio, or flonum literal.  If either
  628.      field has a ratio or flonum literal, then both values are converted to
  629.      flonums.  Fixnum  complex literals  with  a  zero imaginary  part  are
  630.      automatically reduced to fixnums.
  631.  
  632.      Character literals are handled via the #\ read-macro construct:
  633.  
  634.           #\<char>       == the ASCII code of the printing character
  635.           #\newline      == ASCII linefeed character
  636.           #\space        == ASCII space character
  637.           #\rubout       == ASCII rubout (DEL)
  638.           #\C-<char>     == ASCII control character
  639.           #\M-<char>     == ASCII character with msb set (Meta character)
  640.           #\M-C-<char>   == ASCII control character with msb set
  641.  
  642.  
  643.      Literal  strings  are sequences  of  characters  surrounded by  double
  644.      quotes  (the " read-macro). Within quoted strings the '\' character is
  645.      used to allow non-printable characters to be included. The codes
  646.      recognized are:
  647.  
  648.           \\        means the character '\'
  649.           \n        means newline
  650.           \t        means tab
  651.           \r        means return
  652.           \f        means form feed
  653.           \nnn      means the character whose octal code is nnn
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.      XLISP 2.1d                    READTABLES                       Page 12
  662.  
  663.  
  664.  
  665.      READTABLES
  666.  
  667.      The behaviour of the reader is controlled by a data structure called a
  668.      "readtable".  The reader  uses the  symbol *readtable*  to locate  the
  669.      current  readtable. This  table controls  the interpretation  of input
  670.      characters  -- if it is  changed then the  section LEXICAL CONVENTIONS
  671.      may not  apply. The readtable  is an array  with 256 entries,  one for
  672.      each of the extended ASCII character codes. Each entry contains one of
  673.      the  following values, with the initial entries assigned to the values
  674.      indicated:
  675.  
  676.           :white-space        A  whitespace character  -  tab, cr,  lf, ff,
  677.                               space
  678.           (:tmacro . fun)     terminating readmacro - ( ) " , ; ' `
  679.           (:nmacro . fun)     non-terminating readmacro - #
  680.           :sescape            Single escape character - \
  681.           :mescape            Multiple escape character - |
  682.           :constituent        Indicating a symbol constituent (all printing
  683.                               characters not listed above)
  684.           NIL                 Indicating  an invalid  character (everything
  685.                               else)
  686.  
  687.      In the case of :TMACRO and :NMACRO, the "fun" component is a function.
  688.      This  can  either  be  a  built-in  readmacro  function  or  a  lambda
  689.      expression.  The function takes two parameters. The first is the input
  690.      stream and the second is the  character that caused the invocation  of
  691.      the readmacro. The  readmacro function should  return NIL to  indicate
  692.      that the character should be treated  as white space or a value consed
  693.      with  NIL to  indicate  that the  readmacro  should be  treated as  an
  694.      occurance of the  specified value.  Of course, the  readmacro code  is
  695.      free to read additional characters from the input stream. A :nmacro is
  696.      a symbol constituent except as the first character of a symbol.
  697.  
  698.      As an example, the following read macro allows  the square brackets to
  699.      be used as a more visibly appealing alternative to the SEND function:
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.      XLISP 2.1d                    READTABLES                       Page 13
  708.  
  709.  
  710.      (setf (aref *readtable* (char-int #\[)) ; #\[ table entry
  711.            (cons :tmacro
  712.                  (lambda (f c &aux ex) ; second arg is not used
  713.                          (do ()
  714.                              ((eq (peek-char t f) #\]))
  715.                              (setf ex (append ex (list (read f)))))
  716.                          (read-char f) ; toss the trailing #\]
  717.                          (cons (cons 'send ex) NIL))))
  718.  
  719.      (setf (aref *readtable* (char-int #\]))
  720.            (cons :tmacro
  721.                  (lambda (f c)
  722.                          (error "misplaced right bracket"))))
  723.  
  724.  
  725.      XLISP defines several useful read macros:
  726.  
  727.           '<expr>             == (quote <expr>)
  728.           `<expr>             == (backquote <expr>)
  729.           ,<expr>             == (comma <expr>)
  730.           ,@<expr>            == (comma-at <expr>)
  731.           #'<expr>            == (function <expr>)
  732.           #(<expr>...)        == an array of the specified expressions
  733.           #S(<structtype> [<slotname> <value>]...)
  734.                               ==  structure of  specified type  and initial
  735.                               values
  736.           #.<expr>            == result of evaluating <expr>
  737.           #x<hdigits>         == a hexadecimal number (0-9,A-F)
  738.           #o<odigits>         == an octal number (0-7)
  739.           #b<bdigits>         == a binary number (0-1)
  740.           #|  |#              == a comment
  741.           #:<symbol>          == an uninterned symbol
  742.           #C(r i)             == a complex number
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749.  
  750.      XLISP 2.1d                SYMBOL CASE CONTROL                  Page 14
  751.  
  752.  
  753.  
  754.      SYMBOL CASE CONTROL
  755.  
  756.      XLISP-PLUS  uses two variables,  *READTABLE-CASE* and  *PRINT-CASE* to
  757.      deturmine  case conversion  during  reading and  printing of  symbols.
  758.      *READTABLE-CASE* can  have the  values :UPCASE :DOWNCASE  :PRESERVE or
  759.      :INVERT, while *PRINT-CASE* can have the values :UPCASE or  :DOWNCASE.
  760.      By  default,  or  when other  values  have  been  specified, both  are
  761.      :UPCASE.
  762.  
  763.      When  *READTABLE-CASE* is :UPCASE,  all unescaped lowercase characters
  764.      are  converted to  uppercase  when read.  When  it is  :DOWNCASE,  all
  765.      unescaped uppercase  characters are converted to  lowercase. This mode
  766.      is  not very useful because  the predefined symbols  are all uppercase
  767.      and  would need to be  escaped to read  them. When *READTABLE-CASE* is
  768.      :PRESERVE, no conversion takes place. This allows case sensitive input
  769.      with  predefined functions  in uppercase.  The final  choice, :INVERT,
  770.      will  invert  the case  of any  symbol that  is  not mixed  case. This
  771.      provides case  sensitive input  while making the  predefined functions
  772.      and variables appear to be in lowercase.
  773.  
  774.      The printing of symbols involves the settings of both *READTABLE-CASE*
  775.      and   *PRINT-CASE*.  When   *READTABLE-CASE*  is   :UPCASE,  lowercase
  776.      characters  are   escaped  (unless  PRINC  is   used),  and  uppercase
  777.      characters  are printed  in the case  specified by  *PRINT-CASE*. When
  778.      *READTABLE-CASE*  is  :DOWNCASE,   uppercase  characters  are  escaped
  779.      (unless  PRINC is  used),  and  lowercase  are  printed  in  the  case
  780.      specified by *PRINT-CASE*. The remaining *READTABLE-CASE* modes ignore
  781.      *PRINT-CASE* and do not  escape alphabetic characters. :PRESERVE never
  782.      changes  the case of characters while  :INVERT inverts the case of any
  783.      non mixed-case symbols.
  784.  
  785.      There are four major useful combinations of these modes:
  786.  
  787.      A:  *READTABLE-CASE* :UPCASE  *PRINT-CASE* :UPCASE
  788.  
  789.      "Traditional"  mode.  Case  insensitive  input;  must  escape  to  put
  790.      lowercase characters  in symbol names.  Symbols print exactly  as they
  791.      are stored, with lowercase characters escaped when PRIN1 is used.
  792.  
  793.      B:  *READTABLE-CASE* :UPCASE  *PRINT-CASE* :DOWNCASE
  794.  
  795.      "Eyesaver" mode. Case insensitive input; must escape to put  lowercase
  796.      characters in  symbol name. Symbols print entirely in lowercase except
  797.      symbols escaped when lowercase characters present with PRIN1.
  798.  
  799.      C:  *READTABLE-CASE* :PRESERVE
  800.  
  801.      "Oldfashioned case  sensitive" mode. Case sensitive  input. Predefined
  802.      symbols must be typed  in uppercase. No alpha quoting  needed. Symbols
  803.      print exactly as stored.
  804.  
  805.  
  806.  
  807.  
  808.  
  809.  
  810.  
  811.      XLISP 2.1d                SYMBOL CASE CONTROL                  Page 15
  812.  
  813.  
  814.      D:  *READTABLE-CASE* :INVERT
  815.  
  816.      "Modern case sensitive" mode. Case sensitive input. Predefined symbols
  817.      must  be  typed   in  lowercase.  Alpha  quoting  should  be  avoided.
  818.      Predefined  symbols print in lower  case, other symbols  print as they
  819.      were entered.
  820.  
  821.      As  far  as  compatibility between  these  modes  are  concerned, data
  822.      printed in mode  A can be read in  A, B, or C. Data printed  in mode B
  823.      can be read in A, B, and D. Data printed in mode C can be read in mode
  824.      C, and if no lowercase symbols in modes A  and B as well. Data printed
  825.      in  mode D can  be read  in mode D,  and if no  (internally) lowercase
  826.      symbols  in modes A  and B  as well.  In addition,  symbols containing
  827.      characters requiring quoting are compatible among all modes.
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.      XLISP 2.1d                   LAMBDA LISTS                      Page 16
  836.  
  837.  
  838.  
  839.      LAMBDA LISTS
  840.  
  841.      There are several forms in XLISP that require that a  "lambda list" be
  842.      specified. A lambda  list is a definition of the arguments accepted by
  843.      a function. There are four different types of arguments.
  844.  
  845.      The  lambda list  starts with  required arguments.  Required arguments
  846.      must be specified in every call to the function.
  847.  
  848.      The  required  arguments  are  followed by  the  &optional  arguments.
  849.      Optional   arguments  may  be  provided  or  omitted  in  a  call.  An
  850.      initialization expression may  be specified to provide a default value
  851.      for  an  &optional argument  if  it  is omitted  from  a  call. If  no
  852.      initialization   expression  is  specified,  an  omitted  argument  is
  853.      initialized  to NIL.  It is  also possible  to provide  the name  of a
  854.      'supplied-p' variable that can be used to determine if a call provided
  855.      a value for the argument or if the initialization expression was used.
  856.      If specified,  the supplied-p variable will  be bound to T  if a value
  857.      was specified in the call and NIL if the default value was used.
  858.  
  859.      The  &optional arguments are followed by the &rest argument. The &rest
  860.      argument gets  bound to the remainder  of the argument list  after the
  861.      required and &optional arguments have been removed.
  862.  
  863.      The &rest argument is  followed by the &key arguments.  When a keyword
  864.      argument is  passed to a  function, a  pair of values  appears in  the
  865.      argument list. The  first expression in the pair should  evaluate to a
  866.      keyword symbol  (a symbol that  begins with a  ':'). The value  of the
  867.      second expression is the value of the keyword argument. Like &optional
  868.      arguments,  &key  arguments  can have  initialization  expressions and
  869.      supplied-p  variables. In  addition,  it is  possible  to specify  the
  870.      keyword to be used in a function call. If no keyword is specified, the
  871.      keyword  obtained by  adding a  ':' to  the beginning  of the  keyword
  872.      argument  symbol  is used.  In other  words,  if the  keyword argument
  873.      symbol  is  'foo', the  keyword will  be  ':foo'. Extra  keywords will
  874.      signal an error unless &allow-other-keys is present, in which case the
  875.      extra keywords  are ignored. In XLISP,  the &allow-other-keys argument
  876.      is ignored, and extra keywords are ignored.
  877.  
  878.      The &key arguments are followed by the &aux variables. These are local
  879.      variables that are bound  during the evaluation of the  function body.
  880.      It  is  possible  to  have  initialization  expressions  for  the &aux
  881.      variables.
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.      XLISP 2.1d                   LAMBDA LISTS                      Page 17
  890.  
  891.  
  892.      Here is the complete syntax for lambda lists:
  893.  
  894.           (<rarg>...
  895.            [&optional [<oarg> | (<oarg> [<init> [<svar>]])]...]
  896.            [&rest <rarg>]
  897.            [&key
  898.             [<karg> |  ([<karg> |  (<key> <karg>)] [<init>  [<svar>]])] ...
  899.           [&allow-other-keys]]
  900.            [&aux [<aux> | (<aux> [<init>])]...])
  901.  
  902.          where:
  903.  
  904.           <rarg>    is a required argument symbol
  905.           <oarg>    is an &optional argument symbol
  906.           <rarg>    is the &rest argument symbol
  907.           <karg>    is a &key argument symbol
  908.           <key>     is a keyword symbol (starts with ':')
  909.           <aux>     is an auxiliary variable symbol
  910.           <init>    is an initialization expression
  911.           <svar>    is a supplied-p variable symbol
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.      XLISP 2.1d                      OBJECTS                        Page 18
  920.  
  921.  
  922.  
  923.      OBJECTS
  924.  
  925.      Definitions:
  926.  
  927.      ∙    selector - a symbol used to select an appropriate method
  928.      ∙    message - a selector and a list of actual arguments
  929.      ∙    method - the code that implements a message
  930.  
  931.      Since  XLISP was created to  provide a simple  basis for experimenting
  932.      with  object-oriented programming,  one  of the  primitive data  types
  933.      included is 'object'. In XLISP, an object consists of a data structure
  934.      containing a  pointer  to the  object's  class  as well  as  an  array
  935.      containing the values of the object's instance variables.
  936.  
  937.      Officially,  there is  no way  to see  inside an  object (look  at the
  938.      values of its instance variables). The only way to communicate with an
  939.      object is by sending it a message.
  940.  
  941.      You can  send a message to  an object using the  'send' function. This
  942.      function  takes the object as its first argument, the message selector
  943.      as  its  second argument  (which must  be  a symbol)  and  the message
  944.      arguments as its remaining arguments.
  945.  
  946.      The 'send' function determines  the class of the receiving  object and
  947.      attempts to find a method corresponding to the message selector in the
  948.      set of messages defined for that class. If the message is not found in
  949.      the  object's  class  and the  class  has  a  super-class, the  search
  950.      continues by looking at the messages defined for the super-class. This
  951.      process continues from one super-class to the next until  a method for
  952.      the message is found. If no method is found, an error occurs.
  953.  
  954.      To perform  a  method lookup  starting  with the  method's  superclass
  955.      rather than the  object's class, use  the function 'send-super'.  This
  956.      allows a subclass to invoke a standard method in its parent class even
  957.      though it overrides that method with its own specialized version.
  958.  
  959.      When a method  is found, the evaluator  binds the receiving  object to
  960.      the symbol  'self'  and  evaluates  the  method  using  the  remaining
  961.      elements  of the  original  list as  arguments  to the  method.  These
  962.      arguments  are  always  evaluated  prior   to  being  bound  to  their
  963.      corresponding formal  arguments. The  result of evaluating  the method
  964.      becomes the result of the expression.
  965.  
  966.      Two  objects, both  classes, are  predefined: Object  and Class.  Both
  967.      Object and  Class  are of  class  Class. The  superclass of  Class  is
  968.      Object, while  Object has no superclass. Typical  use is to create new
  969.      classes (by sending  :new to Class) to represent  application objects.
  970.      Objects of these classes,  created by sending :new to  the appropriate
  971.      new class,  are subclasses of Object.  The Object method :show  can be
  972.      used to view the contents of any object.
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.      XLISP 2.1d                      OBJECTS                        Page 19
  981.  
  982.  
  983.  
  984.      THE 'Object' CLASS
  985.  
  986.      Object  THE TOP OF THE CLASS HEIRARCHY
  987.  
  988.      Messages:
  989.  
  990.           :show                         SHOW AN OBJECT'S INSTANCE VARIABLES
  991.                     returns   the object
  992.  
  993.           :class                              RETURN THE CLASS OF AN OBJECT
  994.                     returns   the class of the object
  995.  
  996.           :prin1 [<stream>]                                PRINT THE OBJECT
  997.                     <stream>  default,  or NIL, is  *standard-output*, T is
  998.                               *terminal-io*
  999.                     returns   the object
  1000.  
  1001.           :isnew                  THE DEFAULT OBJECT INITIALIZATION ROUTINE
  1002.                     returns   the object
  1003.  
  1004.           :superclass                      GET THE SUPERCLASS OF THE OBJECT
  1005.                     returns   NIL
  1006.                     (Defined in classes.lsp, see :superclass below)
  1007.  
  1008.           :ismemberof <class>                              CLASS MEMBERSHIP
  1009.                     <class>   class name
  1010.                     returns   T if object member of class, else NIL
  1011.                     (defined in classes.lsp)
  1012.  
  1013.           :iskindof <class>                                CLASS MEMBERSHIP
  1014.                     <class>   class name
  1015.                     returns   T if  object member  of class or  subclass of
  1016.                               class, else NIL
  1017.                     (defined in classes.lsp)
  1018.  
  1019.           :respondsto <sel>                              SELECTOR KNOWLEDGE
  1020.                     <sel>     message selector
  1021.                     returns   T if  object  responds to  message  selector,
  1022.                               else NIL.
  1023.                     (defined in classes.lsp)
  1024.  
  1025.           :storeon                                      READ REPRESENTATION
  1026.                     returns   a list, that when executed will create a copy
  1027.                               of  the  object.  Only works  for  members of
  1028.                               classes created with defclass.
  1029.                     (defined in classes.lsp)
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.      XLISP 2.1d                      OBJECTS                        Page 20
  1038.  
  1039.  
  1040.  
  1041.      THE 'Class' CLASS
  1042.  
  1043.      Class   THE CLASS OF ALL OBJECT CLASSES (including itself)
  1044.  
  1045.      Messages:
  1046.  
  1047.           :new                             CREATE A NEW INSTANCE OF A CLASS
  1048.                     returns   the new class object
  1049.  
  1050.           :isnew <ivars> [<cvars> [<super>]]         INITIALIZE A NEW CLASS
  1051.                     <ivars>   the list of instance variable symbol
  1052.                     <cvars>   the list of class variable symbols
  1053.                     <super>   the superclass (default is Object)
  1054.                     returns   the new class object
  1055.  
  1056.           :answer <msg> <fargs> <code>             ADD A MESSAGE TO A CLASS
  1057.                     <msg>     the message symbol
  1058.                     <fargs>   the formal argument list (lambda list)
  1059.                     <code>    a list of executable expressions
  1060.                     returns   the object
  1061.  
  1062.           :superclass                      GET THE SUPERCLASS OF THE OBJECT
  1063.                     returns   the superclass (of the class)
  1064.                     (defined in classes.lsp)
  1065.  
  1066.           :messages                   GET THE LIST OF MESSAGES OF THE CLASS
  1067.                     returns   association  list  of  message selectors  and
  1068.                               closures for messages.
  1069.                     (defined in classes.lsp)
  1070.  
  1071.           :storeon                                      READ REPRESENTATION
  1072.                     returns   a list, that when executed will re-create the
  1073.                               class and its methods.
  1074.                     (defined in classes.lsp)
  1075.  
  1076.      When  a new  instance of  a class  is created  by sending  the message
  1077.      ':new' to an existing class, the message ':isnew' followed by whatever
  1078.      parameters were  passed to  the ':new'  message is  sent to  the newly
  1079.      created  object. Therefore,  when a  new class  is created  by sending
  1080.      ':new'  to class  'Class'  the  message  ':isnew'  is  sent  to  Class
  1081.      automatically.  To create  a new  class, a  function of  the following
  1082.      format is used:
  1083.        (setq <newclassname> (send Class :new <ivars> [<cvars> [<super>]]))
  1084.  
  1085.      When  a new class  is created, an optional  parameter may be specified
  1086.      indicating  the  superclass of  the new  class.  If this  parameter is
  1087.      omitted, the  new  class  will be  a  subclass of  'Object'.  A  class
  1088.      inherits  all instance  variables, and  methods from  its super-class.
  1089.      Only class variables of a method's class are accessable.
  1090.  
  1091.  
  1092.  
  1093.  
  1094.  
  1095.  
  1096.  
  1097.      XLISP 2.1d                      OBJECTS                        Page 21
  1098.  
  1099.  
  1100.      INSTANCE VARIABLES OF CLASS 'CLASS':
  1101.  
  1102.           MESSAGES  - An  association list  of  message names  and closures
  1103.                     implementing the messages.
  1104.  
  1105.           IVARS - List of names of instance variables.
  1106.  
  1107.           CVARS - List of names of class variables.
  1108.  
  1109.           CVAL - Array of class variable values.
  1110.  
  1111.           SUPERCLASS - The superclass of this class or NIL if no superclass
  1112.                     (only for class OBJECT).
  1113.  
  1114.           IVARCNT - instance variables in this class (length of IVARS)
  1115.  
  1116.           IVARTOTAL  - total  instance  variables for  this  class and  all
  1117.                     superclasses of this class.
  1118.  
  1119.           PNAME - printname string for this class.
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.      XLISP 2.1d                      SYMBOLS                        Page 22
  1128.  
  1129.  
  1130.  
  1131.      SYMBOLS
  1132.  
  1133.      All  values  are initially  NIL  unless otherwise  specified.  All are
  1134.      special variables unless indicated to be constants.
  1135.  
  1136.      ∙    NIL  - represents empty list  and the boolean  value for "false".
  1137.           The  value  of  NIL is  NIL,  and  cannot  be  changed (it  is  a
  1138.           constant). (car NIL) and (cdr NIL) are also defined to be NIL.
  1139.      ∙    t - boolean value "true" is constant with value t.
  1140.      ∙    self - within a method context, the current object (see page 18),
  1141.           otherwise initially unbound.
  1142.      ∙    object - constant, value is the class 'Object.'
  1143.      ∙    class - constant, value is the class 'Class'.
  1144.      ∙    internal-time-units-per-second  -  integer  constant   to  divide
  1145.           returned times by to get time in seconds.
  1146.      ∙    pi  - floating  point aproximation  of pi (constant  defined when
  1147.           math extension is compiled).
  1148.      ∙    *obarray*  -  the  object  hash  table.  Length  of  array  is  a
  1149.           compilation option.  Objects are  hashed using the  hash function
  1150.           and are placed on a list in the appropriate array slot.
  1151.      ∙    *terminal-io*  - stream  bound to  keyboard and  display.  Do not
  1152.           alter.
  1153.      ∙    *standard-input* - the standard input stream, initially stdin. If
  1154.           stdin is  not redirected on the command  line, then *terminal-io*
  1155.           is used so that all interactive i/o uses the same stream.
  1156.      ∙    *standard-output* - the standard output stream, initially stdout.
  1157.           If  stdout  is   not  redirected   on  the   command  line   then
  1158.           *terminal-io* is used so  that all interactive i/o uses  the same
  1159.           stream.
  1160.      ∙    *error-output*  -  the error  output  stream (used  by  all error
  1161.           messages), initially same as *terminal-io*.
  1162.      ∙    *trace-output* -  the  trace output  stream  (used by  the  trace
  1163.           function), initially same as *terminal-io*.
  1164.      ∙    *debug-io*  - the  break  loop  i/o  stream,  initially  same  as
  1165.           *terminal-io*. System messages   (other than error messages) also
  1166.           print out on this stream.
  1167.      ∙    *breakenable* -  flag controlling  entering break loop  on errors
  1168.           (see page 4)
  1169.      ∙    *tracelist* - list  of names  of functions  to trace,  as set  by
  1170.           trace function.
  1171.      ∙    *tracenable* - enable trace back printout on errors (see page 4).
  1172.      ∙    *tracelimit* - number  of levels of  trace back information  (see
  1173.           page 4).
  1174.      ∙    *evalhook* - user substitute for the evaluator function (see page
  1175.           9, and evalhook and applyhook functions).
  1176.      ∙    *applyhook* - user substitute  for function application (see page
  1177.           9, and evalhook and applyhook functions).
  1178.      ∙    *readtable* - the current readtable (see page 12).
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.      XLISP 2.1d                      SYMBOLS                        Page 23
  1187.  
  1188.  
  1189.      ∙    *unbound* - indicator for unbound symbols. A constant. Do not use
  1190.           this symbol since accessing  any variable to which this  has been
  1191.           bound will cause an unbound symbol error message.
  1192.      ∙    *gc-flag* - controls the printing of gc messages. When non-NIL, a
  1193.           message is printed after each garbage collection giving the total
  1194.           number of nodes and the number of nodes free.
  1195.      ∙    *gc-hook* -  function to call after garbage  collection (see page
  1196.           9).
  1197.      ∙    *integer-format* -  format for printing integers  (when not bound
  1198.           to   a   string,  defaults   to  "%d"   or  "%ld"   depending  on
  1199.           implementation)
  1200.      ∙    *ratio-format*  - format for printing ratios (when not bound to a
  1201.           string,   defaults  to   "%d/%d"   or  "%ld/%ld"   depending   on
  1202.           implementation)
  1203.      ∙    *float-format*  - format for printing floats (when not bound to a
  1204.           string, defaults to "%g")
  1205.      ∙    *readtable-case* - symbol read  and output case. See page  14 for
  1206.           details
  1207.      ∙    *print-case*  - symbol output case when printing. See page 14 for
  1208.           details
  1209.      ∙    *print-level* - When bound  to a number, list levels  beyond this
  1210.           value  are printed as '#'.  Used by all  printing functions. Good
  1211.           precaution to avoid getting caught in circular lists.
  1212.      ∙    *print-length* - When bound  to a number, lists longer  than this
  1213.           value  are printed as '...'. Used by all printing functions. Good
  1214.           precaution to avoid getting caught in circular lists.
  1215.      ∙    *dos-input* - When not NIL, uses dos line input function for read
  1216.           (see page 2).
  1217.      ∙    *displace-macros* -  When not NIL,  macros are replaced  by their
  1218.           expansions when exectuted (see page 8).
  1219.      ∙    *random-state*  - the  default  random-state used  by the  random
  1220.           function.
  1221.  
  1222.      There are several symbols maintained by the read/eval/print loop.  The
  1223.      symbols '+', '++', and '+++' are  bound to the most recent three input
  1224.      expressions. The symbols  '*', '**' and  '***' are bound  to the  most
  1225.      recent  three results.  The  symbol '-'  is  bound to  the  expression
  1226.      currently being evaluated.  It becomes the value of '+'  at the end of
  1227.      the evaluation.
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.      XLISP 2.1d               EVALUATION FUNCTIONS                  Page 24
  1236.  
  1237.  
  1238.  
  1239.      EVALUATION FUNCTIONS
  1240.  
  1241.      (eval <expr>)                             EVALUATE AN XLISP EXPRESSION
  1242.           <expr>    the expression to be evaluated
  1243.           returns   the result of evaluating the expression
  1244.  
  1245.      (apply <fun> <arg>...<args>)   APPLY A FUNCTION TO A LIST OF ARGUMENTS
  1246.           <fun>     the function to apply (or  function symbol). May not be
  1247.                     macro or fsubr.
  1248.           <arg>     initial arguments, which are CONSed to...
  1249.           <args>    the argument list
  1250.           returns   the result of applying the function to the arguments
  1251.  
  1252.      (funcall <fun> <arg>...)                CALL A FUNCTION WITH ARGUMENTS
  1253.           <fun>     the function  to call (or function symbol).  May not be
  1254.                     macro or fsubr.
  1255.           <arg>     arguments to pass to the function
  1256.           returns   the result of calling the function with the arguments
  1257.  
  1258.      (quote <expr>)                        RETURN AN EXPRESSION UNEVALUATED
  1259.           fsubr
  1260.           <expr>    the expression to be quoted (quoted)
  1261.           returns   <expr> unevaluated
  1262.  
  1263.      (function <expr>)                    GET THE FUNCTIONAL INTERPRETATION
  1264.           fsubr
  1265.           <expr>    the symbol or lambda expression (quoted)
  1266.           returns   the functional interpretation
  1267.  
  1268.      (identity <expr>)                                RETURN THE EXPRESSION
  1269.           New function. In common.lsp
  1270.           <expr>    the expression
  1271.           returns   the expression
  1272.  
  1273.      (backquote <expr>)                                  FILL IN A TEMPLATE
  1274.           fsubr. Note: an improved backquote facility, which works properly
  1275.           when nested, is available by loading the file backquot.lsp.
  1276.           <expr>    the template (quoted)
  1277.           returns   a  copy  of  the   template  with  comma  and  comma-at
  1278.                     expressions expanded.
  1279.  
  1280.      (comma <expr>)                                        COMMA EXPRESSION
  1281.           (Never executed)  As the  object of  a  backquote expansion,  the
  1282.           expression is  evaluated and becomes  an object in  the enclosing
  1283.           list.
  1284.  
  1285.      (comma-at <expr>)                                  COMMA-AT EXPRESSION
  1286.           (Never  executed) As  the object  of a  backquote  expansion, the
  1287.           expression is evaluated (and must evaluate to a list) and is then
  1288.           spliced into the enclosing list.
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.      XLISP 2.1d               EVALUATION FUNCTIONS                  Page 25
  1297.  
  1298.  
  1299.      (lambda <args> <expr>...)                      MAKE A FUNCTION CLOSURE
  1300.           fsubr
  1301.           <args>    formal argument list (lambda list) (quoted)
  1302.           <expr>    expressions of the function body (quoted)
  1303.           returns   the function closure
  1304.  
  1305.      (get-lambda-expression <closure>)            GET THE LAMBDA EXPRESSION
  1306.           <closure> the closure
  1307.           returns   the original lambda expression
  1308.  
  1309.      (macroexpand <form>)                    RECURSIVELY EXPAND MACRO CALLS
  1310.           <form>    the form to expand
  1311.           returns   the macro expansion
  1312.  
  1313.      (macroexpand-1 <form>)                             EXPAND A MACRO CALL
  1314.           <form>    the macro call form
  1315.           returns   the macro expansion
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.      XLISP 2.1d                 SYMBOL FUNCTIONS                    Page 26
  1324.  
  1325.  
  1326.  
  1327.      SYMBOL FUNCTIONS
  1328.  
  1329.      (set <sym> <expr>)                    SET THE GLOBAL VALUE OF A SYMBOL
  1330.           <sym>     the symbol being set
  1331.           <expr>    the new value
  1332.           returns   the new value
  1333.  
  1334.      (setq [<sym> <expr>]...)                     SET THE VALUE OF A SYMBOL
  1335.           fsubr
  1336.           <sym>     the symbol being set (quoted)
  1337.           <expr>    the new value
  1338.           returns   the new value
  1339.  
  1340.      (psetq [<sym> <expr>]...)                     PARALLEL VERSION OF SETQ
  1341.           fsubr. All expressions are evaluated  before any assignments
  1342.           are made.
  1343.           <sym>     the symbol being set (quoted)
  1344.           <expr>    the new value
  1345.           returns   the new value
  1346.  
  1347.      (setf [<place> <expr>]...)                    SET THE VALUE OF A FIELD
  1348.           fsubr
  1349.           <place> the field  specifier (if a macro it is expanded, then the
  1350.                   form arguments are evaluated):
  1351.                   <sym>                 set value of a symbol
  1352.                   (car <expr>)          set car of a cons node
  1353.                   (cdr <expr>)          set cdr of a cons node
  1354.                   (nth <n> <expr>)      set nth car of a list
  1355.                   (aref <expr> <n>)     set  nth  element  of  an  array or
  1356.                                         string
  1357.                   (elt <expr> <n>)      set nth element of a sequence
  1358.                   (get <sym> <prop>)    set value of a property
  1359.                   (symbol-value <sym>)  set global value of a symbol
  1360.                   (symbol-function <sym>)         set functional value of a
  1361.                                                   symbol
  1362.                   (symbol-plist <sym>)  set property list of a symbol
  1363.                   (gethash <key> <tbl> <def>)     add or replace hash table
  1364.                   entry. <def> is ignored
  1365.                   (send <obj> :<ivar>)  (When   classes.lsp   used),    set
  1366.                                         instance variable of object.
  1367.                   (<sym>-<element> <struct>)      set   the    element   of
  1368.                                                   structure   struct,  type
  1369.                                                   sym.
  1370.                   (<fieldsym> <args>)   the  function  stored  in  property
  1371.                                         *setf*  in   symbol  <fieldsym>  is
  1372.                                         applied to (<args> <expr>)
  1373.           <value> the new value
  1374.           returns the new value
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.      XLISP 2.1d                 SYMBOL FUNCTIONS                    Page 27
  1383.  
  1384.  
  1385.      (defsetf <sym> <fcn>)                    DEFINE A SETF FIELD SPECIFIER
  1386.      (defsetf <sym> <fargs> (<value>) <expr>...)
  1387.           Defined  as   macro  in   common.lsp.  Convenient,  Common   Lisp
  1388.           compatible  alternative  to  setting  *setf*  property  directly,
  1389.           although second format is not as efficient.
  1390.           <sym>     field specifier symbol (quoted)
  1391.           <fcn>     function to  use (quoted  symbol) which takes  the same
  1392.                     arguments as  the field  specifier  plus an  additional
  1393.                     argument for the value. The value must be returned.
  1394.           <fargs>   formal argument list (lambda list) (quoted)
  1395.           <value>   symbol bound to value to store (quoted).
  1396.           <expr>    expressions  to evaluate (quoted).  The last expression
  1397.                     must return <value>.
  1398.           returns   the field specifier symbol
  1399.  
  1400.      (push  <expr> <place>)                                 CONS TO A FIELD
  1401.           Defined  as  macro  in  common.lsp.  Only  evaluates  place  form
  1402.           arguments one  time. It is recommended  that *displace-macros* be
  1403.           non-NIL for best performance.
  1404.           <place>   field specifier being modified (see setf)
  1405.           <expr>    value to cons to field
  1406.           returns   the new value which is (CONS <expr> <place>)
  1407.  
  1408.      (pushnew <expr> <place> &key :test :test-not :key) CONS NEW TO A FIELD
  1409.           Defined  as  macro  in  common.lsp.  Only  evaluates  place  form
  1410.           arguments one  time. It is recommended  that *displace-macros* be
  1411.           non-NIL for best performance.
  1412.           <place>   field specifier being modified (see setf)
  1413.           <expr>    value to cons to field, if not already MEMBER of field
  1414.           :test     the test function (defaults to eql)
  1415.           :test-not the test function (sense inverted)
  1416.           :key      function  to  apply  to  test  function  list  argument
  1417.                     (defaults to identity)
  1418.           returns   the new value which is (CONS <expr> <place>) or <place>
  1419.  
  1420.      (pop <place>)                          REMOVE FIRST ELEMENT OF A FIELD
  1421.           Defined  as  macro  in  common.lsp.  Only  evaluates  place  form
  1422.           arguments one  time. It is recommended  that *displace-macros* be
  1423.           non-NIL for best performance.
  1424.           <place>   the field being modified (see setf)
  1425.           returns   (CAR <place>), field changed to (CDR <place>)
  1426.  
  1427.      (incf <place> [<value>])                             INCREMENT A FIELD
  1428.      (decf <place> [<value>])                             DECREMENT A FIELD
  1429.           Defined  as  macro  in  common.lsp.  Only  evaluates  place  form
  1430.           arguments one  time. It is recommended  that *displace-macros* be
  1431.           non-NIL for best performance.
  1432.           <place>   field specifier being modified (see setf)
  1433.           <value>   Numeric value (default 1)
  1434.           returns   the  new  value which  is  (+  <place> <value>)  or  (-
  1435.                     <place> <value>)
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.      XLISP 2.1d                 SYMBOL FUNCTIONS                    Page 28
  1444.  
  1445.  
  1446.      (defun <sym> <fargs> <expr>...)                      DEFINE A FUNCTION
  1447.      (defmacro <sym> <fargs> <expr>...)                      DEFINE A MACRO
  1448.           fsubr
  1449.           <sym>     symbol being defined (quoted)
  1450.           <fargs>   formal argument list (lambda list) (quoted)
  1451.           <expr>    expressions  constituting  the  body  of  the  function
  1452.                     (quoted)
  1453.           returns   the function symbol
  1454.  
  1455.      (gensym [<tag>])                                     GENERATE A SYMBOL
  1456.           <tag>     string or number
  1457.           returns   the new symbol, uninterned
  1458.  
  1459.      (intern <pname>)                               MAKE AN INTERNED SYMBOL
  1460.           <pname>   the symbol's print name string
  1461.           returns   the new symbol
  1462.  
  1463.      (make-symbol <pname>)                        MAKE AN UNINTERNED SYMBOL
  1464.           <pname>   the symbol's print name string
  1465.           returns   the new symbol
  1466.  
  1467.      (symbol-name <sym>)                     GET THE PRINT NAME OF A SYMBOL
  1468.           <sym>     the symbol
  1469.           returns   the symbol's print name
  1470.  
  1471.      (symbol-value <sym>)                         GET THE VALUE OF A SYMBOL
  1472.           <sym>     the symbol
  1473.           returns   the symbol's value
  1474.  
  1475.      (symbol-function <sym>)           GET THE FUNCTIONAL VALUE OF A SYMBOL
  1476.           <sym>     the symbol
  1477.           returns   the symbol's functional value
  1478.  
  1479.      (symbol-plist <sym>)                 GET THE PROPERTY LIST OF A SYMBOL
  1480.           <sym>     the symbol
  1481.           returns   the symbol's property list
  1482.  
  1483.      (hash <expr> <n>)                               COMPUTE THE HASH INDEX
  1484.           <expr>    the object to hash
  1485.           <n>       the table size (positive integer)
  1486.           returns   the hash index (integer 0 to n-1)
  1487.  
  1488.      (makunbound <sym>)                      MAKE A SYMBOL VALUE BE UNBOUND
  1489.           You cannot unbind constants.
  1490.           <sym>     the symbol
  1491.           returns   the symbol
  1492.  
  1493.      (fmakunbound <sym>)                  MAKE A SYMBOL FUNCTION BE UNBOUND
  1494.           Defined in init.lsp
  1495.           <sym>     the symbol
  1496.           returns   the symbol
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.      XLISP 2.1d                 SYMBOL FUNCTIONS                    Page 29
  1505.  
  1506.  
  1507.      (unintern <sym>)                                     UNINTERN A SYMBOL
  1508.           Defined in common.lsp
  1509.           <sym>     the symbol
  1510.           returns   t if successful, NIL if symbol not interned
  1511.  
  1512.      (defconstant <sym> <val>)                            DEFINE A CONSTANT
  1513.           fsubr.
  1514.           <sym>     the symbol
  1515.           <val>     the value
  1516.           returns   the value
  1517.  
  1518.      (defparameter <sym> <val>)                          DEFINE A PARAMETER
  1519.           fsubr.
  1520.           <sym>     the symbol
  1521.           <val>     the value
  1522.           returns   the value
  1523.  
  1524.      (defvar <sym> [<val>])                               DEFINE A VARIABLE
  1525.           fsubr. Variable only initialized if not previously defined.
  1526.           <sym>     the symbol
  1527.           <val>     the initial value, or NIL if absent.
  1528.           returns   the current value
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.      XLISP 2.1d              PROPERTY LIST FUNCTIONS                Page 30
  1537.  
  1538.  
  1539.  
  1540.      PROPERTY LIST FUNCTIONS
  1541.  
  1542.      Note that property names are not limited to symbols.
  1543.  
  1544.      (get <sym> <prop>)                         GET THE VALUE OF A PROPERTY
  1545.           <sym>     the symbol
  1546.           <prop>    the property symbol
  1547.           returns   the property value or NIL
  1548.  
  1549.      (putprop <sym> <val> <prop>)       PUT A PROPERTY ONTO A PROPERTY LIST
  1550.           <sym>     the symbol
  1551.           <val>     the property value
  1552.           <prop>    the property symbol
  1553.           returns   the property value
  1554.  
  1555.      (remprop <sym> <prop>)                               DELETE A PROPERTY
  1556.           <sym>     the symbol
  1557.           <prop>    the property symbol
  1558.           returns   NIL
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.      XLISP 2.1d               HASH TABLE FUNCTIONS                  Page 31
  1567.  
  1568.  
  1569.  
  1570.      HASH TABLE FUNCTIONS
  1571.  
  1572.      A hash  table is implemented  as an structure  of type hash-table.  No
  1573.      general accessing  functions are provided,  and hash tables  print out
  1574.      using the angle bracket  convention (not readable by READ).  The first
  1575.      element  is the  comparison function.  The remaining  elements contain
  1576.      association lists  of keys (that  hash to  the same  value) and  their
  1577.      data.
  1578.  
  1579.      (make-hash-table &key :size :test)                   MAKE A HASH TABLE
  1580.           :size     size of hash table -- should be a prime number. Default
  1581.                     is 31.
  1582.           :test     comparison function. Defaults to eql.
  1583.           returns   the hash table
  1584.  
  1585.      (gethash <key> <table> [<def>])                EXTRACT FROM HASH TABLE
  1586.           See also gethash in SETF.
  1587.           <key>     hash key
  1588.           <table>   hash table
  1589.           <def>     value to return on no match (default is NIL)
  1590.           returns   associated data, if found, or <def> if not found.
  1591.  
  1592.      (remhash <key> <table>)                         DELETE FROM HASH TABLE
  1593.           <key>     hash key
  1594.           <table>   hash table
  1595.           returns   T if deleted, NIL if not in table
  1596.  
  1597.      (clrhash <table>)                                 CLEAR THE HASH TABLE
  1598.           <table>   hash table
  1599.           returns   NIL, all entries cleared from table
  1600.  
  1601.      (hash-table-count <table>)             NUMBER OF ENTRIES IN HASH TABLE
  1602.           <table>   hash table
  1603.           returns   integer number of entries in table
  1604.  
  1605.      (maphash <fcn> <table>)                MAP FUNCTION OVER TABLE ENTRIES
  1606.           <fcn>     the  function  or  function  name, a  function  of  two
  1607.                     arguments, the  first  is bound  to  the key,  and  the
  1608.                     second the value of each table entry in turn.
  1609.           <table>   hash table
  1610.           returns   NIL
  1611.  
  1612.  
  1613.  
  1614.  
  1615.  
  1616.  
  1617.  
  1618.      XLISP 2.1d                  ARRAY FUNCTIONS                    Page 32
  1619.  
  1620.  
  1621.  
  1622.      ARRAY FUNCTIONS
  1623.  
  1624.      Note that sequence functions also work on arrays.
  1625.  
  1626.      (aref <array> <n>)                     GET THE NTH ELEMENT OF AN ARRAY
  1627.           See setf for setting elements of arrays
  1628.           <array>   the array (or string)
  1629.           <n>       the array index (integer, zero based)
  1630.           returns   the value of the array element
  1631.  
  1632.      (make-array <size>)                                   MAKE A NEW ARRAY
  1633.           <size>    the size of the new array (integer)
  1634.           returns   the new array
  1635.  
  1636.      (vector <expr>...)                          MAKE AN INITIALIZED VECTOR
  1637.           <expr>    the vector elements
  1638.           returns   the new vector
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.      XLISP 2.1d                SEQUENCE FUNCTIONS                   Page 33
  1647.  
  1648.  
  1649.  
  1650.      SEQUENCE FUNCTIONS
  1651.  
  1652.      These functions work on sequences -- lists, arrays, or strings.
  1653.  
  1654.      (concatenate <type> <expr> ...)                  CONCATENATE SEQUENCES
  1655.           If result type is string, sequences must contain only characters.
  1656.           <type>    result type, one of CONS, LIST, ARRAY, or STRING
  1657.           <expr>    zero or more sequences to concatenate
  1658.           returns   a sequence which is  the concatenation of the arguement
  1659.                     sequences
  1660.  
  1661.      (elt <expr> <n>)                     GET THE NTH ELEMENT OF A SEQUENCE
  1662.           <expr>    the sequence
  1663.           <n>       the index of element to return
  1664.           returns   the element if the index is in bounds, otherwise error
  1665.  
  1666.      (map <type> <fcn> <expr> ...)    APPLY FUNCTION TO SUCCESSIVE ELEMENTS
  1667.           <type>    result type, one of CONS, LIST, ARRAY, STRING, or NIL
  1668.           <fcn>     the function or function name
  1669.           <expr>    a sequence for each argument of the function
  1670.           returns   a new sequence of type <type>.
  1671.  
  1672.      (every <fcn> <expr> ...)        APPLY FUNCTION TO ELEMENTS UNTIL FALSE
  1673.      (notevery <fcn> <expr> ...)
  1674.           <fcn>     the function or function name
  1675.           <expr>    a sequence for each argument of the function
  1676.           returns   every returns last evaluated function result
  1677.                     notevery  returns T if there is  a NIL function result,
  1678.                     else NIL
  1679.  
  1680.      (some <fcn> <expr> ...)          APPLY FUNCTION TO ELEMENTS UNTIL TRUE
  1681.      (notany <fcn> <expr> ...)
  1682.           <fcn>     the function or function name
  1683.           <expr>    a sequence for each argument of the function
  1684.           returns   some returns first non-NIL function result, or NIL
  1685.                     notany  returns  NIL if  there  is  a non-NIL  function
  1686.                     result, else T
  1687.  
  1688.      (length <expr>)                          FIND THE LENGTH OF A SEQUENCE
  1689.           <expr>    the list, vector or string
  1690.           returns   the length of the list, vector or string
  1691.  
  1692.      (reverse <expr>)                                    REVERSE A SEQUENCE
  1693.      (nreverse <expr>)                     DESTRUCTIVELY REVERSE A SEQUENCE
  1694.           <expr>    the sequence to reverse
  1695.           returns   a new sequence in the reverse order
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.      XLISP 2.1d                SEQUENCE FUNCTIONS                   Page 34
  1704.  
  1705.  
  1706.      (subseq <seq> <start> [<end>])                   EXTRACT A SUBSEQUENCE
  1707.           <seq>     the sequence
  1708.           <start>   the starting position (zero origin)
  1709.           <end>     the  ending position + 1  (defaults to end)  or NIL for
  1710.                     end of sequence
  1711.           returns   the sequence between <start> and <end>
  1712.  
  1713.      (search <seq1>  <seq2> &key :test :test-not :key :start1 :end1 :start2
  1714.      :end2)
  1715.                                                         SEARCH FOR SEQUENCE
  1716.           <seq1>    the sequence to search for
  1717.           <seq2>    the sequence to search in
  1718.           :test     the test function (defaults to eql)
  1719.           :test-not the test function (sense inverted)
  1720.           :key      function  to apply to test function arguments (defaults
  1721.                     to identity)
  1722.           :start1   starting index in <seq1>
  1723.           :end1     index of end+1 in <seq1> or NIL for end of sequence
  1724.           :start2   starting index in <seq2>
  1725.           :end2     index of end+1 in <seq2> or NIL for end of sequence
  1726.           returns   position of first match
  1727.  
  1728.      (remove <expr> <seq> &key :test :test-not :key :start :end)
  1729.                                             REMOVE ELEMENTS FROM A SEQUENCE
  1730.           <expr>    the element to remove
  1731.           <seq>     the sequence
  1732.           :test     the test function (defaults to eql)
  1733.           :test-not the test function (sense inverted)
  1734.           :key      function  to apply  to test function  sequence argument
  1735.                     (defaults to identity)
  1736.           :start    starting index
  1737.           :end      index of end+1, or NIL for (length <seq>)
  1738.           returns   copy of sequence with matching expressions removed
  1739.  
  1740.      (remove-if <test> <seq> &key :key :start :end)
  1741.                                              REMOVE ELEMENTS THAT PASS TEST
  1742.      (remove-if-not <test> <seq> &key :key :start :end)
  1743.                                              REMOVE ELEMENTS THAT FAIL TEST
  1744.           <test>    the test predicate
  1745.           <seq>     the sequence
  1746.           :key      function to  apply to test  function argument (defaults
  1747.                     to identity)
  1748.           :start    starting index
  1749.           :end      index of end+1, or NIL for (length <seq>)
  1750.           returns   copy of sequence with matching or non-matching elements
  1751.                     removed
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.      XLISP 2.1d                SEQUENCE FUNCTIONS                   Page 35
  1760.  
  1761.  
  1762.      (count-if <test> <seq> &key :key :start :end)
  1763.                                               COUNT ELEMENTS THAT PASS TEST
  1764.           <test>    the test predicate
  1765.           <seq>     the sequence
  1766.           :key      function to  apply to test function  argument (defaults
  1767.                     to identity)
  1768.           :start    starting index
  1769.           :end      index of end+1, or NIL for (length <seq>)
  1770.           returns   count of matching elements
  1771.  
  1772.      (find-if <test> <seq> &key :key :start :end)
  1773.                                         FIND FIRST ELEMENT THAT PASSES TEST
  1774.           <test>    the test predicate
  1775.           <seq>     the list
  1776.           :key      function to apply  to test function  argument (defaults
  1777.                     to identity)
  1778.           :start    starting index
  1779.           :end      index of end+1, or NIL for (length <seq>)
  1780.           returns   first element of sequence that passes test
  1781.  
  1782.      (position-if <test> <seq> &key :key :start :end)
  1783.                             FIND POSITION OF FIRST ELEMENT THAT PASSES TEST
  1784.           <test>    the test predicate
  1785.           <seq>     the list
  1786.           :key      function  to apply to  test function argument (defaults
  1787.                     to identity)
  1788.           :start    starting index
  1789.           :end      index of end+1, or NIL for (length <seq>)
  1790.           returns   position of first element of sequence that passes test,
  1791.                     or NIL.
  1792.  
  1793.      (delete <expr> <seq> &key :key :test :test-not :start :end)
  1794.                                             DELETE ELEMENTS FROM A SEQUENCE
  1795.           <expr>    the element to delete
  1796.           <seq>     the sequence
  1797.           :test     the test function (defaults to eql)
  1798.           :test-not the test function (sense inverted)
  1799.           :key      function to  apply to  test function sequence  argument
  1800.                     (defaults to identity)
  1801.           :start    starting index
  1802.           :end      index of end+1, or NIL for (length <seq>)
  1803.           returns   the sequence with the matching expressions deleted
  1804.  
  1805.  
  1806.  
  1807.  
  1808.  
  1809.  
  1810.  
  1811.      XLISP 2.1d                SEQUENCE FUNCTIONS                   Page 36
  1812.  
  1813.  
  1814.      (delete-if <test> <seq> &key :key :start :end)
  1815.                                              DELETE ELEMENTS THAT PASS TEST
  1816.      (delete-if-not <test> <seq> &key :key :start :end)
  1817.                                              DELETE ELEMENTS THAT FAIL TEST
  1818.           <test>    the test predicate
  1819.           <seq>     the sequence
  1820.           :key      function to  apply to test function  argument (defaults
  1821.                     to identity)
  1822.           :start    starting index
  1823.           :end      index of end+1, or NIL for (length <seq>)
  1824.           returns   the  sequence with  matching  or non-matching  elements
  1825.                     deleted
  1826.  
  1827.      (reduce <fcn> <seq> &key :initial-value :start :end)
  1828.                                             REDUCE SEQUENCE TO SINGLE VALUE
  1829.           <fcn>     function  (of  two arguments)  to  apply  to result  of
  1830.                     previous  function application  (or first  element) and
  1831.                     each member of sequence.
  1832.           <seq>     the sequence
  1833.           :initial-value      value  to  use  as  first  argument  in first
  1834.                               function  application  rather than  using the
  1835.                               first element of the sequence.
  1836.           :start    starting index
  1837.           :end      index of end+1, or NIL for (length <seq>)
  1838.           returns   if  sequence is  empty and there  is no  initial value,
  1839.                     returns result of applying function to zero arguements.
  1840.                     If  there is  a  single element,  returns the  element.
  1841.                     Otherwise  returns  the  result of  the  last  function
  1842.                     application.
  1843.  
  1844.      (remove-duplicates <seq> &key :test :test-not :key :start :end)
  1845.                                             REMOVE DUPLICATES FROM SEQUENCE
  1846.           <seq>     the sequence
  1847.           :test     comparison function (default eql)
  1848.           :test-not comparison function (sense inverted)
  1849.           :key      function  to apply to test function arguments (defaults
  1850.                     to identity)
  1851.           :start    starting index
  1852.           :end      index of end+1, or NIL for (length <seq>)
  1853.           returns   copy of sequence with duplicates removed.
  1854.  
  1855.      (fill <seq> <expr> &key :start :end)         REPLACE ITEMS IN SEQUENCE
  1856.           Defined in common.lsp
  1857.           <seq>     the sequence
  1858.           <expr>    new value to place in sequence
  1859.           :start    starting index
  1860.           :end      index of end+1, or NIL for (length <seq>)
  1861.           returns   sequence with items replaced with new item
  1862.  
  1863.  
  1864.  
  1865.  
  1866.  
  1867.  
  1868.  
  1869.      XLISP 2.1d                SEQUENCE FUNCTIONS                   Page 37
  1870.  
  1871.  
  1872.      (replace <seq1> <seq2> &key :start1 :end1 :start2 :end2)
  1873.                                     REPLACE ITEMS IN SEQUENCE FROM SEQUENCE
  1874.           Defined in common.lsp
  1875.           <seq1>    the sequence to modify
  1876.           <seq2>    sequence with new items
  1877.           :start1   starting index in <seq1>
  1878.           :end1     index of end+1 in <seq1> or NIL for end of sequence
  1879.           :start2   starting index in <seq2>
  1880.           :end2     index of end+1 in <seq2> or NIL for end of sequence
  1881.           returns   first sequence with items replaced
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.      XLISP 2.1d                  LIST FUNCTIONS                     Page 38
  1890.  
  1891.  
  1892.  
  1893.      LIST FUNCTIONS 
  1894.  
  1895.      (car <expr>)                             RETURN THE CAR OF A LIST NODE
  1896.           <expr>    the list node
  1897.           returns   the car of the list node
  1898.  
  1899.      (cdr <expr>)                             RETURN THE CDR OF A LIST NODE
  1900.           <expr>    the list node
  1901.           returns   the cdr of the list node
  1902.  
  1903.      (cxxr <expr>)                                    ALL CxxR COMBINATIONS
  1904.      (cxxxr <expr>)                                  ALL CxxxR COMBINATIONS
  1905.      (cxxxxr <expr>)                                ALL CxxxxR COMBINATIONS
  1906.  
  1907.      (first <expr>)                                       A SYNONYM FOR CAR
  1908.      (second <expr>)                                     A SYNONYM FOR CADR
  1909.      (third <expr>)                                     A SYNONYM FOR CADDR
  1910.      (fourth <expr>)                                   A SYNONYM FOR CADDDR
  1911.      (rest <expr>)                                        A SYNONYM FOR CDR
  1912.  
  1913.      (cons <expr1> <expr2>)                       CONSTRUCT A NEW LIST NODE
  1914.           <expr1>   the car of the new list node
  1915.           <expr2>   the cdr of the new list node
  1916.           returns   the new list node
  1917.  
  1918.      (acons <expr1> <expr2> <alist>)             ADD TO FRONT OF ASSOC LIST
  1919.           defined in common.lsp
  1920.           <expr1>   key of new association
  1921.           <expr2>   value of new association
  1922.           <alist>   association list
  1923.           returns   new association  list,  which is  (cons  (cons  <expr1>
  1924.                     <expr2>) <expr3>))
  1925.  
  1926.      (list <expr>...)                               CREATE A LIST OF VALUES
  1927.      (list* <expr> ... <list>)
  1928.           <expr>    expressions to be combined into a list
  1929.           returns   the new list
  1930.  
  1931.      (append <expr>...)                                        APPEND LISTS
  1932.           <expr>    lists whose elements are to be appended
  1933.           returns   the new list
  1934.  
  1935.      (last <list>)                      RETURN THE LAST LIST NODE OF A LIST
  1936.           <list>    the list
  1937.           returns   the last list node in the list
  1938.  
  1939.      (butlast <list> [<n>])             RETURN COPY OF ALL BUT LAST OF LIST
  1940.           <list>    the list
  1941.           <n>       count of elements to omit (default 1)
  1942.           returns   copy of list with last element(s) absent.
  1943.  
  1944.  
  1945.  
  1946.  
  1947.  
  1948.  
  1949.  
  1950.      XLISP 2.1d                  LIST FUNCTIONS                     Page 39
  1951.  
  1952.  
  1953.      (nth <n> <list>)                      RETURN THE NTH ELEMENT OF A LIST
  1954.           <n>       the number of the element to return (zero origin)
  1955.           <list>    the list
  1956.           returns   the nth element or NIL if the list isn't that long
  1957.  
  1958.      (nthcdr <n> <list>)                       RETURN THE NTH CDR OF A LIST
  1959.           <n>       the number of the element to return (zero origin)
  1960.           <list>    the list
  1961.           returns   the nth cdr or NIL if the list isn't that long
  1962.  
  1963.      (member <expr> <list> &key :test :test-not :key)
  1964.                                                FIND AN EXPRESSION IN A LIST
  1965.           <expr>    the expression to find
  1966.           <list>    the list to search
  1967.           :test     the test function (defaults to eql)
  1968.           :test-not the test function (sense inverted)
  1969.           :key      function  to  apply  to  test  function  list  argument
  1970.                     (defaults to identity)
  1971.           returns   the remainder of the list starting with the expression
  1972.  
  1973.      (assoc <expr> <alist> &key :test :test-not :key)
  1974.                                             FIND AN EXPRESSION IN AN A-LIST
  1975.           <expr>    the expression to find
  1976.           <alist>   the association list
  1977.           :test     the test function (defaults to eql)
  1978.           :test-not the test function (sense inverted)
  1979.           :key      function  to  apply  to  test  function  list  argument
  1980.                     (defaults to identity)
  1981.           returns   the alist entry or NIL
  1982.  
  1983.      (mapc <fcn> <list1> <list>...)       APPLY FUNCTION TO SUCCESSIVE CARS
  1984.           <fcn>     the function or function name
  1985.           <listn>   a list for each argument of the function
  1986.           returns   the first list of arguments
  1987.  
  1988.      (mapcar <fcn> <list1> <list>...)     APPLY FUNCTION TO SUCCESSIVE CARS
  1989.           <fcn>     the function or function name
  1990.           <listn>   a list for each argument of the function
  1991.           returns   a list of the values returned
  1992.  
  1993.      (mapl <fcn> <list1> <list>...)       APPLY FUNCTION TO SUCCESSIVE CDRS
  1994.           <fcn>     the function or function name
  1995.           <listn>   a list for each argument of the function
  1996.           returns   the first list of arguments
  1997.  
  1998.      (maplist <fcn> <list1> <list>...)    APPLY FUNCTION TO SUCCESSIVE CDRS
  1999.           <fcn>     the function or function name
  2000.           <listn>   a list for each argument of the function
  2001.           returns   a list of the values returned
  2002.  
  2003.  
  2004.  
  2005.  
  2006.  
  2007.  
  2008.  
  2009.      XLISP 2.1d                  LIST FUNCTIONS                     Page 40
  2010.  
  2011.  
  2012.      (mapcan <fcn> <list1> <list>...)      APPL FUNCTION TO SUCCESSIVE CARS
  2013.           <fcn>     the function or function name
  2014.           <listn>   a list for each argument of the function
  2015.           returns   list of return values nconc'd together
  2016.  
  2017.      (mapcon <fcn> <list1> <list>...)      APPL FUNCTION TO SUCCESSIVE CDRS
  2018.           <fcn>     the function or function name
  2019.           <listn>   a list for each argument of the function
  2020.           returns   list of return values nconc'd together
  2021.  
  2022.      (subst <to> <from> <expr> &key :test :test-not :key)
  2023.                                                      SUBSTITUTE EXPRESSIONS
  2024.           Does minimum copying as required by Common Lisp
  2025.           <to>      the new expression
  2026.           <from>    the old expression
  2027.           <expr>    the expression in which to do the substitutions
  2028.           :test     the test function (defaults to eql)
  2029.           :test-not the test function (sense inverted)
  2030.           :key      function to apply to  test function expression argument
  2031.                     (defaults to identity)
  2032.           returns   the expression with substitutions
  2033.  
  2034.      (sublis <alist> <expr> &key :test :test-not :key)
  2035.                                                   SUBSTITUTE WITH AN A-LIST
  2036.           Does minimum copying as required by Common Lisp
  2037.           <alist>   the association list
  2038.           <expr>    the expression in which to do the substitutions
  2039.           :test     the test function (defaults to eql)
  2040.           :test-not the test function (sense inverted)
  2041.           :key      function to apply to test  function expression argument
  2042.                     (defaults to identity)
  2043.           returns   the expression with substitutions
  2044.  
  2045.      (pairlis <keys> <values> [<alist>])     BUILD AN A-LIST FROM TWO LISTS
  2046.           In file common.lsp
  2047.           <keys>    list of association keys
  2048.           <values>  list of association values, same length as keys
  2049.           <alist>   existing association list, default NIL
  2050.           returns   new association list
  2051.  
  2052.      (copy-list <list>)                        COPY THE TOP LEVEL OF A LIST
  2053.           In file common.lsp
  2054.           <list>    the list
  2055.           returns   a copy of the list (new cons cells in top level)
  2056.  
  2057.      (copy-alist <alist>)                          COPY AN ASSOCIATION LIST
  2058.           In file common.lsp
  2059.           <alist>   the association list
  2060.           returns   a copy  of the  association list  (keys and values  not
  2061.           copies)
  2062.  
  2063.  
  2064.  
  2065.  
  2066.  
  2067.  
  2068.  
  2069.      XLISP 2.1d                  LIST FUNCTIONS                     Page 41
  2070.  
  2071.  
  2072.      (copy-tree <tree>)                                         COPY A TREE
  2073.           In file common.lsp
  2074.           <tree>    a tree structure of cons cells
  2075.           returns   a copy of the tree structure
  2076.  
  2077.      (intersection <list1> <list2> &key :test :test-not :key) SET FUNCTIONS
  2078.      (union <list1> <list2> &key :test :test-not :key)
  2079.      (set-difference <list1> <list2> &key :test :test-not :key)
  2080.      (set-exclusive-or <list1> <list2> &key :test :test-not :key)
  2081.      (nintersection <list1> <list2> &key :test :test-not :key)
  2082.      (nunion <list1> <list2> &key :test :test-not :key)
  2083.      (nset-difference <list1> <list2> &key :test :test-not :key)
  2084.      (nset-exclusive-or <list1> <list2> &key :test :test-not :key)
  2085.           set-exclusive-or  and  nset-exclusive-or  defined in  common.lsp.
  2086.           nunion, nintersection, and  nset-difference are aliased  to their
  2087.           non-destructive counterparts in common.lsp.
  2088.           <list1>   first list
  2089.           <list2>   second list
  2090.           :test     the test function (defaults to eql)
  2091.           :test-not the test function (sense inverted)
  2092.           :key      function to apply to  test function arguments (defaults
  2093.                     to identity)
  2094.           returns   intersection: list of all elements in both lists
  2095.                     union: list of all elements in either list
  2096.                     set-diference: list  of all elements in  first list but
  2097.                     not in second list
  2098.                     set-exclusive-or: list of all elements in only one list
  2099.                     "n" versions are potentially destructive.
  2100.  
  2101.      (adjoin <expr> <list> :test :test-not :key)         ADD UNIQUE TO LIST
  2102.           <expr>    new element to add
  2103.           <list>    the list
  2104.           :test     the test function (defaults to eql)
  2105.           :test-not the test function <sense inverted)
  2106.           :key      function to apply to  test function arguments (defaults
  2107.                     to identity)
  2108.           returns   if element not in list then  (cons <expr> <list>), else
  2109.                     <list>.
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.  
  2117.      XLISP 2.1d            DESTRUCTIVE LIST FUNCTIONS               Page 42
  2118.  
  2119.  
  2120.  
  2121.      DESTRUCTIVE LIST FUNCTIONS
  2122.  
  2123.      See also nreverse, delete, delete-if, delete-if-not, fill, and replace
  2124.      under   SEQUENCE  FUNCTIONS,   setf   under   SYMBOL  FUNCTIONS,   and
  2125.      nintersection,  nunion,  nset-difference, and  nset-exclusive-or under
  2126.      LIST FUNCTIONS.
  2127.  
  2128.      (rplaca <list> <expr>)                  REPLACE THE CAR OF A LIST NODE
  2129.           <list>    the list node
  2130.           <expr>    the new value for the car of the list node
  2131.           returns   the list node after updating the car
  2132.  
  2133.      (rplacd <list> <expr>)                  REPLACE THE CDR OF A LIST NODE
  2134.           <list>    the list node
  2135.           <expr>    the new value for the cdr of the list node
  2136.           returns   the list node after updating the cdr
  2137.  
  2138.      (nconc <list>...)                      DESTRUCTIVELY CONCATENATE LISTS
  2139.           <list>    lists to concatenate
  2140.           returns   the result of concatenating the lists
  2141.  
  2142.      (sort <list> <test> &key :key)                             SORT A LIST
  2143.           <list>    the list to sort
  2144.           <test>    the comparison function
  2145.           :key      function  to  apply  to comparison  function  arguments
  2146.                     (defaults to identity)
  2147.           returns   the sorted list
  2148.  
  2149.  
  2150.  
  2151.  
  2152.  
  2153.  
  2154.  
  2155.      XLISP 2.1d               ARITHMETIC FUNCTIONS                  Page 43
  2156.  
  2157.  
  2158.  
  2159.      ARITHMETIC FUNCTIONS
  2160.  
  2161.      Warning: integer  and ratio calculations that  overflow give erroneous
  2162.      results. On systems with IEEE floating point, the values +INF and -INF
  2163.      result from overflowing floating point calculations.
  2164.  
  2165.      The math extension option adds complex numbers, ratios, new functions,
  2166.      and additional  functionality to  some existing functions.  Because of
  2167.      the size of the extension,  and the performance loss it  entails, some
  2168.      users may  not wish  to include  it. This  section documents the  math
  2169.      functions both with and without the extension.
  2170.  
  2171.      Functions that are  described as having floating  point arguments (SIN
  2172.      COS TAN ASIN ACOS ATAN EXPT EXP SQRT) will take arguments  of any type
  2173.      (real   or  complex)  when  the   math  extension  is   used.  In  the
  2174.      descriptions, "rational  number" means  integer or  ratio   only,  and
  2175.      "real number" means floating point number or rational only.
  2176.  
  2177.      Any  rational results are  reduced to canonical  form (the gcd  of the
  2178.      numerator and denominator is 1, the denominator is positive); integral
  2179.      results are  reduced to  integers. Integer  complex numbers with  zero
  2180.      imaginary parts are reduced to integers.
  2181.  
  2182.      (truncate <expr> <denom>)                        TRUNCATES TOWARD ZERO
  2183.      (round <expr> <denom>)                   ROUNDS TOWARD NEAREST INTEGER
  2184.      (floor <expr> <denom>)              TRUNCATES TOWARD NEGATIVE INFINITY
  2185.      (ceiling <expr> <denom>)                     TRUNCATES TOWARD INFINITY
  2186.           Round,  floor, and ceiling, and the  second argument of truncate,
  2187.           are part of the math extension. Results too big to be represented
  2188.           as integers are returned as floating point numbers as part of the
  2189.           math extension. Integers are returned as is.
  2190.           <expr>    the real number
  2191.           <denom>   real number to divide <expr> by before converting
  2192.           returns   the integer result of converting the number
  2193.  
  2194.      (float <expr>)          CONVERTS AN INTEGER TO A FLOATING POINT NUMBER
  2195.           <expr>    the real number
  2196.           returns   the number as a floating point number
  2197.  
  2198.      (+ [<expr>...])                                  ADD A LIST OF NUMBERS
  2199.           With no arguments returns addition identity, 0 (integer)
  2200.           <expr>    the numbers
  2201.           returns   the result of the addition
  2202.  
  2203.      (- <expr>...)     SUBTRACT A LIST OF NUMBERS OR NEGATE A SINGLE NUMBER
  2204.           <expr>    the numbers
  2205.           returns   the result of the subtraction
  2206.  
  2207.  
  2208.  
  2209.  
  2210.  
  2211.  
  2212.  
  2213.      XLISP 2.1d               ARITHMETIC FUNCTIONS                  Page 44
  2214.  
  2215.  
  2216.      (* [<expr>...])                             MULTIPLY A LIST OF NUMBERS
  2217.           With no arguments returns multiplication identity, 1
  2218.           <expr>    the numbers
  2219.           returns   the result of the multiplication
  2220.  
  2221.      (/ <expr>...)       DIVIDE A LIST OF NUMBERS OR INVERT A SINGLE NUMBER
  2222.           With the math extension, division of integer numbers results in a
  2223.           rational  quotient,  rather  than  integer.  To  perform  integer
  2224.           division,  use TRUNCATE. When an integer complex is divided by an
  2225.           integer, the quotient is floating point complex.
  2226.           <expr>    the numbers
  2227.           returns   the result of the division
  2228.  
  2229.      (1+ <expr>)                                        ADD ONE TO A NUMBER
  2230.           <expr>    the number
  2231.           returns   the number plus one
  2232.  
  2233.      (1- <expr>)                                 SUBTRACT ONE FROM A NUMBER
  2234.           <expr>    the number
  2235.           returns   the number minus one
  2236.  
  2237.      (rem <expr>...)                         REMAINDER OF A LIST OF NUMBERS
  2238.           With the math extension, only two arguments allowed.
  2239.           <expr>    the  real  numbers  (must  be  integers,  without  math
  2240.                     extension)
  2241.           returns   the result  of the remainder operation  (remainder with
  2242.                     truncating division)
  2243.  
  2244.      (mod <expr1> <expr2>)                     NUMBER MODULO ANOTHER NUMBER
  2245.           Part of math extension.
  2246.           <expr1>   real number
  2247.           <expr2>   real number divisor (may not be zero)
  2248.           returns   the remainder  after dividing <expr1> by  <expr2> using
  2249.                     flooring division,  thus there is  no discontinuity  in
  2250.                     the function around zero.
  2251.  
  2252.      (min <expr>...)                      THE SMALLEST OF A LIST OF NUMBERS
  2253.           <expr>    the real numbers
  2254.           returns   the smallest number in the list
  2255.  
  2256.      (max <expr>...)                       THE LARGEST OF A LIST OF NUMBERS
  2257.           <expr>    the real numbers
  2258.           returns   the largest number in the list
  2259.  
  2260.      (abs <expr>)                            THE ABSOLUTE VALUE OF A NUMBER
  2261.           <expr>    the number
  2262.           returns   the absolute value of the number, which is the floating
  2263.                     point magnitude for complex numbers.
  2264.  
  2265.  
  2266.  
  2267.  
  2268.  
  2269.  
  2270.  
  2271.      XLISP 2.1d               ARITHMETIC FUNCTIONS                  Page 45
  2272.  
  2273.  
  2274.      (signum <expr>)                               GET THE SIGN OF A NUMBER
  2275.           Defined in common.lsp
  2276.           <expr>    the number
  2277.           returns   zero if number  is zero, one  if positive, or  negative
  2278.                     one  if negative. Numeric type is same as number. For a
  2279.                     complex number,  returns unit magnitude  but same phase
  2280.                     as number.
  2281.  
  2282.      (gcd [<n>...])                     COMPUTE THE GREATEST COMMON DIVISOR
  2283.           With  no  arguments  returns 0,  with  one  argument returns  the
  2284.           argument.
  2285.           <n>       The number(s) (integer)
  2286.           returns   the greatest common divisor
  2287.  
  2288.      (lcm <n>...)                         COMPUTE THE LEAST COMMON MULTIPLE
  2289.           Part of math extension.
  2290.           <n>       The number(s) (integer)
  2291.           returns   the least common multiple
  2292.  
  2293.      (random <n> [<state>])                  COMPUTE A PSEUDO-RANDOM NUMBER
  2294.           <n>       the real number upper bound
  2295.           <state>   a random-state (default is *random-state*)
  2296.           returns   a random number in range [0,n)
  2297.  
  2298.      (make-random-state [<state>])                    CREATE A RANDOM-STATE
  2299.           <state>   a  random-state, t,  or  NIL (default  NIL). NIL  means
  2300.                     *random-state*
  2301.           returns   If  <state> is  t, a  random random-state,  otherwise a
  2302.                     copy of <state>
  2303.  
  2304.      (sin <expr>)                              COMPUTE THE SINE OF A NUMBER
  2305.      (cos <expr>)                            COMPUTE THE COSINE OF A NUMBER
  2306.      (tan <expr>)                           COMPUTE THE TANGENT OF A NUMBER
  2307.      (asin <expr>)                         COMPUTE THE ARC SINE OF A NUMBER
  2308.      (acos <expr>)                       COMPUTE THE ARC COSINE OF A NUMBER
  2309.           <expr>    the floating point number
  2310.           returns   the sine, cosine, tangent,  arc sine, or arc  cosine of
  2311.                     the number
  2312.  
  2313.      (atan <expr> [<expr2>])            COMPUTE THE ARC TANGENT OF A NUMBER
  2314.           <expr>    the floating point number (numerator)
  2315.           <expr2>   the denominator,  default 1.  May only be  specified if
  2316.                     math extension installed
  2317.           returns   the arc tangent of <expr>/<expr2>
  2318.  
  2319.  
  2320.  
  2321.  
  2322.  
  2323.  
  2324.  
  2325.      XLISP 2.1d               ARITHMETIC FUNCTIONS                  Page 46
  2326.  
  2327.  
  2328.      (sinh <expr>)                  COMPUTE THE HYPERBOLIC SINE OF A NUMBER
  2329.      (cosh <expr>)                COMPUTE THE HYPERBOLIC COSINE OF A NUMBER
  2330.      (tanh <expr>)               COMPUTE THE HYPERBOLIC TANGENT OF A NUMBER
  2331.      (asinh <expr>)             COMPUTE THE HYPERBOLIC ARC SINE OF A NUMBER
  2332.      (acosh <expr>)           COMPUTE THE HYPERBOLIC ARC COSINE OF A NUMBER
  2333.      (atanh <expr>)          COMPUTE THE HYPERBOLIC ARC TANGENT OF A NUMBER
  2334.           Defined in common.lsp
  2335.           <expr>    the number
  2336.           returns   the  hyperbolic  sine, cosine,  tangent, arc  sine, arc
  2337.                     cosine, or arc tangent of the number.
  2338.  
  2339.      (expt <x-expr> <y-expr>)                      COMPUTE X TO THE Y POWER
  2340.           <x-expr>  the number 
  2341.           <y-expr>  the exponent 
  2342.           returns   x  to the y  power. If y  is a fixnum,  then the result
  2343.                     type is  the same  as the type  of x, unless  fixnum or
  2344.                     ratio  and it would overflow, then the result type is a
  2345.                     flonum.
  2346.  
  2347.      (exp <x-expr>)                                COMPUTE E TO THE X POWER
  2348.           <x-expr>  the floating point number 
  2349.           returns   e to the x power
  2350.  
  2351.      (cis <x-expr>)                                 COMPUTE COSINE + I SINE
  2352.           Defined in common.lsp
  2353.           <x-expr>  the number
  2354.           returns   e to the ix power
  2355.  
  2356.      (log <expr> [<base>])                             COMPUTE THE LOGRITHM
  2357.           Part of the math extension
  2358.           <expr>    the number
  2359.           <base>    the base, default is e
  2360.           returns   log base <base> of <expr>
  2361.  
  2362.      (sqrt <expr>)                      COMPUTE THE SQUARE ROOT OF A NUMBER
  2363.           <expr>    the number 
  2364.           returns   the square root of the number
  2365.  
  2366.      (numerator <expr>)                       GET THE NUMERATOR OF A NUMBER
  2367.           Part of math extension
  2368.           <expr>    rational number
  2369.           returns   numerator of number (number if integer)
  2370.  
  2371.      (denominator <expr>)                   GET THE DENOMINATOR OF A NUMBER
  2372.           Part of math extension
  2373.           <expr>    rational number
  2374.           returns   denominator of number (1 if integer)
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380.  
  2381.  
  2382.      XLISP 2.1d               ARITHMETIC FUNCTIONS                  Page 47
  2383.  
  2384.  
  2385.      (complex <real> [<imag>])                    CONVERT TO COMPLEX NUMBER
  2386.           Part of math extension
  2387.           <real>    real number real part
  2388.           <imag>    real number imaginary part (default 0)
  2389.           returns   the complex number
  2390.  
  2391.      (realpart <expr>)                        GET THE REAL PART OF A NUMBER
  2392.           Part of the math extension
  2393.           <expr>    the number
  2394.           returns   the real part of a complex number, or the number itself
  2395.           if a real number
  2396.  
  2397.      (imagpart <expr>)                   GET THE IMAGINARY PART OF A NUMBER
  2398.           Part of the math extension
  2399.           <expr>    the number
  2400.           returns   the  imaginary part of a complex number, or zero of the
  2401.                     type of the number if a real number.
  2402.  
  2403.      (conjugate <expr>)                       GET THE CONJUGATE OF A NUMBER
  2404.           Part of the math extension
  2405.           <expr>    the number
  2406.           returns   the conjugate of a complex number, or the number itself
  2407.           if a real number.
  2408.  
  2409.      (phase <expr>)                               GET THE PHASE OF A NUMBER
  2410.           Part of the math extension
  2411.           <expr>    the number
  2412.           returns   the phase angle, equivalent  to (atan (imagpart <expr>)
  2413.                     (realpart <expr>))
  2414.  
  2415.      (< <n1> <n2>...)                                    TEST FOR LESS THAN
  2416.      (<= <n1> <n2>...)                       TEST FOR LESS THAN OR EQUAL TO
  2417.      (= <n1> <n2>...)                                     TEST FOR EQUAL TO
  2418.      (/= <n1> <n2>...)                                TEST FOR NOT EQUAL TO
  2419.      (>= <n1> <n2>...)                    TEST FOR GREATER THAN OR EQUAL TO
  2420.      (> <n1> <n2>...)                                 TEST FOR GREATER THAN
  2421.           <n1>      the first real number to compare
  2422.           <n2>      the second real number to compare
  2423.           returns   the result of comparing <n1> with <n2>...
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.      XLISP 2.1d             BITWISE LOGICAL FUNCTIONS               Page 48
  2432.  
  2433.  
  2434.  
  2435.      BITWISE LOGICAL FUNCTIONS
  2436.  
  2437.      (logand [<expr>...])             THE BITWISE AND OF A LIST OF INTEGERS
  2438.           With no arguments returns identity -1
  2439.           <expr>    the integers
  2440.           returns   the result of the and operation
  2441.  
  2442.      (logior [<expr>...])    THE BITWISE INCLUSIVE OR OF A LIST OF INTEGERS
  2443.           With no arguments returns identity 0
  2444.           <expr>    the integers
  2445.           returns   the result of the inclusive or operation
  2446.  
  2447.      (logxor [<expr>...])    THE BITWISE EXCLUSIVE OR OF A LIST OF INTEGERS
  2448.           With no arguments returns identity 0
  2449.           <expr>    the integers
  2450.           returns   the result of the exclusive or operation
  2451.  
  2452.      (lognot <expr>)                           THE BITWISE NOT OF A INTEGER
  2453.           <expr>    the integer
  2454.           returns   the bitwise inversion of integer
  2455.  
  2456.      (logtest <expr1> <expr2>)             TEST BITWISE AND OF TWO INTEGERS
  2457.           Defined in common.lsp
  2458.           <expr1>   the first integer
  2459.           <expr2>   the second integer
  2460.           returns   T  if the result of the and operation is non-zero, else
  2461.                     NIL
  2462.  
  2463.      (ash <expr1> <expr2>)                                 ARITHMETIC SHIFT
  2464.           Part of math extension
  2465.           <expr1>   integer to shift
  2466.           <expr2>   number of bit positions to shift (positive is to left)
  2467.           returns   shifted integer
  2468.  
  2469.  
  2470.  
  2471.  
  2472.  
  2473.  
  2474.  
  2475.      XLISP 2.1d                 STRING FUNCTIONS                    Page 49
  2476.  
  2477.  
  2478.  
  2479.      STRING FUNCTIONS
  2480.  
  2481.      Note: functions  with  names  starting "string"  will  also  accept  a
  2482.      symbol, in which case the symbol's print name is used.
  2483.  
  2484.      (string <expr>)              MAKE A STRING FROM AN INTEGER ASCII VALUE
  2485.           <expr>    an  integer (which  is first  converted into  its ASCII
  2486.                     character value), string, character, or symbol
  2487.           returns   the string representation of the argument
  2488.  
  2489.      (string-trim <bag> <str>)                   TRIM BOTH ENDS OF A STRING
  2490.           <bag>     a string containing characters to trim
  2491.           <str>     the string to trim
  2492.           returns   a trimed copy of the string
  2493.  
  2494.      (string-left-trim <bag> <str>)           TRIM THE LEFT END OF A STRING
  2495.           <bag>     a string containing characters to trim
  2496.           <str>     the string to trim
  2497.           returns   a trimed copy of the string
  2498.  
  2499.      (string-right-trim <bag> <str>)         TRIM THE RIGHT END OF A STRING
  2500.           <bag>     a string containing characters to trim
  2501.           <str>     the string to trim
  2502.           returns   a trimed copy of the string
  2503.  
  2504.      (string-upcase <str> &key :start :end)            CONVERT TO UPPERCASE
  2505.           <str>     the string
  2506.           :start    the starting offset
  2507.           :end      the ending offset + 1 or NIL for end of string
  2508.           returns   a converted copy of the string
  2509.  
  2510.      (string-downcase <str> &key :start :end)          CONVERT TO LOWERCASE
  2511.           <str>     the string
  2512.           :start    the starting offset
  2513.           :end      the ending offset + 1 or NIL for end of string
  2514.           returns   a converted copy of the string
  2515.  
  2516.      (nstring-upcase <str> &key :start :end)           CONVERT TO UPPERCASE
  2517.           <str>     the string
  2518.           :start    the starting offset
  2519.           :end      the ending offset + 1 or NIL for end of string
  2520.           returns   the converted string (not a copy)
  2521.  
  2522.      (nstring-downcase <str> &key :start :end)         CONVERT TO LOWERCASE
  2523.           <str>     the string
  2524.           :start    the starting offset
  2525.           :end      the ending offset + 1 or NIL for end of string
  2526.           returns   the converted string (not a copy)
  2527.  
  2528.  
  2529.  
  2530.  
  2531.  
  2532.  
  2533.  
  2534.      XLISP 2.1d                 STRING FUNCTIONS                    Page 50
  2535.  
  2536.  
  2537.      (strcat <expr>...)                                 CONCATENATE STRINGS
  2538.           Macro in init.lsp, to maintain compatibility with XLISP.
  2539.           See CONCATENATE for preferred function.
  2540.           <expr>    the strings to concatenate
  2541.           returns   the result of concatenating the strings
  2542.  
  2543.      (string< <str1> <str2> &key :start1 :end1 :start2 :end2)
  2544.      (string<= <str1> <str2> &key :start1 :end1 :start2 :end2)
  2545.      (string= <str1> <str2> &key :start1 :end1 :start2 :end2)
  2546.      (string/= <str1> <str2> &key :start1 :end1 :start2 :end2)
  2547.      (string>= <str1> <str2> &key :start1 :end1 :start2 :end2)
  2548.      (string> <str1> <str2> &key :start1 :end1 :start2 :end2)
  2549.           <str1>    the first string to compare
  2550.           <str2>    the second string to compare
  2551.           :start1   first substring starting offset
  2552.           :end1     first substring ending  offset +  1 or NIL  for end  of
  2553.                     string
  2554.           :start2   second substring starting offset
  2555.           :end2     second  substring ending offset +  1 or NIL  for end of
  2556.                     string
  2557.           returns   string=: t if predicate is true, NIL otherwise
  2558.                     others:  If predicate  is true  then number  of initial
  2559.                     matching characters, else NIL
  2560.           Note: case is significant with these comparison functions.
  2561.  
  2562.      (string-lessp <str1> <str2> &key :start1 :end1 :start2 :end2)
  2563.      (string-not-greaterp <str1> <str2> &key :start1 :end1 :start2 :end2)
  2564.      (string-equal <str1> <str2> &key :start1 :end1 :start2 :end2)
  2565.      (string-not-equal <str1> <str2> &key :start1 :end1 :start2 :end2)
  2566.      (string-not-lessp <str1> <str2> &key :start1 :end1 :start2 :end2)
  2567.      (string-greaterp <str1> <str2> &key :start1 :end1 :start2 :end2)
  2568.           <str1>    the first string to compare
  2569.           <str2>    the second string to compare
  2570.           :start1   first substring starting offset
  2571.           :end1     first substring ending  offset +  1 or NIL  for end  of
  2572.                     string
  2573.           :start2   second substring starting offset
  2574.           :end2     second  substring ending offset +  1 or NIL  for end of
  2575.                     string
  2576.           returns   string-equal: t if predicate is true, NIL otherwise
  2577.                     others:  If predicate  is true  then number  of initial
  2578.                     matching characters, else NIL
  2579.           Note: case is not significant with these comparison functions.
  2580.  
  2581.  
  2582.  
  2583.  
  2584.  
  2585.  
  2586.  
  2587.      XLISP 2.1d                CHARACTER FUNCTIONS                  Page 51
  2588.  
  2589.  
  2590.  
  2591.      CHARACTER FUNCTIONS
  2592.  
  2593.      (char <string> <index>)              EXTRACT A CHARACTER FROM A STRING
  2594.           <string>  the string
  2595.           <index>   the string index (zero relative)
  2596.           returns   the ascii code of the character
  2597.  
  2598.      (upper-case-p <chr>)                  IS THIS AN UPPER CASE CHARACTER?
  2599.           <chr>     the character
  2600.           returns   true if the character is upper case, NIL otherwise
  2601.  
  2602.      (lower-case-p <chr>)                   IS THIS A LOWER CASE CHARACTER?
  2603.           <chr>     the character
  2604.           returns   true if the character is lower case, NIL otherwise
  2605.  
  2606.      (both-case-p <chr>)     IS THIS AN ALPHABETIC (EITHER CASE) CHARACTER?
  2607.           <chr>     the character
  2608.           returns   true if the character is alphabetic, NIL otherwise
  2609.  
  2610.      (digit-char-p <chr>)                        IS THIS A DIGIT CHARACTER?
  2611.           <chr>     the character
  2612.           returns   the digit weight if character is a digit, NIL otherwise
  2613.  
  2614.      (char-code <chr>)                    GET THE ASCII CODE OF A CHARACTER
  2615.           <chr>     the character
  2616.           returns   the ASCII character code (integer, parity bit stripped)
  2617.  
  2618.      (code-char <code>)        GET THE CHARACTER WITH A SPECFIED ASCII CODE
  2619.           <code>    the ASCII code (integer, range 0-127)
  2620.           returns   the character with that code or NIL
  2621.  
  2622.      (char-upcase <chr>)                  CONVERT A CHARACTER TO UPPER CASE
  2623.           <chr>     the character
  2624.           returns   the upper case character
  2625.  
  2626.      (char-downcase <chr>)                CONVERT A CHARACTER TO LOWER CASE
  2627.           <chr>     the character
  2628.           returns   the lower case character
  2629.  
  2630.      (digit-char <n>)                     CONVERT A DIGIT WEIGHT TO A DIGIT
  2631.           <n>       the digit weight (integer)
  2632.           returns   the digit character or NIL
  2633.  
  2634.      (char-int <chr>)                     CONVERT A CHARACTER TO AN INTEGER
  2635.           <chr>     the character
  2636.           returns   the ASCII character code (range 0-255)
  2637.  
  2638.      (int-char <int>)                     CONVERT AN INTEGER TO A CHARACTER
  2639.           <int>     the ASCII character code (treated modulo 256)
  2640.           returns   the character with that code
  2641.  
  2642.  
  2643.  
  2644.  
  2645.  
  2646.  
  2647.  
  2648.      XLISP 2.1d                CHARACTER FUNCTIONS                  Page 52
  2649.  
  2650.  
  2651.      (char< <chr1> <chr2>...)
  2652.      (char<= <chr1> <chr2>...)
  2653.      (char= <chr1> <chr2>...)
  2654.      (char/= <chr1> <chr2>...)
  2655.      (char>= <chr1> <chr2>...)
  2656.      (char> <chr1> <chr2>...)
  2657.           <chr1>    the first character to compare
  2658.           <chr2>    the second character(s) to compare
  2659.           returns   t if predicate is true, NIL otherwise
  2660.           Note: case is significant with these comparison functions.
  2661.  
  2662.      (char-lessp <chr1> <chr2>...)
  2663.      (char-not-greaterp <chr1> <chr2>...)
  2664.      (char-equal <chr1> <chr2>...)
  2665.      (char-not-equal <chr1> <chr2>...)
  2666.      (char-not-lessp <chr1> <chr2>...)
  2667.      (char-greaterp <chr1> <chr2>...)
  2668.           <chr1>    the first string to compare
  2669.           <chr2>    the second string(s) to compare
  2670.           returns   t if predicate is true, NIL otherwise
  2671.           Note: case is not significant with these comparison functions.
  2672.  
  2673.  
  2674.  
  2675.  
  2676.  
  2677.  
  2678.  
  2679.      XLISP 2.1d                STRUCTURE FUNCTIONS                  Page 53
  2680.  
  2681.  
  2682.  
  2683.      STRUCTURE FUNCTIONS
  2684.  
  2685.      XLISP provides  a  subset  of the  Common  Lisp  structure  definition
  2686.      facility.  No slot  options are  allowed, but  slots can  have default
  2687.      initialization expressions.
  2688.  
  2689.           (defstruct name <slot-desc>...)
  2690.      or
  2691.           (defstruct (name <option>...) <slot-desc>...)
  2692.                     fsubr
  2693.                     <name>              the structure name symbol (quoted)
  2694.                     <option>            option description (quoted)
  2695.                     <slot-desc>         slot descriptions (quoted)
  2696.                     returns             the structure name
  2697.  
  2698.      The recognized options are:
  2699.  
  2700.           (:conc-name name)
  2701.           (:include name [<slot-desc>...])
  2702.  
  2703.      Note that if :CONC-NAME appears, it should be before :INCLUDE.
  2704.  
  2705.      Each slot description takes the form:
  2706.  
  2707.           <name>
  2708.      or
  2709.           (<name> <defexpr>)
  2710.  
  2711.      If  the default initialization  expression is not  specified, the slot
  2712.      will be initialized  to NIL if  no keyword argument  is passed to  the
  2713.      creation function.
  2714.  
  2715.      DEFSTRUCT causes access functions to be  created for each of the slots
  2716.      and also arranges that SETF will work with those access functions. The
  2717.      access function  names are constructed  by taking the  structure name,
  2718.      appending  a  '-'  and then  appending  the  slot  name. This  can  be
  2719.      overridden by using the :CONC-NAME option.
  2720.  
  2721.      DEFSTRUCT also  makes a creation function  called MAKE-<structname>, a
  2722.      copy function called COPY-<structname> and a predicate function called
  2723.      <structname>-P. The creation function takes keyword arguments for each
  2724.      of  the slots. Structures can be created  using the #S( read macro, as
  2725.      well.
  2726.  
  2727.      The  property *struct-slots*  is added  to the  symbol that  names the
  2728.      structure. This property consists of an association list of slot names
  2729.      and  closures that evaluate to  the initial values  (NIL if no initial
  2730.      value expression).
  2731.  
  2732.  
  2733.  
  2734.  
  2735.  
  2736.  
  2737.  
  2738.      XLISP 2.1d                STRUCTURE FUNCTIONS                  Page 54
  2739.  
  2740.  
  2741.      For instance:
  2742.  
  2743.           (defstruct foo bar (gag 2))
  2744.  
  2745.      creates the following functions:
  2746.  
  2747.           (foo-bar <expr>)
  2748.           (setf (foo-bar <expr>) <value>)
  2749.           (foo-gag <expr>)
  2750.           (setf (foo-gag <expr>) <value>)
  2751.           (make-foo &key :bar :gag)
  2752.           (copy-foo <expr>)
  2753.           (foo-p <expr>)
  2754.  
  2755.  
  2756.  
  2757.  
  2758.  
  2759.  
  2760.  
  2761.      XLISP 2.1d                 OBJECT FUNCTIONS                    Page 55
  2762.  
  2763.  
  2764.  
  2765.      OBJECT FUNCTIONS
  2766.  
  2767.      Note that the  functions provided  in classes.lsp are  useful but  not
  2768.      necessary.
  2769.  
  2770.      Messages defined for Object and Class are listed starting on page 19.
  2771.  
  2772.      (send <object> <message> [<args>...])                   SEND A MESSAGE
  2773.           <object>  the object to receive the message
  2774.           <message> message sent to object
  2775.           <args>    arguments to method (if any)
  2776.           returns   the result of the method
  2777.  
  2778.      (send-super <message> [<args>])           SEND A MESSAGE TO SUPERCLASS
  2779.           valid only in method context
  2780.           <message> message sent to method's superclass
  2781.           <args>    arguments to method (if any)
  2782.           returns   the result of the method
  2783.  
  2784.      (defclass <sym> <ivars> [<cvars> [<super>]])        DEFINE A NEW CLASS
  2785.           defined in class.lsp as a macro
  2786.           <sym>     symbol whose value is  to be bound to the  class object
  2787.                     (quoted)
  2788.           <ivars>   list of instance variables (quoted). Instance variables
  2789.                     specified  either  as  <ivar>  or  (<ivar>  <init>)  to
  2790.                     specify non-NIL default initial value.
  2791.           <cvars>   list of class variables (quoted)
  2792.           <super>   superclass, or Object if absent.
  2793.           This function  sends :SET-PNAME  (defined in classes.lsp)  to the
  2794.           new class to set the class' print name instance variable.
  2795.           Methods defined for classes defined with defclass:
  2796.           (send <object> :<ivar>)
  2797.                     Returns the specified instance variable
  2798.           (send <object> :SET-IVAR <ivar> <value>)
  2799.                     Used to set an instance variable, typically with setf.
  2800.           (send <sym> :NEW {:<ivar> <init>})
  2801.                     Actually  definition  for  :ISNEW. Creates  new  object
  2802.                     initializing instance variables as specified in keyword
  2803.                     arguments, or  to their default if  keyword argument is
  2804.                     missing. Returns the object.
  2805.  
  2806.      (defmethod <class> <sym> <fargs> <expr> ...)       DEFINE A NEW METHOD
  2807.           defined in class.lsp as a macro
  2808.           <class>   Class which will respond to message
  2809.           <sym>     Message name (quoted)
  2810.           <fargs>   Formal  argument   list.  Leading  "self"   is  implied
  2811.                     (quoted)
  2812.           <expr>    Expressions constituting body of method (quoted)
  2813.           returns   the class object.
  2814.  
  2815.  
  2816.  
  2817.  
  2818.  
  2819.  
  2820.  
  2821.      XLISP 2.1d                 OBJECT FUNCTIONS                    Page 56
  2822.  
  2823.  
  2824.      (definst <class> <sym> [<args>...])       DEFINE A NEW GLOBAL INSTANCE
  2825.           defined in class.lsp as a macro
  2826.           <class>   Class of new object
  2827.           <sym>     Symbol whose value will be set to new object
  2828.           <args>    Arguments passed to :NEW  (typically initial values for
  2829.                     instance variables)
  2830.  
  2831.  
  2832.  
  2833.  
  2834.  
  2835.  
  2836.  
  2837.      XLISP 2.1d                PREDICATE FUNCTIONS                  Page 57
  2838.  
  2839.  
  2840.  
  2841.      PREDICATE FUNCTIONS
  2842.  
  2843.      (atom <expr>)                                         IS THIS AN ATOM?
  2844.           <expr>    the expression to check
  2845.           returns   t if the value is an atom, NIL otherwise
  2846.  
  2847.      (symbolp <expr>)                                     IS THIS A SYMBOL?
  2848.           <expr>    the expression to check
  2849.           returns   t if the expression is a symbol, NIL otherwise
  2850.  
  2851.      (numberp <expr>)                                     IS THIS A NUMBER?
  2852.           <expr>    the expression to check
  2853.           returns   t if the expression is a number, NIL otherwise
  2854.  
  2855.      (null <expr>)                                   IS THIS AN EMPTY LIST?
  2856.           <expr>    the list to check
  2857.           returns   t if the list is empty, NIL otherwise
  2858.  
  2859.      (not <expr>)                                            IS THIS FALSE?
  2860.           <expr>    the expression to check
  2861.           return    t if the value is NIL, NIL otherwise
  2862.  
  2863.      (listp <expr>)                                         IS THIS A LIST?
  2864.           <expr>    the expression to check
  2865.           returns   t if the value is a cons or NIL, NIL otherwise
  2866.  
  2867.      (endp <list>)                               IS THIS THE END OF A LIST?
  2868.           <list>    the list
  2869.           returns   t if the value is NIL, NIL otherwise
  2870.  
  2871.      (consp <expr>)                               IS THIS A NON-EMPTY LIST?
  2872.           <expr>    the expression to check
  2873.           returns   t if the value is a cons, NIL otherwise
  2874.  
  2875.      (constantp <expr>)                                 IS THIS A CONSTANT?
  2876.           <expr>    the expression to check
  2877.           returns   t if  the value is  a constant  (basically, would  EVAL
  2878.                     <expr>   repeatedly  return   the  same   thing?),  NIL
  2879.                     otherwise.
  2880.  
  2881.      (integerp <expr>)                                  IS THIS AN INTEGER?
  2882.           <expr>    the expression to check
  2883.           returns   t if the value is an integer, NIL otherwise
  2884.  
  2885.      (floatp <expr>)                                       IS THIS A FLOAT?
  2886.           <expr>    the expression to check
  2887.           returns   t if the value is a float, NIL otherwise
  2888.  
  2889.  
  2890.  
  2891.  
  2892.  
  2893.  
  2894.  
  2895.      XLISP 2.1d                PREDICATE FUNCTIONS                  Page 58
  2896.  
  2897.  
  2898.      (rationalp <expr>)                          IS THIS A RATIONAL NUMBER?
  2899.           Part of math extension.
  2900.           <expr>    the expression to check
  2901.           returns   t  if the  value is  rational (integer  or  ratio), NIL
  2902.                     otherwise
  2903.  
  2904.      (complexp <expr>)                            IS THIS A COMPLEX NUMBER?
  2905.           Part of math extension.
  2906.           <expr>    the expression to check
  2907.           returns   t if the value is a complex number, NIL otherwise
  2908.  
  2909.      (stringp <expr>)                                     IS THIS A STRING?
  2910.           <expr>    the expression to check
  2911.           returns   t if the value is a string, NIL otherwise
  2912.  
  2913.      (characterp <expr>)                               IS THIS A CHARACTER?
  2914.           <expr>    the expression to check
  2915.           returns   t if the value is a character, NIL otherwise
  2916.  
  2917.      (arrayp <expr>)                                      IS THIS AN ARRAY?
  2918.           <expr>    the expression to check
  2919.           returns   t if the value is an array, NIL otherwise
  2920.  
  2921.      (streamp <expr>)                                     IS THIS A STREAM?
  2922.           <expr>    the expression to check
  2923.           returns   t if the value is a stream, NIL otherwise
  2924.  
  2925.      (open-stream-p <stream>)                               IS STREAM OPEN?
  2926.           <stream>  the stream
  2927.           returns   t if the stream is open, NIL otherwise
  2928.  
  2929.      (input-stream-p <stream>)                          IS STREAM READABLE?
  2930.           <stream>  the stream
  2931.           returns   t if stream is readable, NIL otherwise
  2932.  
  2933.      (output-stream-p <stream>)                         IS STREAM WRITABLE?
  2934.           <stream>  the stream
  2935.           returns   t if stream is writable, NIL otherwise
  2936.  
  2937.      (objectp <expr>)                                    IS THIS AN OBJECT?
  2938.           <expr>    the expression to check
  2939.           returns   t if the value is an object, NIL otherwise
  2940.  
  2941.      (classp <expr>)                                IS THIS A CLASS OBJECT?
  2942.           <expr>    the expression to check
  2943.           returns   t if the value is a class object, NIL otherwise
  2944.  
  2945.      (boundp <sym>)                        IS A VALUE BOUND TO THIS SYMBOL?
  2946.           <sym>     the symbol
  2947.           returns   t if a value is bound to the symbol, NIL otherwise
  2948.  
  2949.  
  2950.  
  2951.  
  2952.  
  2953.  
  2954.  
  2955.      XLISP 2.1d                PREDICATE FUNCTIONS                  Page 59
  2956.  
  2957.  
  2958.      (fboundp <sym>)            IS A FUNCTIONAL VALUE BOUND TO THIS SYMBOL?
  2959.           <sym>     the symbol
  2960.           returns   t if a  functional value  is bound to  the symbol,  NIL
  2961.                     otherwise
  2962.  
  2963.      (functionp <sym>)                                  IS THIS A FUNCTION?
  2964.           Defined in common.lsp
  2965.           <expr>    the expression to check
  2966.           returns   t if  the value is  a function  -- that is,  can it  be
  2967.                     applied to arguments. This is true for any symbol (even
  2968.                     those with  no function  binding), list with  car being
  2969.                     lambda, a closure, or subr. Otherwise returns NIL.
  2970.  
  2971.      (minusp <expr>)                               IS THIS NUMBER NEGATIVE?
  2972.           <expr>    the number to test
  2973.           returns   t if the number is negative, NIL otherwise
  2974.  
  2975.      (zerop <expr>)                                    IS THIS NUMBER ZERO?
  2976.           <expr>    the number to test
  2977.           returns   t if the number is zero, NIL otherwise
  2978.  
  2979.      (plusp <expr>)                                IS THIS NUMBER POSITIVE?
  2980.           <expr>    the number to test
  2981.           returns   t if the number is positive, NIL otherwise
  2982.  
  2983.      (evenp <expr>)                                   IS THIS INTEGER EVEN?
  2984.           <expr>    the integer to test
  2985.           returns   t if the integer is even, NIL otherwise
  2986.  
  2987.      (oddp <expr>)                                     IS THIS INTEGER ODD?
  2988.           <expr>    the integer to test
  2989.           returns   t if the integer is odd, NIL otherwise
  2990.  
  2991.      (subsetp <list1> <list2> &key :test :test-not :key)   IS SET A SUBSET?
  2992.           <list1>   the first list
  2993.           <list2>   the second list
  2994.           :test     test function (defaults to eql)
  2995.           :test-not test function (sense inverted)
  2996.           :key      function to apply to test function  arguments (defaults
  2997.                     to identity)
  2998.           returns   t  if every element of the  first list is in the second
  2999.                     list, NIL otherwise
  3000.  
  3001.  
  3002.  
  3003.  
  3004.  
  3005.  
  3006.  
  3007.      XLISP 2.1d                PREDICATE FUNCTIONS                  Page 60
  3008.  
  3009.  
  3010.      (eq <expr1> <expr2>)                        ARE THE EXPRESSIONS EQUAL?
  3011.      (eql <expr1> <expr2>)
  3012.      (equal <expr1> <expr2>)
  3013.      (equalp <expr1> <expr2>)
  3014.           equalp defined in common.lsp
  3015.           <expr1>   the first expression
  3016.           <expr2>   the second expression
  3017.           returns   t if  equal, NIL otherwise. Each  is progressively more
  3018.                     liberal in what is "equal":
  3019.                     eq:   identical  pointers  --  works  with  characters,
  3020.                               symbols, and arbitrarily small integers
  3021.                     eql: works with all  numbers, if same type (see  also =
  3022.                     on page 47)
  3023.                     equal: lists and strings
  3024.                     equalp:  case  insensitive  characters  (and  strings),
  3025.                               numbers of differing types, arrays (which can
  3026.                               be equalp to string containing same elements)
  3027.  
  3028.      (typep <expr> <type>)                        IS THIS A SPECIFIED TYPE?
  3029.           <expr>    the expression to test
  3030.           <type>    the  type specifier. Symbols can either be one of those
  3031.                     listed under type-of (on page 82) or one of:
  3032.                     ATOM      any atom
  3033.                     NULL      NIL
  3034.                     LIST      matches NIL or any cons cell
  3035.                     STREAM    any stream
  3036.                     NUMBER    any number type
  3037.                     RATIONAL  fixnum or ratio (math extension)
  3038.                     STRUCT    any structure (except hash-table)
  3039.                     FUNCTION  any  function, as defined  by functionp (page
  3040.                               59)
  3041.                     The  specifer can also be a form (which can be nested).
  3042.                     All form elements are quoted. Valid form cars:
  3043.                     or        any of the cdr type specifiers must be true
  3044.                     and       all of the cdr type specifiers must be true
  3045.                     not       the single cdr type specifier must be false
  3046.                     satisfies the  result of  applying  the  cdr  predicate
  3047.                               function to <expr>
  3048.                     member    <expr> must be eql to one of the cdr values
  3049.                     object    <expr> must be an  object, of class specified
  3050.                               by the single cdr value. The cdr value can be
  3051.                               a symbol which must evaluate to a class.
  3052.                     Note  that everything is of  type T, and  nothing is of
  3053.                     type NIL.
  3054.           returns   t if <expr> is of type <type>, NIL otherwise.
  3055.  
  3056.  
  3057.  
  3058.  
  3059.  
  3060.  
  3061.  
  3062.      XLISP 2.1d                CONTROL CONSTRUCTS                   Page 61
  3063.  
  3064.  
  3065.  
  3066.      CONTROL CONSTRUCTS
  3067.  
  3068.      (cond <pair>...)                                EVALUATE CONDITIONALLY
  3069.           fsubr
  3070.           <pair>    pair consisting of:
  3071.                     (<pred> <expr>...)
  3072.                     where
  3073.                     <pred>    is a predicate expression
  3074.                     <expr>    evaluated if the predicate is not NIL
  3075.           returns   the value  of the  first expression whose  predicate is
  3076.                     not NIL
  3077.  
  3078.      (and <expr>...)               THE LOGICAL AND OF A LIST OF EXPRESSIONS
  3079.           fsubr
  3080.           <expr>    the expressions to be ANDed
  3081.           returns   NIL if  any expression evaluates to  NIL, otherwise the
  3082.                     value of the last expression (evaluation of expressions
  3083.                     stops after the first expression that evaluates to NIL)
  3084.  
  3085.      (or <expr>...)                 THE LOGICAL OR OF A LIST OF EXPRESSIONS
  3086.           fsubr
  3087.           <expr>    the expressions to be ORed
  3088.           returns   NIL if  all expressions evaluate to  NIL, otherwise the
  3089.                     value  of the first  non-NIL expression  (evaluation of
  3090.                     expressions stops after the  first expression that does
  3091.                     not evaluate to NIL)
  3092.  
  3093.      (if <texpr> <expr1> [<expr2>])      EVALUATE EXPRESSIONS CONDITIONALLY
  3094.           fsubr
  3095.           <texpr>   the test expression
  3096.           <expr1>   the expression to be evaluated if texpr is non-NIL
  3097.           <expr2>   the expression to be evaluated if texpr is NIL
  3098.           returns   the value of the selected expression
  3099.  
  3100.      (when <texpr> <expr>...)        EVALUATE ONLY WHEN A CONDITION IS TRUE
  3101.           fsubr
  3102.           <texpr>   the test expression
  3103.           <expr>    the expression(s) to be evaluted if texpr is non-NIL
  3104.           returns   the value of the last expression or NIL
  3105.  
  3106.      (unless <texpr> <expr>...)     EVALUATE ONLY WHEN A CONDITION IS FALSE
  3107.           fsubr
  3108.           <texpr>   the test expression
  3109.           <expr>    the expression(s) to be evaluated if texpr is NIL
  3110.           returns   the value of the last expression or NIL
  3111.  
  3112.  
  3113.  
  3114.  
  3115.  
  3116.  
  3117.  
  3118.      XLISP 2.1d                CONTROL CONSTRUCTS                   Page 62
  3119.  
  3120.  
  3121.      (case <expr> <case>...[(t <expr>)])                     SELECT BY CASE
  3122.           fsubr
  3123.           <expr>    the selection expression
  3124.           <case>    pair consisting of:
  3125.                     (<value> <expr>...)
  3126.                     where:
  3127.                     <value>   is  a   single  expression   or  a   list  of
  3128.                               expressions (unevaluated)
  3129.                     <expr>    are  expressions  to  execute  if   the  case
  3130.                               matches
  3131.           (t <expr>)          default case (no previous matching)
  3132.           returns   the value of the last expression of the matching case
  3133.  
  3134.      (let (<binding>...) <expr>...)                   CREATE LOCAL BINDINGS
  3135.      (let* (<binding>...) <expr>...)            LET WITH SEQUENTIAL BINDING
  3136.           fsubr
  3137.           <binding> the variable bindings each of which is either:
  3138.                     1)        a symbol (which is initialized to NIL)
  3139.                     2)        a list whose car  is a symbol and  whose cadr
  3140.                               is an initialization expression
  3141.           <expr>    the expressions to be evaluated
  3142.           returns   the value of the last expression
  3143.  
  3144.      (flet (<binding>...) <expr>...)                 CREATE LOCAL FUNCTIONS
  3145.      (labels (<binding>...) <expr>...)        FLET WITH RECURSIVE FUNCTIONS
  3146.      (macrolet (<binding>...) <expr>...)                CREATE LOCAL MACROS
  3147.           fsubr
  3148.           <binding> the function bindings each of which is:
  3149.                     (<sym> <fargs> <expr>...)
  3150.                     where:
  3151.                     <sym>     the function/macro name
  3152.                     <fargs>   formal argument list (lambda list)
  3153.                     <expr>    expressions  constituting  the  body  of  the
  3154.                               function/macro
  3155.           <expr>    the expressions to be evaluated
  3156.           returns   the value of the last expression
  3157.  
  3158.      (catch <sym> <expr>...)          EVALUATE EXPRESSIONS AND CATCH THROWS
  3159.           fsubr
  3160.           <sym>     the catch tag
  3161.           <expr>    expressions to evaluate
  3162.           returns   the value of the last expression the throw expression
  3163.  
  3164.      (throw <sym> [<expr>])                                THROW TO A CATCH
  3165.           fsubr
  3166.           <sym>     the catch tag
  3167.           <expr>    the value for the catch to return (defaults to NIL)
  3168.           returns   never returns
  3169.  
  3170.  
  3171.  
  3172.  
  3173.  
  3174.  
  3175.  
  3176.      XLISP 2.1d                CONTROL CONSTRUCTS                   Page 63
  3177.  
  3178.  
  3179.      (unwind-protect <expr> <cexpr>...)  PROTECT EVALUATION OF AN EXPRESSION
  3180.           fsubr
  3181.           <expr>    the expression to protect
  3182.           <cexpr>   the cleanup expressions
  3183.           returns   the value of the expression
  3184.           Note:     unwind-protect  guarantees  to   execute  the   cleanup
  3185.           expressions even if a non-local exit terminates the evaluation of
  3186.           the protected expression
  3187.  
  3188.  
  3189.  
  3190.  
  3191.  
  3192.  
  3193.  
  3194.      XLISP 2.1d                LOOPING CONSTRUCTS                   Page 64
  3195.  
  3196.  
  3197.  
  3198.      LOOPING CONSTRUCTS
  3199.  
  3200.      (loop <expr>...)                                    BASIC LOOPING FORM
  3201.           fsubr
  3202.           <expr>    the body of the loop
  3203.           returns   never returns (must use non-local exit, such as RETURN)
  3204.  
  3205.      (do (<binding>...) (<texpr> <rexpr>...) <expr>...)GENERAL LOOPING FORM
  3206.      (do* (<binding>...) (<texpr> <rexpr>...) <expr>...)
  3207.           fsubr. do binds simultaneously, do* binds sequentially
  3208.           <binding> the variable bindings each of which is either:
  3209.                     1)        a symbol (which is initialized to NIL)
  3210.                     2)        a list of the form: (<sym> <init> [<step>])
  3211.                     where:
  3212.                               <sym>     is the symbol to bind
  3213.                               <init>    the initial value of the symbol
  3214.                               <step>    a step expression
  3215.           <texpr>   the termination test expression
  3216.           <rexpr>   result expressions (the default is NIL)
  3217.           <expr>    the body of the loop (treated like an implicit prog)
  3218.           returns   the value of the last result expression
  3219.  
  3220.      (dolist (<sym> <expr> [<rexpr>]) <expr>...)        LOOP THROUGH A LIST
  3221.           fsubr
  3222.           <sym>     the symbol to bind to each list element
  3223.           <expr>    the list expression
  3224.           <rexpr>   the result expression (the default is NIL)
  3225.           <expr>    the body of the loop (treated like an implicit prog)
  3226.           returns   the result expression
  3227.  
  3228.      (dotimes (<sym> <expr> [<rexpr>]) <expr>...)     LOOP FROM ZERO TO N-1
  3229.           fsubr
  3230.           <sym>     the symbol to bind to each value from 0 to n-1
  3231.           <expr>    the number of times to loop
  3232.           <rexpr>   the result expression (the default is NIL)
  3233.           <expr>    the body of the loop (treated like an implicit prog)
  3234.           returns   the result expression
  3235.  
  3236.  
  3237.  
  3238.  
  3239.  
  3240.  
  3241.  
  3242.      XLISP 2.1d                THE PROGRAM FEATURE                  Page 65
  3243.  
  3244.  
  3245.  
  3246.      THE PROGRAM FEATURE
  3247.  
  3248.      (prog (<binding>...) <expr>...)                    THE PROGRAM FEATURE
  3249.      (prog* (<binding>...) <expr>...)          PROG WITH SEQUENTIAL BINDING
  3250.           fsubr -- equivalent to (let () (block NIL (tagbody ...)))
  3251.           <binding> the variable bindings each of which is either:
  3252.                     1)        a symbol (which is initialized to NIL)
  3253.                     2)        a list whose  car is a symbol  and whose cadr
  3254.                               is an initialization expression
  3255.           <expr>    expressions to evaluate or tags (symbols)
  3256.           returns   NIL or the argument passed to the return function
  3257.  
  3258.      (block <name> <expr>...)                                   NAMED BLOCK
  3259.           fsubr
  3260.           <name>    the block name (quoted symbol)
  3261.           <expr>    the block body
  3262.           returns   the value of the last expression
  3263.  
  3264.      (return [<expr>])             CAUSE A PROG CONSTRUCT TO RETURN A VALUE
  3265.           fsubr
  3266.           <expr>    the value (defaults to NIL)
  3267.           returns   never returns
  3268.  
  3269.      (return-from <name> [<value>])   RETURN FROM A NAMED BLOCK OR FUNCTION
  3270.           fsubr. In xlisp, the names are dynamically scoped.
  3271.           <name>    the block or function name  (quoted symbol). If name is
  3272.                     NIL, use function RETURN.
  3273.           <value>   the value to return (defaults to NIL)
  3274.           returns   never returns
  3275.  
  3276.      (tagbody <expr>...)                                  BLOCK WITH LABELS
  3277.           fsubr
  3278.           <expr>    expression(s) to evaluate or tags (symbols)
  3279.           returns   NIL
  3280.  
  3281.      (go <sym>)                                GO TO A TAG WITHIN A TAGBODY
  3282.           fsubr. In xlisp, tags are dynamically scoped.
  3283.           <sym>     the tag (quoted)
  3284.           returns   never returns
  3285.  
  3286.      (progv <slist> <vlist> <expr>...)             DYNAMICALLY BIND SYMBOLS
  3287.           fsubr
  3288.           <slist>   list of symbols (evaluated)
  3289.           <vlist>   list of values to bind to the symbols (evaluated)
  3290.           <expr>    expression(s) to evaluate
  3291.           returns   the value of the last expression
  3292.  
  3293.  
  3294.  
  3295.  
  3296.  
  3297.  
  3298.  
  3299.      XLISP 2.1d                THE PROGRAM FEATURE                  Page 66
  3300.  
  3301.  
  3302.      (prog1 <expr1> <expr>...)             EXECUTE EXPRESSIONS SEQUENTIALLY
  3303.           fsubr
  3304.           <expr1>   the first expression to evaluate
  3305.           <expr>    the remaining expressions to evaluate
  3306.           returns   the value of the first expression
  3307.  
  3308.      (prog2 <expr1> <expr2> <expr>...)     EXECUTE EXPRESSIONS SEQUENTIALLY
  3309.           fsubr
  3310.           <expr1>   the first expression to evaluate
  3311.           <expr2>   the second expression to evaluate
  3312.           <expr>    the remaining expressions to evaluate
  3313.           returns   the value of the second expression
  3314.  
  3315.      (progn <expr>...)                     EXECUTE EXPRESSIONS SEQUENTIALLY
  3316.           fsubr
  3317.           <expr>    the expressions to evaluate
  3318.           returns   the value of the last expression (or NIL)
  3319.  
  3320.  
  3321.  
  3322.  
  3323.  
  3324.  
  3325.  
  3326.      XLISP 2.1d              INPUT/OUTPUT FUNCTIONS                 Page 67
  3327.  
  3328.  
  3329.  
  3330.      INPUT/OUTPUT FUNCTIONS
  3331.  
  3332.      Note  that when printing objects,  printing is accomplished by sending
  3333.      the message :prin1 to the object.
  3334.  
  3335.      (read [<stream> [<eof> [<rflag>]]])                 READ AN EXPRESSION
  3336.           <stream>  the input stream (default, or NIL, is *standard-input*,
  3337.                     T is *terminal-io*)
  3338.           <eof>     the value to return on end of file (default is NIL)
  3339.           <rflag>   recursive read flag. The value is ignored
  3340.           returns   the expression read
  3341.  
  3342.      (set-macro-character <ch> <fcn> [ T ])               MODIFY READ TABLE
  3343.           defined in init.lsp
  3344.           <ch>      character to define
  3345.           <fcn>     function to bind to character (see page 12)
  3346.           T         if TMACRO rather than NMACRO
  3347.  
  3348.      (get-macro-character <ch>)                          EXAMINE READ TABLE
  3349.           defined in init.lsp
  3350.           <ch>      character
  3351.           returns   function bound to character
  3352.  
  3353.      (print <expr> [<stream>])            PRINT AN EXPRESSION ON A NEW LINE
  3354.           The  expression is  printed  using prin1,  then  current line  is
  3355.           terminated (Note: this is backwards from Common Lisp).
  3356.           <expr>    the expression to be printed
  3357.           <stream>  the    output    stream    (default,   or    NIL,    is
  3358.                     *standard-output*, T is *terminal-io*)
  3359.           returns   the expression
  3360.  
  3361.      (prin1 <expr> [<stream>])                          PRINT AN EXPRESSION
  3362.           symbols,  cons  cells (without  circularities),  arrays, strings,
  3363.           numbers,  and  characters  are  printed  in  a  format  generally
  3364.           acceptable to the read function.  Printing format can be affected
  3365.           by   the   global   formatting   variables:   *print-level*   and
  3366.           *print-length*  for   lists  and  arrays,   *integer-format*  for
  3367.           fixnums,  *float-format* for flonums,  *ratio-format* for ratios,
  3368.           and *print-case* and *readtable-case* for symbols.
  3369.           <expr>    the expression to be printed
  3370.           <stream>  the    output    stream    (default,    or    NIL,   is
  3371.                     *standard-output*, T is *terminal-io*)
  3372.           returns   the expression
  3373.  
  3374.  
  3375.  
  3376.  
  3377.  
  3378.  
  3379.  
  3380.      XLISP 2.1d              INPUT/OUTPUT FUNCTIONS                 Page 68
  3381.  
  3382.  
  3383.      (princ <expr> [<stream>])          PRINT AN EXPRESSION WITHOUT QUOTING
  3384.           Like PRIN1 except  symbols (including  uninterned), strings,  and
  3385.           characters are printed without using any quoting mechanisms.
  3386.           <expr>    the expressions to be printed
  3387.           <stream>  the    output    stream    (default,   or    NIL,    is
  3388.                     *standard-output*, T is *terminal-io*)
  3389.           returns   the expression
  3390.  
  3391.      (pprint <expr> [<stream>])                  PRETTY PRINT AN EXPRESSION
  3392.           Uses prin1 for printing.
  3393.           <expr>    the expressions to be printed
  3394.           <stream>  the    output    stream    (default,    or    NIL,   is
  3395.                     *standard-output*, T is *terminal-io*)
  3396.           returns   the expression
  3397.  
  3398.      (terpri [<stream>])                   TERMINATE THE CURRENT PRINT LINE
  3399.           <stream>  the    output    stream    (default,   or    NIL,    is
  3400.                     *standard-output*, T is *terminal-io*)
  3401.           returns   NIL
  3402.  
  3403.      (fresh-line [<stream>])                               START A NEW LINE
  3404.           <stream>  the    output   stream    (default,    or    NIL,    is
  3405.                     *standard-output*, T is *terminal-io*)
  3406.           returns   t  if a new  list was  started, NIL  if already  at the
  3407.                     start of a line.
  3408.  
  3409.      (flatsize <expr>)         LENGTH OF PRINTED REPRESENTATION USING PRIN1
  3410.           <expr>    the expression
  3411.           returns   the length
  3412.  
  3413.      (flatc <expr>)            LENGTH OF PRINTED REPRESENTATION USING PRINC
  3414.           <expr>    the expression
  3415.           returns   the length
  3416.  
  3417.      (y-or-n-p [<fmt> [<arg>...]])                 ASK A YES OR NO QUESTION
  3418.           defined in common.lsp. Uses *terminal-io* stream for interaction.
  3419.           <fmt>     optional format string for question (see page 69)
  3420.           <arg>     arguments, if any, for format string
  3421.           returns   T for yes, NIL for no.
  3422.  
  3423.  
  3424.  
  3425.  
  3426.  
  3427.  
  3428.  
  3429.      XLISP 2.1d                THE FORMAT FUNCTION                  Page 69
  3430.  
  3431.  
  3432.  
  3433.      THE FORMAT FUNCTION
  3434.  
  3435.      (format <stream> <fmt> [<arg>...])                 DO FORMATTED OUTPUT
  3436.           <stream>  the output stream (T is *standard-output*)
  3437.           <fmt>     the format string
  3438.           <arg>     the format arguments
  3439.           returns   output string if <stream> is NIL, NIL otherwise
  3440.  
  3441.      The  format  string  can  contain  characters that  should  be  copied
  3442.      directly  to  the output  and  formatting  directives. The  formatting
  3443.      directives are:
  3444.  
  3445.           ~A or ~a  print next argument using princ
  3446.           ~S or ~s  print next argument using prin1
  3447.           ~D or ~d  print next argument integer
  3448.           ~E or ~e  print next argument in exponential form
  3449.           ~F or ~f  print next argument in fixed point form
  3450.           ~G or ~g  print next argument using either ~E  or ~F depending on
  3451.           magnitude
  3452.           ~%        start a new line
  3453.           ~&        start a new line if not on a new line
  3454.           ~t or ~T  go to a specified column
  3455.           ~~        print a tilde character
  3456.           ~\n       ignore return and following whitespace
  3457.  
  3458.      The format directives  can contain optional prefix  and optional colon
  3459.      (:)  or  at-sign  (@)  modifiers  between   the  tilde  and  directive
  3460.      character. Prefix  characters are unsigned integers,  or the character
  3461.      'v'  to indicate  the number  is taken  from the  next argument,  or a
  3462.      single quote (') followed  by a single character for  those parameters
  3463.      that should be a single character.
  3464.  
  3465.      For ~A and ~S the full form is:
  3466.  
  3467.           ~mincol,colinc,minpad,padchar:@A        (or S)
  3468.  
  3469.      If : is given, NIL will print as "()" rather than "NIL". The string is
  3470.      padded  on the right (or  left, if @ is given)  with at least "minpad"
  3471.      copies of the "padchar". Padding characters are then inserted "colinc"
  3472.      characters at a  time until the total width is  at least "mincol". The
  3473.      defaults are  0 for mincol and  minpad, 1 for colinc,  and #\space for
  3474.      padchar. For example:
  3475.  
  3476.           ~15,,2,'.@A
  3477.  
  3478.      The output is padded  on the left  with at least  2 periods until  the
  3479.      output is at least 15 characters wide.
  3480.  
  3481.  
  3482.  
  3483.  
  3484.  
  3485.  
  3486.  
  3487.      XLISP 2.1d                THE FORMAT FUNCTION                  Page 70
  3488.  
  3489.  
  3490.      For ~D the full form is:
  3491.  
  3492.           ~mincol,padchar@D
  3493.  
  3494.      If the argument  is not a FIXNUM, then the  format "~mincolA" is used.
  3495.      If "mincol"  is specified then the number is  padded on the left to be
  3496.      at least that many characters long using "padchar". "padchar" defaults
  3497.      to #\space. If @  is used and  the value is  positive, then a  leading
  3498.      plus sign is printed before the first digit.
  3499.  
  3500.      For ~E ~F and ~G the full form is:
  3501.  
  3502.           ~mincol,round,padchar@E                 (or F or G)
  3503.  
  3504.      (This implementation is not Common  Lisp compatible.) If the  argument
  3505.      is not  a real  number (FIXNUM,  RATIO, or  FLONUM),  then the  format
  3506.      "~mincol,padcharD" is used. The number is printed using the C language
  3507.      e, f, or g formats. If the number could potentially take more than 100
  3508.      digits to print, then F  format is forced to E format, although some C
  3509.      libraries will  do this  at a  lower number of  digits. If  "round" is
  3510.      specified,  than that  is the  number of  digits to  the right  of the
  3511.      decimal  point that will be printed, otherwise six digits (or whatever
  3512.      is necessary  in G format) are  printed. In G format,  trailing zeroes
  3513.      are  deleted and exponential  notation is used if  the exponent of the
  3514.      number  is  greater than  the  precision or  less  than -4.  If  the @
  3515.      modifier  is  used, a  leading plus  sign  is printed  before positive
  3516.      values. If  "mincol" is specified, the number is padded on the left to
  3517.      be  at  least  "mincol"  characters long  using  "padchar".  "padchar"
  3518.      defaults to #\space.
  3519.  
  3520.      For ~% and ~~, the  full form is ~n% or ~n~. "n" copies (default=1) of
  3521.      the character are output.
  3522.  
  3523.      For  ~&, the full form is ~n&.  ~0& does nothing. Otherwise enough new
  3524.      line  characters  are  emited  to move  down  to  the  "n"th  new line
  3525.      (default=1).
  3526.  
  3527.      For ~T, the full form is:
  3528.  
  3529.           ~count,tabwidth@T
  3530.  
  3531.      The cursor  is moved to column  "count" (default 1). If  the cursor is
  3532.      initially at count or beyond, then the cursor is moved  forward to the
  3533.      next position that  is a  multiple of "tabwidth"  (default 1)  columns
  3534.      beyond  count.  When  the @  modifier  is  used,  then positioning  is
  3535.      relative.  "count"  spaces are  printed,  then  additional spaces  are
  3536.      printed to make  the column number  be a multiple of  "tabwidth". Note
  3537.      that column calcuations will  be incorrect if ASCII tab  characters or
  3538.      ANSI cursor positioning sequences are used.
  3539.  
  3540.  
  3541.  
  3542.  
  3543.  
  3544.  
  3545.  
  3546.      XLISP 2.1d                THE FORMAT FUNCTION                  Page 71
  3547.  
  3548.  
  3549.      For  ~\n, if the colon modifier is  used, then the format directive is
  3550.      ignored  (allowing  embedded  returns   in  the  source  for  enhanced
  3551.      readability).  If the at-sign modifier is used, then a carriage return
  3552.      is emitted, and following whitespace is ignored. 
  3553.  
  3554.  
  3555.  
  3556.  
  3557.  
  3558.  
  3559.  
  3560.      XLISP 2.1d                FILE I/O FUNCTIONS                   Page 72
  3561.  
  3562.  
  3563.  
  3564.      FILE I/O FUNCTIONS
  3565.  
  3566.      Note that initially,  when starting XLISP-PLUS,  there are six  system
  3567.      stream symbols which are  associated with three streams. *TERMINAL-IO*
  3568.      is  a special stream  that is bound  to the keyboard  and display, and
  3569.      allows for interactive editing.  *STANDARD-INPUT* is bound to standard
  3570.      input  or to  *TERMINAL-IO*  if not  redirected. *STANDARD-OUTPUT*  is
  3571.      bound  to  standard output  or  to  *TERMINAL-IO* if  not  redirected.
  3572.      *ERROR-OUTPUT* (error message output),  *TRACE-OUTPUT* (for TRACE  and
  3573.      TIME functions), and *DEBUG-IO* (break loop i/o, and messages) are all
  3574.      bound to *TERMINAL-IO*. Standard input and output can be redirected on
  3575.      most systems.
  3576.  
  3577.      File streams  are printed using the  #< format that cannot  be read by
  3578.      the  reader.  Console, standard  input,  standard  output, and  closed
  3579.      streams are  explicitly indicated.  Other file streams  will typically
  3580.      indicate the name of the attached file.
  3581.  
  3582.      When the  transcript is active (either  -t on the command  line or the
  3583.      DRIBBLE  function), all characters that  would be sent  to the display
  3584.      via *TERMINAL-IO* are also placed in the transcript file.
  3585.  
  3586.      *TERMINAL-IO* should not be changed. Any other system streams that are
  3587.      changed by an application should be restored to their original values.
  3588.  
  3589.      (read-char [<stream>])                  READ A CHARACTER FROM A STREAM
  3590.           <stream>  the input stream (default, or NIL, is *standard-input*,
  3591.                     T is *terminal-io*)
  3592.           returns   the character or NIL at end of file
  3593.  
  3594.      (peek-char [<flag> [<stream>]])             PEEK AT THE NEXT CHARACTER
  3595.           <flag>    flag for skipping white space (default is NIL)
  3596.           <stream>  the input stream (default, or NIL, is *standard-input*,
  3597.                     T is *terminal-io*)
  3598.           returns   the character or NIL at end of file
  3599.  
  3600.      (write-char <ch> [<stream>])             WRITE A CHARACTER TO A STREAM
  3601.           <ch>      the character to write
  3602.           <stream>  the    output   stream    (default,    or    NIL,    is
  3603.                     *standard-output*, T is *terminal-io*)
  3604.           returns   the character
  3605.  
  3606.      (read-line [<stream>])                       READ A LINE FROM A STREAM
  3607.           <stream>  the input stream (default, or NIL, is *standard-input*,
  3608.                     T is *terminal-io*)
  3609.           returns   the string  excluding the #\newline,  or NIL at  end of
  3610.                     file
  3611.  
  3612.  
  3613.  
  3614.  
  3615.  
  3616.  
  3617.  
  3618.      XLISP 2.1d                FILE I/O FUNCTIONS                   Page 73
  3619.  
  3620.  
  3621.      (open    <fname>    &key    :direction     :element-type    :if-exists
  3622.      :if-does-not-exist)
  3623.                                                          OPEN A FILE STREAM
  3624.           The function  OPEN has been significantly  enhanced over original
  3625.           XLISP.  The original  function  only had  the :direction  keyword
  3626.           argument,  which could only  have the  values :input  or :output.
  3627.           When  used with the :output  keyword, it was  equivalent to (open
  3628.           <fname> :direction :output  :if-exists :supersede). A  maximum of
  3629.           ten files can be open  at any one time, including any  files open
  3630.           via  the  LOAD,  DRIBBLE, SAVE  and  RESTORE  commands. The  open
  3631.           command may force a garbage collection to reclaim file slots used
  3632.           by unbound file streams.
  3633.  
  3634.           <fname>        the  file  name  string, symbol,  or  file  stream
  3635.                          created  via OPEN. In  the last case,  the name is
  3636.                          used to open a  second stream on the same  file --
  3637.                          this can  cause problems if one or more streams is
  3638.                          used for writing.
  3639.           :direction     Read and  write permission for stream  (default is
  3640.                          :input).
  3641.             :input       Open file for read operations only.
  3642.             :probe       Open file for  reading, then close it (use to test
  3643.                          for file existance)
  3644.             :output      Open file for write operations only.
  3645.             :io          Like :output, but reading also allowed.
  3646.           :element-type  FIXNUM  or CHARACTER  (default  is CHARACTER),  as
  3647.                          returned by  type-of function (on  page 82). Files
  3648.                          opened with  type FIXNUM are binary  files instead
  3649.                          of   ascii,  which   means  no  crlf   to/from  lf
  3650.                          conversion takes  place,  and control-Z  will  not
  3651.                          terminate  an  input file.  It  is  the intent  of
  3652.                          Common Lisp  that  binary files  only be  accessed
  3653.                          with read-byte and write-byte while ascii files be
  3654.                          accessed  with  any  function  but  read-byte  and
  3655.                          write-byte.   XLISP   does   not    enforce   that
  3656.                          distinction.
  3657.           :if-exists     action to take  if file  exists. Argument  ignored
  3658.                          for :input (file is positioned at start) or :probe
  3659.                          (file is closed)
  3660.             :error       give error message
  3661.             :rename      rename file to generated  backup name, then open a
  3662.                          new file of the original name. This is the default
  3663.                          action
  3664.             :new-version same as :rename
  3665.             :overwrite   file is positioned to start, original data intact
  3666.             :append      file is positioned to end
  3667.             :supersede   delete original file and open new file of the same
  3668.                          name
  3669.             :rename-and-delete  same as :supersede
  3670.             NIL          close file and return NIL
  3671.           :if-does-not-exist    action to take if file does not exist.
  3672.  
  3673.  
  3674.  
  3675.  
  3676.  
  3677.  
  3678.  
  3679.      XLISP 2.1d                FILE I/O FUNCTIONS                   Page 74
  3680.  
  3681.  
  3682.             :error       give  error  message   (default  for  :input,   or
  3683.                          :overwrite or :append)
  3684.             :create      create a new file (default for :output or :io when
  3685.                          not :overwrite or :append)
  3686.             NIL          return NIL (default for :probe)
  3687.           returns        a file stream, or sometimes NIL
  3688.  
  3689.      (close <stream>)                                   CLOSE A FILE STREAM
  3690.           The  stream becomes  a "closed  stream." Note  that unbound  file
  3691.           streams are closed automatically during a garbage collection.
  3692.           <stream>  the stream, which may be a string stream
  3693.           returns   t  if stream closed, NIL if terminal (cannot be closed)
  3694.                     or already closed.
  3695.  
  3696.      (delete-file <fname>)                                    DELETE A FILE
  3697.           <fname>   file name string, symbol or a stream opened with OPEN
  3698.           returns   t if file does not exist or is deleted. If <fname> is a
  3699.                     stream,  the  stream  is  closed  before  the  file  is
  3700.                     deleted. An error occurs if the file cannot be deleted.
  3701.  
  3702.      (truename <fname>)                           OBTAIN THE FILE PATH NAME
  3703.           <fname>   file name string, symbol, or a stream opened with OPEN
  3704.           returns   string representing the  true file name (absolute  path
  3705.           to file).
  3706.  
  3707.      (with-open-file (<var> <fname> [<karg>...]) [<expr>...])
  3708.                                                       EVALUATE USING A FILE
  3709.           Defined in common.lsp as a macro. File will always be closed upon
  3710.           completion
  3711.           <var>     symbol  name  to   bind  stream  to  while   evaluating
  3712.                     expresssions (quoted)
  3713.           <fname>   file name string or symbol
  3714.           <karg>    keyword arguments for the implicit open command
  3715.           <expr>    expressions to  evaluate while file  is open  (implicit
  3716.                     progn)
  3717.           returns   value of last <expr>.
  3718.  
  3719.      (read-byte [<stream>])                       READ A BYTE FROM A STREAM
  3720.           <stream>  the input stream (default, or NIL, is *standard-input*,
  3721.                     T is *terminal-io*)
  3722.           returns   the byte (integer) or NIL at end of file
  3723.  
  3724.      (write-byte <byte> [<stream>])                WRITE A BYTE TO A STREAM
  3725.           <byte>    the byte to write (integer)
  3726.           <stream>  the    output    stream    (default,    or    NIL,   is
  3727.                     *standard-output*, T is *terminal-io*)
  3728.           returns   the byte (integer)
  3729.  
  3730.  
  3731.  
  3732.  
  3733.  
  3734.  
  3735.  
  3736.      XLISP 2.1d                FILE I/O FUNCTIONS                   Page 75
  3737.  
  3738.  
  3739.      (file-length <stream>)                              GET LENGTH OF FILE
  3740.           For  an ascii file,  the length reported  may be  larger than the
  3741.           number of characters read or written because of CR conversion.
  3742.           <stream>  the file stream (should be disk file)
  3743.           returns   length of file, or NIL if cannot be determined.
  3744.  
  3745.      (file-position <stream> [<expr>])             GET OR SET FILE POSITION
  3746.           For an ascii file, the  file position may not be the same  as the
  3747.           number of characters read or written because of CR conversion. It
  3748.           will be  correct when using file-position to position a file at a
  3749.           location earlier reported by file-position.
  3750.           <stream>  the file stream (should be a disk file)
  3751.           <expr>    desired file position, if setting position. Can also be
  3752.                     :start for start of file or :end for end of file.
  3753.           returns   if setting position, and successful, then T; if getting
  3754.                     position  and successful  then the  position; otherwise
  3755.                     NIL
  3756.  
  3757.  
  3758.  
  3759.  
  3760.  
  3761.  
  3762.  
  3763.      XLISP 2.1d              STRING STREAM FUNCTIONS                Page 76
  3764.  
  3765.  
  3766.  
  3767.      STRING STREAM FUNCTIONS
  3768.  
  3769.      These  functions operate on unnamed  streams. An unnamed output stream
  3770.      collects characters sent  to it when it is used  as the destination of
  3771.      any output function. The functions 'get-output-stream' string and list
  3772.      return a sting or list of the characters.
  3773.  
  3774.      An unnamed  input stream is setup  with the 'make-string-input-stream'
  3775.      function  and returns each character of the  string when it is used as
  3776.      the source of any input function.
  3777.  
  3778.      Note  that there  is no  difference between  unnamed input  and output
  3779.      streams.  Unnamed input streams may be written to by output functions,
  3780.      in  which case  the characters  are appended  to the  tail end  of the
  3781.      stream. Unnamed output streams may also be (destructively) read by any
  3782.      input function as well as the get-output-stream functions.
  3783.  
  3784.      (make-string-input-stream <str> [<start> [<end>]])
  3785.           <str>     the string
  3786.           <start>   the starting offset
  3787.           <end>     the ending offset + 1 or NIL for end of string
  3788.           returns   an unnamed stream that reads from the string
  3789.  
  3790.      (make-string-output-stream)
  3791.           returns   an unnamed output stream
  3792.  
  3793.      (get-output-stream-string <stream>)
  3794.           The output stream is emptied by this function
  3795.           <stream>  the output stream
  3796.           returns   the output so far as a string
  3797.  
  3798.      (get-output-stream-list <stream>)
  3799.           The output stream is emptied by this function
  3800.           <stream>  the output stream
  3801.           returns   the output so far as a list
  3802.  
  3803.      (with-input-from-string   (<var>  <str>   &key  :start   :end  :index)
  3804.      [<expr>...])
  3805.           Defined in common.lsp as a macro
  3806.           <var>     symbol  that stream  is  bound to  during execution  of
  3807.                     expressions (quoted)
  3808.           <str>     the string
  3809.           :start    starting offset into string (default 0)
  3810.           :end      ending offset + 1  (default, or NIL, is end of string)
  3811.           :index    setf  place form  which  gets final  index into  string
  3812.                     after last expression is executed (quoted)
  3813.           <expr>    expressions to evaluate (implicit progn)
  3814.           returns   the value of the last <expr>
  3815.  
  3816.  
  3817.  
  3818.  
  3819.  
  3820.  
  3821.  
  3822.      XLISP 2.1d              STRING STREAM FUNCTIONS                Page 77
  3823.  
  3824.  
  3825.      (with-output-to-string (<var>) [<expr>...])
  3826.           Defined in common.lsp as a macro
  3827.           <var>     symbol  that stream  is  bound to  during execution  of
  3828.                     expressions (quoted)
  3829.           <expr>    expressions to evaluate (implicit progn)
  3830.           returns   contents of stream, as a string
  3831.  
  3832.  
  3833.  
  3834.  
  3835.  
  3836.  
  3837.  
  3838.      XLISP 2.1d           DEBUGGING AND ERROR HANDLING              Page 78
  3839.  
  3840.  
  3841.  
  3842.      DEBUGGING AND ERROR HANDLING FUNCTIONS
  3843.  
  3844.      (trace [<sym>...])                    ADD A FUNCTION TO THE TRACE LIST
  3845.           fsubr
  3846.           <sym>     the function(s) to add (quoted)
  3847.           returns   the trace list
  3848.  
  3849.      (untrace [<sym>...])             REMOVE A FUNCTION FROM THE TRACE LIST
  3850.           fsubr.  If no functions given, all functions are removed from the
  3851.           trace list.
  3852.           <sym>     the function(s) to remove (quoted)
  3853.           returns   the trace list
  3854.  
  3855.      (error <emsg> [<arg>])                  SIGNAL A NON-CORRECTABLE ERROR
  3856.           <emsg>    the error message string
  3857.           <arg>     the argument expression (printed after the message)
  3858.           returns   never returns
  3859.  
  3860.      (cerror <cmsg> <emsg> [<arg>])              SIGNAL A CORRECTABLE ERROR
  3861.           <cmsg>    the continue message string
  3862.           <emsg>    the error message string
  3863.           <arg>     the argument expression (printed after the message)
  3864.           returns   NIL when continued from the break loop
  3865.  
  3866.      (break [<bmsg> [<arg>]])                            ENTER A BREAK LOOP
  3867.           <bmsg>    the break message string (defaults to "**BREAK**")
  3868.           <arg>     the argument expression (printed after the message)
  3869.           returns   NIL when continued from the break loop
  3870.  
  3871.      (clean-up)                                     CLEAN-UP AFTER AN ERROR
  3872.           returns   never returns
  3873.  
  3874.      (top-level)        CLEAN-UP AFTER AN ERROR AND RETURN TO THE TOP LEVEL
  3875.           returns   never returns
  3876.  
  3877.      (continue)                           CONTINUE FROM A CORRECTABLE ERROR
  3878.           returns   never returns
  3879.  
  3880.      (errset <expr> [<pflag>])                                  TRAP ERRORS
  3881.           fsubr
  3882.           <expr>    the expression to execute
  3883.           <pflag>   flag to control printing  of the error message (default
  3884.                     t)
  3885.           returns   the value of the last expression consed with NIL or NIL
  3886.                     on error
  3887.  
  3888.      (baktrace [<n>])              PRINT N LEVELS OF TRACE BACK INFORMATION
  3889.           <n>       the number of levels (defaults to all levels)
  3890.           returns   NIL
  3891.  
  3892.  
  3893.  
  3894.  
  3895.  
  3896.  
  3897.  
  3898.      XLISP 2.1d           DEBUGGING AND ERROR HANDLING              Page 79
  3899.  
  3900.  
  3901.      (evalhook <expr> <ehook> <ahook> [<env>])          EVALUATE WITH HOOKS
  3902.           <expr>    the expression to evaluate. <ehook> is not used  at the
  3903.                     top level.
  3904.           <ehook>   the value for *evalhook*
  3905.           <ahook>   the value for *applyhook*
  3906.           <env>     the  environment  (default is  NIL).  The  format is  a
  3907.                     dotted pair  of value (car) and  function (cdr) binding
  3908.                     lists.  Each binding  list is  a list of  level binding
  3909.                     a-lists,  with  the innermost  a-list first.  The level
  3910.                     binding  a-list associates  the bound  symbol  with its
  3911.                     value.
  3912.           returns   the result of evaluating the expression
  3913.  
  3914.      (applyhook <fun> <arglist> <ehook> <ahook>)           APPLY WITH HOOKS
  3915.           <fun>     The  function closure.  <ahook>  is not  used for  this
  3916.                     function application.
  3917.           <arglist> The list of arguments.
  3918.           <ehook>   the value for *evalhook*
  3919.           <ahook>   the value for *applyhook*
  3920.           returns   the result of applying <fun> to <arglist>
  3921.  
  3922.      (debug)                                            ENABLE DEBUG BREAKS
  3923.      (nodebug)                                         DISABLE DEBUG BREAKS
  3924.           Defined in init.lsp
  3925.  
  3926.  
  3927.  
  3928.  
  3929.  
  3930.  
  3931.  
  3932.      XLISP 2.1d                 SYSTEM FUNCTIONS                    Page 80
  3933.  
  3934.  
  3935.  
  3936.      SYSTEM FUNCTIONS
  3937.  
  3938.      (load <fname> &key :verbose :print)                 LOAD A SOURCE FILE
  3939.           An  implicit  ERRSET exists  in this  function  so that  if error
  3940.           occurs during loading, and *breakenable*  is NIL, then the  error
  3941.           message  will be  printed  and  NIL  will  be  returned.  The  OS
  3942.           environmental  variable XLPATH is used as a search path for files
  3943.           in  this  function.  If  the   filename  does  not  contain  path
  3944.           separators ('/' for UNIX, and  either '/' or '\' for  MS-DOS) and
  3945.           XLPATH is defined, then  each pathname in XLPATH is tried in turn
  3946.           until  a matching file  is found. If  no file is  found, then one
  3947.           last  attempt is made in the current directory. The pathnames are
  3948.           separated by either  a space  or semicolon, and  a trailing  path
  3949.           separator character is optional.
  3950.           <fname>   the filename  string, symbol, or a  file stream created
  3951.                     with OPEN. The extension "lsp" is assumed.
  3952.           :verbose  the verbose flag (default is t)
  3953.           :print    the print flag (default is NIL)
  3954.           returns   t if successful, else NIL
  3955.  
  3956.      (restore <fname>)                        RESTORE WORKSPACE FROM A FILE
  3957.           The OS environmental variable XLPATH is used as a search path for
  3958.           files in  this  function. See  the  note under  function  "load",
  3959.           above. The  standard system streams are restored  to the defaults
  3960.           as  of when XLISP-PLUS was started. Files streams are restored in
  3961.           the  same mode they were created, if possible, and are positioned
  3962.           where  they were at the time of the  save. If the files have been
  3963.           altered or moved since the time of the save, the restore will not
  3964.           be  completely successful. Memory allocation will not be the same
  3965.           as  the current settings of ALLOC are used. Execution proceeds at
  3966.           the top-level  read-eval-print loop. The state  of the transcript
  3967.           logging is not affected by this function.
  3968.           <fname>   the filename  string, symbol, or a  file stream created
  3969.                     with OPEN. The extension "wks" is assumed.
  3970.           returns   NIL on failure, otherwise never returns
  3971.  
  3972.      (save <fname>)                                SAVE WORKSPACE TO A FILE
  3973.           You cannot save from  within a load. Not all of the  state may be
  3974.           saved -- see  "restore", above.  By saving a  workspace with  the
  3975.           name "xlisp",  that workspace  will be loaded  automatically when
  3976.           you invoke XLISP-PLUS.
  3977.           <fname>   the filename  string, symbol, or a  file stream created
  3978.                     with OPEN. The extension "wks" is assumed.
  3979.           returns   t if workspace was written, NIL otherwise
  3980.  
  3981.      (savefun <fcn>)                                SAVE FUNCTION TO A FILE
  3982.           defined in init.lsp
  3983.           <fcn>     function  name (saves  it to  file of  same  name, with
  3984.                     extension ".lsp")
  3985.           returns   t if successful
  3986.  
  3987.  
  3988.  
  3989.  
  3990.  
  3991.  
  3992.  
  3993.      XLISP 2.1d                 SYSTEM FUNCTIONS                    Page 81
  3994.  
  3995.  
  3996.      (dribble [<fname>])       CREATE A FILE WITH A TRANSCRIPT OF A SESSION
  3997.           <fname>   file name  string, symbol, or file  stream created with
  3998.                     OPEN
  3999.                     (if missing, close current transcript)
  4000.           returns   t if the transcript is opened, NIL if it is closed
  4001.  
  4002.      (gc)                                          FORCE GARBAGE COLLECTION
  4003.           returns   NIL
  4004.  
  4005.      (expand [<num>])                      EXPAND MEMORY BY ADDING SEGMENTS
  4006.           <num>     the number of segments to add, default 1
  4007.           returns   the number of segments added
  4008.  
  4009.      (alloc <num> [<num2>])                             CHANGE SEGMENT SIZE
  4010.           <num>     the number of nodes to allocate
  4011.           <num2>    the number of pointer elements to allocate in an  array
  4012.                     segment  (when  dynamic  array   allocation  compiled).
  4013.                     Default is no change.
  4014.           returns   the old number of nodes to allocate
  4015.  
  4016.      (room)                               SHOW MEMORY ALLOCATION STATISTICS
  4017.           Statistics (which are sent to *STANDARD-OUTPUT*) include:
  4018.            Nodes - number of nodes, free and used
  4019.            Free nodes - number of free nodes
  4020.            Segments - number of node segments, including those reserved for
  4021.                     characters and small integers.
  4022.            Allocate - number of nodes to allocate in any new node segments
  4023.            Total - total memory bytes allocated  for node segments, arrays,
  4024.                     and strings
  4025.            Collections - number of garbage collections
  4026.           When  dynamic  array  allocation   is  compiled,  the   following
  4027.           additional statistics are printed:
  4028.            Vector  nodes  -  number  of   pointers  in  arrays  and   (size
  4029.           equivalent) strings
  4030.            Vector segs - number of vector segments. Increases and decreases
  4031.           as needed.
  4032.            Vec allocate - number of pointer elements to allocate in any new
  4033.                     vector segment
  4034.           returns   NIL
  4035.  
  4036.      (time <expr>)                                   MEASURE EXECUTION TIME
  4037.           fsubr.
  4038.           <expr>    the expression to evaluate
  4039.           returns   the  result of  the expression.  The execution  time is
  4040.                     printed to *TRACE-OUTPUT*
  4041.  
  4042.      (get-internal-real-time)                        GET ELAPSED CLOCK TIME
  4043.      (get-internal-run-time)                     GET ELAPSED EXECUTION TIME
  4044.           returns   integer     time     in      system     units      (see
  4045.                     internal-time-units-per-second on page 22).  meaning of
  4046.                     absolute values is system dependent.
  4047.  
  4048.  
  4049.  
  4050.  
  4051.  
  4052.  
  4053.  
  4054.      XLISP 2.1d                 SYSTEM FUNCTIONS                    Page 82
  4055.  
  4056.  
  4057.      (coerce <expr> <type>)             FORCE EXPRESSION TO DESIGNATED TYPE
  4058.           Sequences can  be coerced into other  sequences, single character
  4059.           strings  or  symbols  with  single character  printnames  can  be
  4060.           coerced into  characters, fixnums can be  coerced into characters
  4061.           or  flonums. Ratios  can  be coerced  into  flonums. Flonums  and
  4062.           ratios can be coerced into complex (so can fixnums, but they turn
  4063.           back into fixnums).
  4064.           <expr>    the expression to coerce
  4065.           <type>    desired type, as returned by type-of (see page 82)
  4066.           returns   <expr> if type is correct, or converted object.
  4067.  
  4068.      (type-of <expr>)                    RETURNS THE TYPE OF THE EXPRESSION
  4069.           It is  recommended  that typep  be used  instead, as  it is  more
  4070.           general.  In the original XLISP,  the value NIL  was returned for
  4071.           NIL.
  4072.           <expr>    the expression to return the type of
  4073.           returns   One of the symbols:
  4074.                     LIST                for NIL (lists, conses return CONS)
  4075.                     SYMBOL              for symbols
  4076.                     OBJECT              for objects
  4077.                     CONS                for conses
  4078.                     SUBR                for built-in functions
  4079.                     FSUBR               for special forms
  4080.                     CLOSURE             for defined functions
  4081.                     STRING              for strings
  4082.                     FIXNUM              for integers
  4083.                     RATIO               for ratios
  4084.                     FLONUM              for floating point numbers
  4085.                     COMPLEX             for complex numbers
  4086.                     CHARACTER           for characters
  4087.                     FILE-STREAM         for file pointers
  4088.                     UNNAMED-STREAM      for unnamed streams
  4089.                     ARRAY               for arrays
  4090.                     HASH-TABLE          for hash tables
  4091.                     sym                 for structures of type "sym"
  4092.  
  4093.      (peek <addrs>)                            PEEK AT A LOCATION IN MEMORY
  4094.           <addrs>   the address to peek at (integer)
  4095.           returns   the value at the specified address (integer)
  4096.  
  4097.      (poke <addrs> <value>)                        POKE A VALUE INTO MEMORY
  4098.           <addrs>   the address to poke (integer)
  4099.           <value>   the value to poke into the address (integer)
  4100.           returns   the value
  4101.  
  4102.      (address-of <expr>)                   GET THE ADDRESS OF AN XLISP NODE
  4103.           <expr>    the node
  4104.           returns   the address of the node (integer)
  4105.  
  4106.  
  4107.  
  4108.  
  4109.  
  4110.  
  4111.  
  4112.      XLISP 2.1d                 SYSTEM FUNCTIONS                    Page 83
  4113.  
  4114.  
  4115.      (get-key)                                READ A KEYSTROKE FROM CONSOLE
  4116.           OS dependent.
  4117.           returns   integer value of key (no echo)
  4118.  
  4119.      (system <command>)                            EXECUTE A SYSTEM COMMAND
  4120.           OS dependent -- not always available.
  4121.           <command> Command string, if 0 length then spawn OS shell
  4122.           returns   T  if successful  (note that MS/DOS  command.com always
  4123.                     returns success)
  4124.  
  4125.      (exit)                                                      EXIT XLISP
  4126.           returns   never returns
  4127.  
  4128.      (generic <expr>)         CREATE A GENERIC TYPED COPY OF THE EXPRESSION
  4129.           Note: added function, Tom Almy's creation for debugging xlisp.
  4130.           <expr>    the expression to copy
  4131.           returns   NIL if  value is  NIL and NILSYMBOL  compilation option
  4132.                     not declared, otherwise if type is:
  4133.                     SYMBOL              copy as an ARRAY
  4134.                     OBJECT              copy as an ARRAY
  4135.                     CONS                (CONS (CAR <expr>)(CDR <expr>))
  4136.                     CLOSURE             copy as an ARRAY
  4137.                     STRING              copy of the string
  4138.                     FIXNUM              value
  4139.                     FLONUM              value
  4140.                     RATIO               value
  4141.                     CHARACTER           value
  4142.                     UNNAMED-STREAM      copy as a CONS
  4143.                     ARRAY               copy of the array
  4144.                     COMPLEX             copy as an ARRAY
  4145.                     HASH-TABLE          copy as an ARRAY
  4146.                     structure           copy as an ARRAY
  4147.  
  4148.  
  4149.      The following  graphic and display functions represent an extension by
  4150.      Tom Almy:
  4151.  
  4152.      (cls)                                                    CLEAR DISPLAY
  4153.           Clear the display and position cursor at upper left corner.
  4154.           returns   nil
  4155.  
  4156.      (cleol)                                           CLEAR TO END OF LINE
  4157.           Clears current line to end.
  4158.           returns   nil
  4159.  
  4160.      (goto-xy [<column> <row>])                  GET OR SET CURSOR POSITION
  4161.           Cursor  is  repositioned  if optional  arguments  are  specified.
  4162.           Coordinates are clipped to actual size of display.
  4163.           <column>  0-based column (x coordinate)
  4164.           <row>     0-based row (y coordinate)
  4165.           returns   list of original column and row positions
  4166.  
  4167.  
  4168.  
  4169.  
  4170.  
  4171.  
  4172.  
  4173.      XLISP 2.1d                 SYSTEM FUNCTIONS                    Page 84
  4174.  
  4175.  
  4176.      (color <value>)                                      SET DRAWING COLOR
  4177.           <value>   Drawing color (not checked for validity)
  4178.           returns   <value>
  4179.  
  4180.      (move <x1> <y1> [<x2> <y2> ...])                         ABSOLUTE MOVE
  4181.      (moverel <x1> <y2> [<x2> <y2> ...])                      RELATIVE MOVE
  4182.           For  moverel,  all coordinates  are  relative  to the  preceeding
  4183.           point.
  4184.           <x1> <y1> Moves to point x1,y1 in anticipation of draw.
  4185.           <x2> <y2> Draws to points specified in additional arguments.
  4186.           returns   T if succeeds, else NIL
  4187.  
  4188.      (draw [<x1> <y1> ...])                                   ABSOLUTE DRAW
  4189.      (drawrel [<x1> <y1> ...])                                RELATIVE DRAW
  4190.           For  drawrel,  all coordinates  are  relative  to the  preceeding
  4191.           point.
  4192.           <x1> <y1> Point(s) drawn to, in order.
  4193.           returns   T if succeeds, else NIL
  4194.  
  4195.      (mode <ax> [<bx> <width> <height>)                    SET DISPLAY MODE
  4196.           Standard  modes require  only <ax>  argument. Extended  modes are
  4197.           "Super-VGA" or "Super-EGA" and are display card specific. Not all
  4198.           XLISP versions support all modes.
  4199.           <ax>      Graphic mode (value passed in register AX)
  4200.                     Common standard Modes:
  4201.                     0,1 - 40x25 text
  4202.                     2,3 - 80x25 text
  4203.                     4,5 - 320x200 4 color graphics (CGA)
  4204.                     6 - 640x200 monchrome graphics (CGA)
  4205.                     13 - 320x200 16 color graphics (EGA)
  4206.                     14 - 640x200 16 color graphics (EGA)
  4207.                     16 - 640x350 16 color graphics (EGA)
  4208.                     18 - 640x480 16 color graphics (VGA)
  4209.                     19 - 320x200 256 color graphics (VGA)
  4210.           <bx>      BX value for some extended graphic modes
  4211.           <width>   width for extended graphic modes
  4212.           <height>  height for extended graphic modes
  4213.           returns   T, or NIL if fails
  4214.  
  4215.  
  4216.  
  4217.  
  4218.  
  4219.  
  4220.  
  4221.      XLISP 2.1d               ADDITIONAL FUNCTIONS                  Page 85
  4222.  
  4223.  
  4224.  
  4225.      ADDITIONAL FUNCTIONS AND UTILITIES
  4226.  
  4227.      STEP.LSP
  4228.  
  4229.      This file contains a simple Lisp  single-step debugger. It  started as
  4230.      an  implementation of  the "hook"  example in  chapter 20  of Steele's
  4231.      "Common Lisp". This version was brought up on Xlisp 1.7 for the Amiga,
  4232.      and then on VAXLISP.
  4233.  
  4234.      To invoke: (step (whatever-form with args))
  4235.  
  4236.      For  each list  (interpreted function  call), the  stepper  prints the
  4237.      environment  and the list, then enters a read-eval-print loop. At this
  4238.      point the available commands are:
  4239.  
  4240.      (a list)<CR>   evaluate the list in the current environment, print the
  4241.                     result, and repeat.
  4242.      <CR>           step into the called function
  4243.      anything_else<CR>        step over the called function.
  4244.  
  4245.      If the stepper comes to  a form that is not a list it  prints the form
  4246.      and the value, and continues on without stopping.
  4247.  
  4248.      Note that stepper  commands are executed  in the current  environment.
  4249.      Since  this is the case,  the stepper commands  can change the current
  4250.      environment. For example,  a SETF will change  an environment variable
  4251.      and thus can alter the course of execution.
  4252.  
  4253.      Global variables - newline, *hooklevel*
  4254.  
  4255.      Functions/macros   -   while   step   eval-hool-function   step-spaces
  4256.      step-flush
  4257.  
  4258.      Note     an  even more  powerful  stepper  package  is in  stepper.lsp
  4259.      (documented in stepper.doc).
  4260.  
  4261.  
  4262.  
  4263.  
  4264.  
  4265.  
  4266.  
  4267.      XLISP 2.1d               ADDITIONAL FUNCTIONS                  Page 86
  4268.  
  4269.  
  4270.      PP.LSP
  4271.  
  4272.      In addition to  the pretty-printer  itself, this file  contains a  few
  4273.      functions that illustrate some simple but useful applications.
  4274.  
  4275.      (pp <object> [<stream>])                       PRETTY PRINT EXPRESSION
  4276.      (pp-def <funct> [<stream>])                PRETTY PRINT FUNCTION/MACRO
  4277.      (pp-file <file> [<stream>])                          PRETTY PRINT FILE
  4278.           <object>  The expression to print
  4279.           <funct>   Function to print (as DEFUN or DEFMACRO)
  4280.           <file>    File  to  print (specify  either  as  string or  quoted
  4281.                     symbol)
  4282.           <stream>  Output stream (default is *standard-output*)
  4283.           returns   T
  4284.  
  4285.      Global   variables:   tabsize    maxsize   miser-size    min-miser-car
  4286.      max-normal-car
  4287.  
  4288.      Functions/Macros: sym-function  pp-file pp-def make-def pp  pp1 moveto
  4289.      spaces pp-rest-across pp-rest  printmacrop pp-binding-form  pp-do-form
  4290.      pp-defining-form pp-pair-form
  4291.  
  4292.      See the source file for more information.
  4293.  
  4294.  
  4295.  
  4296.  
  4297.  
  4298.  
  4299.  
  4300.      XLISP 2.1d               ADDITIONAL FUNCTIONS                  Page 87
  4301.  
  4302.  
  4303.      REPAIR.LSP
  4304.  
  4305.      This file contains a structure editor.
  4306.      Execute
  4307.           (repair 'symbol) to edit a symbol.
  4308.           (repairf symbol) to edit the function binding of a symbol (allows
  4309.                     changing the argument list  or function type, lambda or
  4310.                     macro).
  4311.  
  4312.      The  editor alters the current  selection by copying  so that aborting
  4313.      all  changes is  generally posible;  the exception  is when  editing a
  4314.      closure, if the closure is BACKed out of, the change is permanent.
  4315.  
  4316.      For all  commands taking a numeric argument,  the first element of the
  4317.      selection is the 0th (as in NTH function).
  4318.  
  4319.      Any array elements become lists when  they are selected, and return to
  4320.      arrays upon RETURN or BACK commands.
  4321.  
  4322.      Do not create new closures, because the environment will be incorrect.
  4323.      Closures become LAMBDA or MACRO expressions as the selection. Only the
  4324.      closure  body may be changed; the argument list cannot be successfully
  4325.      modified, nor can the environment.
  4326.  
  4327.      For class objects, only the methods and message names can be modified.
  4328.      For  instance objects,  instance  variables can  be  examined (if  the
  4329.      object under-stands the message :<ivar>  for the particular ivar), and
  4330.      changed  (if  :SET-IVAR  is  defined  for that  class,  as  it  is  if
  4331.      CLASSES.LSP is used).
  4332.  
  4333.      (command list on next page)
  4334.  
  4335.  
  4336.  
  4337.  
  4338.  
  4339.  
  4340.  
  4341.      XLISP 2.1d               ADDITIONAL FUNCTIONS                  Page 88
  4342.  
  4343.  
  4344.      COMMANDS (general):
  4345.           ?         list available commands for the selection.
  4346.           RETURN    exit, saving all changes.
  4347.           ABORT     exit, without changes.
  4348.           BACK      go back one level (as before CAR CDR or N commands).
  4349.           B n       go back n levels.
  4350.           L         display selection using pprint; if selection is symbol,
  4351.                     give short description.
  4352.           MAP       pprints each  element of selection, or  if selection is
  4353.                     symbol then gives complete description of properties.
  4354.           PLEV x    set   *print-level*   to   x.   (Initial   default   is
  4355.                     *rep-print-level*)
  4356.           PLEN x    set   *print-length   to   x.   (Initial   default   is
  4357.                     *rep-print-length*)
  4358.           EVAL x    evaluates x and prints result. The symbol @ is bound to
  4359.                     the selection.
  4360.           REPLACE x replaces the  current selection  with evaluated x.  The
  4361.                     symbol @ is bound to the selection.
  4362.      COMMANDS (if selection is symbol):
  4363.           VALUE     edit the value binding.
  4364.           FUNCTION  edit the function binding (must be a closure).
  4365.           PROP x    edit property x.
  4366.      COMMANDS (if selection is list):
  4367.           CAR       select the CAR of the current selection.
  4368.           CDR       select the CDR of the current selection.
  4369.           n         where n is small  non-negative integer, changes current
  4370.                     selection to (NTH n list).
  4371.           SUBST x y all occurances of (quoted) y are replaced with (quoted)
  4372.                     x. EQUAL is used for the comparison.
  4373.           RAISE n   removes   parenthesis   surrounding   nth  element   of
  4374.                     selection.
  4375.           LOWER n m inserts parenthesis starting with the nth  element, for
  4376.                     m elements.
  4377.           ARRAY n m as in LOWER, but makes elements into an array.
  4378.           I n x     inserts (quoted) x before nth element in selection.
  4379.           R n x     replaces nth element in selection with (quoted) x.
  4380.           D n       deletes nth element in selection.
  4381.  
  4382.      All function names and  global variables start with the  string "rep-"
  4383.      or "*rep-*".
  4384.  
  4385.  
  4386.  
  4387.  
  4388.  
  4389.  
  4390.  
  4391.      XLISP 2.1d             BUG FIXES AND EXTENSIONS                Page 89
  4392.  
  4393.  
  4394.  
  4395.      BUG FIXES AND EXTENSIONS
  4396.  
  4397.  
  4398.      In  this section,  CL  means "Common  Lisp  compatible to  the  extent
  4399.      possible".  CX means "now works  with complex numbers".  CR means "now
  4400.      works with ratios".  * means "implemented  in LISP  rather than C".  #
  4401.      means "implementation moved from LISP to C".
  4402.  
  4403.                                     Bug Fixes
  4404.  
  4405.      RESTORE  did not  work --  several bugs  for 80x86  systems. Only  one
  4406.      restore would work per session -- all systems.
  4407.  
  4408.      :downcase for variable *printcase* did not work with some compilers.
  4409.  
  4410.      Modifications to make the source acceptable to ANSI C compilers.
  4411.  
  4412.      Values  for ADEPTH  and EDEPTH  changed to  more reasonable  values --
  4413.      before this change the processor stack would overflow first, causing a
  4414.      crash.
  4415.  
  4416.      On systems with 16 bit integers: STRCAT crashes when aggregate size of
  4417.      argument  strings  were  greater   than  32k.  MAKE-ARRAY  crashes  on
  4418.      too-large arrays. DOTIMES,  AREF, AREF  and NTH place  forms of  SETF,
  4419.      MAKE-STRING-INPUT-STREAM  and  GET-OUTPUT-STREAM-STRING treat  numeric
  4420.      argument  modulo 65536.  MAKE-STRING-INPUT-STREAM  did not  check  for
  4421.      start>end.
  4422.  
  4423.      Strings containing nulls could not be read or printed.
  4424.  
  4425.      NTH and NTHCDR failed for zero length lists.
  4426.  
  4427.      Unnamed streams did not survive garbage collections.
  4428.  
  4429.      (format nil ...) did  not protect from garbage collection  the unnamed
  4430.      stream it creates.
  4431.  
  4432.      SORT did not protect some pointers from garbage collection.
  4433.  
  4434.      SYMBOL-NAME SYMBOL-VALUE  SYMBOL-PLIST BOUNDP and  FBOUNDP failed with
  4435.      symbol NIL as argument.
  4436.  
  4437.      LAST  returned wrong value when its argument  list ended with a dotted
  4438.      pair.
  4439.  
  4440.      *gc-hook*  was not rebound to NIL during execution of gchook function,
  4441.      causing potential infinite recursion and crash.
  4442.  
  4443.      Executing  RETURN  from   within  a  DOLIST  or   DOTIMES  caused  the
  4444.      environment to be wrong.
  4445.  
  4446.  
  4447.  
  4448.  
  4449.  
  4450.  
  4451.  
  4452.      XLISP 2.1d             BUG FIXES AND EXTENSIONS                Page 90
  4453.  
  4454.  
  4455.      When  errors occured during loading,  which were not  caught, the file
  4456.      would  be left open.  EVAL and  LOAD did  not use  global environment.
  4457.      EVALHOOK's default environment was not global.
  4458.  
  4459.      Invalid symbols  (those containing control characters,  for instance),
  4460.      can no longer be created with intern and make-symbol.
  4461.  
  4462.      The key T, meaning "otherwise" in the CASE function used to be allowed
  4463.      in any position. Now it  only means "otherwise" when used as  the last
  4464.      case.
  4465.  
  4466.      The lexical  and  functional environment  of  send of  :answer  (which
  4467.      defines a new  method) are  now used during  the method's  evaluation,
  4468.      rather than the global environment.
  4469.  
  4470.      Signatures added for WKS files so that invalid ones will be rejected.
  4471.  
  4472.      Checks added for file names and identifier names being too long.
  4473.  
  4474.      Indexing  code  fixed  to allow  almost  64k long  strings  in  16 bit
  4475.      systems. It is no longer  possible to allocate arrays or  strings that
  4476.      are too long for the underlying system.
  4477.  
  4478.      Circularity checks added to  PRINT LAST BUTLAST LENGTH MEMBER  and MAP
  4479.      functions. An error is produced for all but MEMBER, which will execute
  4480.      correctly.
  4481.  
  4482.  
  4483.                              User Interface Changes
  4484.  
  4485.      -w command line argument to specify alternate or no workspace.
  4486.  
  4487.      -? command line argument gives usage message.
  4488.  
  4489.      init.lsp not loaded if workspace loaded.
  4490.  
  4491.      Search path can be provided for workspaces and .lsp files.
  4492.  
  4493.      Standard  input and  output  can be  redirected. *TERMINAL-IO*  stream
  4494.      added which is always bound to console (stderr).
  4495.  
  4496.      Non-error  messages  are  sent  to *DEBUG-IO*  so  they  don't clutter
  4497.      *STANDARD-OUTPUT*
  4498.  
  4499.      Results of  evaluations are printed on a fresh line rather than at the
  4500.      end of the preceeding line (if any). This enhances readability.
  4501.  
  4502.      Display writes are buffered.
  4503.  
  4504.      Character literals available for all 256 values. CL
  4505.  
  4506.  
  4507.  
  4508.  
  4509.  
  4510.  
  4511.  
  4512.      XLISP 2.1d             BUG FIXES AND EXTENSIONS                Page 91
  4513.  
  4514.  
  4515.      Uninterned symbols print with leading #:. CL
  4516.  
  4517.      PRIN1  generates appropriate  escape  sequences for  control and  meta
  4518.      characters in strings. CL
  4519.  
  4520.      Read macro #. added. CL
  4521.  
  4522.      Lisp code for nested backquote macros added. CL
  4523.  
  4524.      Read macro #C added for complex numbers. CL
  4525.  
  4526.      Semantics for  #S read macro changed so that it can read in structures
  4527.      written by PRINT. CL
  4528.  
  4529.      PRINT of  file streams shows file  name, or "closed" if  a closed file
  4530.      stream.
  4531.  
  4532.      *PRINT-CASE* now applies to PRINC. CL
  4533.  
  4534.      Added *READTABLE-CASE* to control case conversion on input and output,
  4535.      allowing case sensitive code. CL-like
  4536.  
  4537.  
  4538.                              New/Changed Data Types
  4539.  
  4540.      NIL -- was treated as a special case, now just a normal symbol.
  4541.      symbols -- value binding can optionally be constant or special.
  4542.      ratio numbers -- new type.
  4543.      complex numbers -- new type, can be integer or real.
  4544.      character strings -- The ASCII NUL (code 0) is now a valid character.
  4545.      objects -- objects  of class Class have a  new instance variable which
  4546.           is the print name of the class.
  4547.      hash-table -- new type, close to CL
  4548.      random-state -- new type, CL
  4549.      Property list properties are no longer limited to just symbols CL
  4550.  
  4551.  
  4552.                            New Variables and Constants
  4553.  
  4554.      *apply-hook* Now activated
  4555.      *displace-macros*  Macros  are  replaced  with  their  expansions when
  4556.           possible *dos-input*  MSDOS only, uses DOS  interface to interact
  4557.           with user. Allows recall of earlier command(s).
  4558.      *print-level* CL
  4559.      *print-length* CL
  4560.      *random-state* CL
  4561.      *ratio-format*
  4562.      *readtable-case* CL-like
  4563.      *terminal-io* CL
  4564.      internal-time-units-per-second CL
  4565.      pi CL
  4566.  
  4567.  
  4568.  
  4569.  
  4570.  
  4571.  
  4572.  
  4573.      XLISP 2.1d             BUG FIXES AND EXTENSIONS                Page 92
  4574.  
  4575.  
  4576.  
  4577.                                   New functions
  4578.  
  4579.      ACONS CL*
  4580.      ACOSH CL*
  4581.      ADJOIN CL
  4582.      APPLYHOOK CL
  4583.      ASH CL
  4584.      ASINH CL*
  4585.      ATANH CL*
  4586.      BUTLAST CL
  4587.      CEILING CL
  4588.      CIS CL*
  4589.      CLREOL (clear to end of line -- MS/DOS only)
  4590.      CLRHASH CL
  4591.      CLS (clear screen -- MS/DOS only)
  4592.      COERCE CL
  4593.      COLOR (graphics -- MS/DOS only)
  4594.      COMPLEX CL
  4595.      COMPLEXP CL
  4596.      CONCATENATE CL
  4597.      CONJUGATE CL
  4598.      CONSTANTP CL
  4599.      COPY-ALIST CL*
  4600.      COPY-LIST CL*
  4601.      COPY-TREE CL*
  4602.      COSH CL*
  4603.      COUNT-IF CL except no :from-end
  4604.      DECF CL*
  4605.      DEFCLASS * (define a new class)
  4606.      DEFINST * (define a new instance)
  4607.      DEFMETHOD * (define a new method)
  4608.      DEFSETF CL*
  4609.      DELETE-FILE CL
  4610.      DENOMINATOR CL
  4611.      DRAW (graphics -- MS/DOS only)
  4612.      DRAWREL (graphics -- MS/DOS only)
  4613.      ELT CL
  4614.      EQUALP CL*
  4615.      EVERY CL
  4616.      FILE-LENGTH CL
  4617.      FILE-POSITION CL
  4618.      FILL CL*
  4619.      FIND-IF CL except no :from-end
  4620.      FLOOR CL
  4621.      FRESH-LINE CL
  4622.      FUNCTIONP CL*
  4623.      GENERIC (implementation debugging function)
  4624.      GET-INTERNAL-REAL-TIME CL
  4625.      GET-INTERNAL-RUN-TIME CL
  4626.      GETHASH CL
  4627.  
  4628.  
  4629.  
  4630.  
  4631.  
  4632.  
  4633.  
  4634.      XLISP 2.1d             BUG FIXES AND EXTENSIONS                Page 93
  4635.  
  4636.  
  4637.      GOTO-XY (position cursor -- MS/DOS only)
  4638.      HASH-TABLE-COUNT CL
  4639.      IDENTITY CL*
  4640.      IMAGPART CL
  4641.      INCF CL*
  4642.      INPUT-STREAM-P CL
  4643.      INTERSECTION CL
  4644.      LCM CL
  4645.      LIST* CL
  4646.      LOG CL
  4647.      LOGTEST CL*
  4648.      MAKE-HASK-TABLE CL
  4649.      MAKE-RANDOM-STATE CL
  4650.      MAP CL
  4651.      MAPHASH CL
  4652.      MODE (graphics -- MS/DOS only)
  4653.      MOVE (graphics -- MS/DOS only)
  4654.      MOVEREL (graphics -- MS/DOS only)
  4655.      NINTERSECTION CL*
  4656.      NOTANY CL
  4657.      NOTEVERY CL
  4658.      NREVERSE CL
  4659.      NSET-DIFFERENCE CL*
  4660.      NSET-EXCLUSIVE-OR CL*
  4661.      NUMERATOR CL
  4662.      NUNION CL*
  4663.      OPEN-STREAM-P CL
  4664.      OUTPUT-STREAM-P CL
  4665.      PAIRLIS CL*
  4666.      PHASE CL
  4667.      POP CL*
  4668.      POSITION-IF CL except no :from-end
  4669.      PUSH CL*
  4670.      PUSHNEW CL*
  4671.      RATIONALP CL
  4672.      REALPART CL
  4673.      REDUCE CL except no :from-end
  4674.      REMHASH CL
  4675.      REMOVE-DUPLICATES CL except no :from-end
  4676.      REPLACE CL*
  4677.      ROUND CL
  4678.      SEARCH CL except no :from-end
  4679.      SET-DIFFERENCE CL
  4680.      SET-EXCLUSIVE-OR CL*
  4681.      SETF Placeform ELT  CL
  4682.      SETF Placeform GETHASH  CL
  4683.      SETF Placeform SEND* (set instance variable)
  4684.      SIGNUM CL*
  4685.      SINH CL*
  4686.      SOME CL
  4687.      SUBSETP CL
  4688.  
  4689.  
  4690.  
  4691.  
  4692.  
  4693.  
  4694.  
  4695.      XLISP 2.1d             BUG FIXES AND EXTENSIONS                Page 94
  4696.  
  4697.  
  4698.      TANH CL*
  4699.      TIME CL
  4700.      TRUENAME CL
  4701.      TYPEP CL
  4702.      UNINTERN CL*
  4703.      UNION CL
  4704.      WITH-INPUT-FROM-STRING CL*
  4705.      WITH-OPEN-FILE CL*
  4706.      WITH-OUTPUT-TO-STRING CL*
  4707.      Y-OR-N-P CL*
  4708.  
  4709.  
  4710.                                 Changed functions
  4711.  
  4712.      &ALLOW-OTHER-KEYS CL (now functions, is no longer ignored)
  4713.      * CL CR CX (with no arguments, returns 1)
  4714.      + CL CR CX (with no arguments, returns 0)
  4715.      - CL CR CX
  4716.      / CL CR CX
  4717.      1+ CL CR CX
  4718.      1- CL CR CX
  4719.      ABS CL CR CX
  4720.      ACOS CL CR CX
  4721.      ALLOC (new optional second argument)
  4722.      APPLY CL (allows multiple arguments)
  4723.      AREF CL (now works on strings)
  4724.      ASIN CL CR CX
  4725.      ASSOC CL (added :key)
  4726.      ATAN CL CR CX (second argument now allowed)
  4727.      CHAR-CODE CL (parity bit is stripped)
  4728.      CLOSE CL (will close unnamed stream strings)
  4729.      COS CL CR CX
  4730.      DEFCONSTANT CL# (true constants)
  4731.      DEFPARAMETER CL# (true special variables)
  4732.      DEFVAR CL# (true special variables)
  4733.      DELETE (added keywords :key :start :end. Works on arrays and strings)
  4734.      DELETE-IF  (added  keywords  :key :start  :end.  Works  on arrays  and
  4735.           strings) 
  4736.      DELETE-IF-NOT  (added keywords :key  :start :end. Works  on arrays and
  4737.           strings) 
  4738.      EXP CL CR CX
  4739.      EXPT CL CR CX
  4740.      FORMAT  (added directives  ~D  ~E  ~F  ~G  ~&  ~T  ~\N  and  lowercase
  4741.           directives) 
  4742.      HASH (hashes everything, not just symbols or strings)
  4743.      LOAD CL (uses path to find file, allows file stream for name argument)
  4744.  
  4745.      LOGAND CL (with no arguments, returns -1)
  4746.      LOGIOR CL (with no arguments, returns 0)
  4747.      LOGXOR CL (with no arguments returns 0)
  4748.      MAKE-STRING-INPUT-STREAM CL (:end NIL means end of string)
  4749.  
  4750.  
  4751.  
  4752.  
  4753.  
  4754.  
  4755.  
  4756.      XLISP 2.1d             BUG FIXES AND EXTENSIONS                Page 95
  4757.  
  4758.  
  4759.      MAKUNBOUND #
  4760.      MAPCAN #
  4761.      MAPCON #
  4762.      MEMBER CL (added :key)
  4763.      NSTRING-DOWNCASE CL (string argument can be symbol, :end NIL means end
  4764.           of string)
  4765.      NSTRING-UPCASE CL (string argument  can be symbol, :end NIL  means end
  4766.           of string)
  4767.      OPEN CL (many additional options, as in Common Lisp)
  4768.      PEEK (fixnum sized location is fetched)
  4769.      PEEK-CHAR   CL   (input  stream   NIL   is   *standard-input*,  T   is
  4770.           *terminal-io*) 
  4771.      POKE (fixnum sized location is stored)
  4772.      PPRINT (output stream NIL is *standard-output*, T is *terminal-io*)
  4773.      PRIN1 CL (output stream NIL is *standard-output*, T is *terminal-io*)
  4774.      PRINC CL (output stream NIL is *standard-output*, T is *terminal-io*)
  4775.      PRINT (output stream NIL is *standard-output*, T is *terminal-io*)
  4776.      RANDOM CL (works with random-states)
  4777.      READ (input stream NIL is *standard-input*, T is *terminal-io*)
  4778.      READ-BYTE   CL   (input  stream   NIL   is   *standard-input*,  T   is
  4779.           *terminal-io*) 
  4780.      READ-CHAR   CL   (input  stream   NIL   is   *standard-input*,  T   is
  4781.           *terminal-io*) 
  4782.      READ-LINE   CL   (input  stream   NIL   is   *standard-input*,  T   is
  4783.           *terminal-io*) 
  4784.      REM CR CL (only two arguments now allowed, may be floating point)
  4785.      REMOVE (added keywords :key :start :end. Works on arrays and strings)
  4786.      REMOVE-IF  (added  keywords  :key :start  :end.  Works  on arrays  and
  4787.           strings) 
  4788.      REMOVE-IF-NOT  (added keywords :key  :start :end. Works  on arrays and
  4789.           strings) 
  4790.      RESTORE  (uses path  to find  file, restores  file streams,  fine name
  4791.           argument may be file stream)
  4792.      REVERSE CL (works on arrays and strings)
  4793.      SAVE (file name argument may be file stream)
  4794.      SIN CL CR CX
  4795.      SORT (added :key)
  4796.      SQRT CL CR CX
  4797.      STRCAT * (now a macro, use of CONCATENATE is recommended)
  4798.      STRING-comparisonFunctions CL (string arguments can be symbols)
  4799.      STRING-DOWNCASE  CL (string argument can be symbol, :end NIL means end
  4800.           of string)
  4801.      STRING-LEFT-TRIM CL (string argument can be symbol)
  4802.      STRING-RIGHT-TRIM CL (string argument can be symbol)
  4803.      STRING-TRIM CL (string argument can be symbol)
  4804.      STRING-UPCASE CL (string argument can be symbol, :end NIL means end of
  4805.           string) 
  4806.      SUBLIS CL (modified to do minimum copying)
  4807.      SUBSEQ CL (works on arrays and lists)
  4808.      SUBST CL (modified to do minimum copying)
  4809.      TAN CL CR CX
  4810.  
  4811.  
  4812.  
  4813.  
  4814.  
  4815.  
  4816.  
  4817.      XLISP 2.1d             BUG FIXES AND EXTENSIONS                Page 96
  4818.  
  4819.  
  4820.      TERPRI CL (output stream NIL is *standard-output*, T is *terminal-io*)
  4821.  
  4822.      TRUNCATE CR CL (allows denominator argument)
  4823.      TYPE-OF (returns  HASH-TABLE for hashtables, COMPLEX  for complex, and
  4824.           LIST for NIL)
  4825.      UNTRACE CL (with no arguments, untraces all functions)
  4826.      WRITE-BYTE  CL   (output  stream   NIL  is  *standard-output*,   T  is
  4827.           *terminal-io*) 
  4828.      WRITE-CHAR  CL   (output  stream   NIL  is  *standard-output*,   T  is
  4829.           *terminal-io*)
  4830.  
  4831.  
  4832.                           New messages for class Object
  4833.  
  4834.      :prin1 <stream>
  4835.      :superclass *
  4836.      :ismemberof <cls> *
  4837.      :iskindof <cls> *
  4838.      :respondsto <selector> * 
  4839.      :storeon (returns form that will create a copy of the object) *
  4840.  
  4841.                           New messages for class Class
  4842.  
  4843.      :superclass *
  4844.      :messages *
  4845.      :storeon (returns form that will recreate class and methods) *
  4846.  
  4847.  
  4848.  
  4849.  
  4850.  
  4851.  
  4852.  
  4853.      XLISP 2.1d                     EXAMPLES                        Page 97
  4854.  
  4855.  
  4856.  
  4857.      EXAMPLES: FILE I/O FUNCTIONS
  4858.  
  4859.  
  4860.      Input from a File
  4861.  
  4862.      To  open a  file for  input, use  the OPEN  function with  the keyword
  4863.      argument :DIRECTION set to :INPUT. To  open a file for output, use the
  4864.      OPEN function with the keyword argument :DIRECTION set to :OUTPUT. The
  4865.      OPEN function  takes a single required  argument which is  the name of
  4866.      the file to be  opened. This name can be in the form  of a string or a
  4867.      symbol. The OPEN function returns an  object of type FILE-STREAM if it
  4868.      succeeds in opening the specified file. It returns the value NIL if it
  4869.      fails. In  order to manipulate the  file, it is necessary  to save the
  4870.      value returned by the OPEN function. This is usually done by assigning
  4871.      it to a variable with the SETQ special form or by binding it using LET
  4872.      or LET*. Here is an example:
  4873.  
  4874.          (setq fp (open "init.lsp" :direction :input))
  4875.  
  4876.      Evaluating  this expression will  result in the  file "init.lsp" being
  4877.      opened. The file  object that  will be returned  by the OPEN  function
  4878.      will be assigned to the variable "fp".
  4879.  
  4880.      It is now possible to  use the file for  input. To read an  expression
  4881.      from  the file,  just supply  the value  of the  "fp" variable  as the
  4882.      optional "stream" argument to READ.
  4883.  
  4884.          (read fp)
  4885.  
  4886.      Evaluating this expression will result in reading the first expression
  4887.      from  the  file "init.lsp".  The expression  will  be returned  as the
  4888.      result of the  READ function.  More expressions can  be read from  the
  4889.      file using further calls to the READ function. When there  are no more
  4890.      expressions  to read, the READ  function will return  NIL (or whatever
  4891.      value was supplied as the second argument to READ).
  4892.  
  4893.      Once you are done reading from the file, you should close it. To close
  4894.      the file, use the following expression:
  4895.  
  4896.          (close fp)
  4897.  
  4898.      Evaluating this expression will cause the file to be closed.
  4899.  
  4900.  
  4901.  
  4902.  
  4903.  
  4904.  
  4905.  
  4906.      XLISP 2.1d                     EXAMPLES                        Page 98
  4907.  
  4908.  
  4909.  
  4910.      Output to a File
  4911.  
  4912.      Writing to a  file is pretty  much the same as  reading from one.  You
  4913.      need  to open  the  file first.  This  time you  should  use the  OPEN
  4914.      function to indicate that you will do output to the file. For example:
  4915.  
  4916.          (setq   fp   (open   "test.dat"  :direction   :output   :if-exists
  4917.      :supersede))
  4918.  
  4919.      Evaluating  this expression will open the  file "test.dat" for output.
  4920.      If the file already exists, its current contents will be discarded. If
  4921.      it  doesn't  already  exist,  it  will  be  created. In  any  case,  a
  4922.      FILE-STREAM  object will be returned  by the OPEN  function. This file
  4923.      object will be assigned to the "fp" variable.
  4924.  
  4925.      It is now possible to write to this file by supplying the value of the
  4926.      "fp"  variable  as  the  optional  "stream"  parameter  in  the  PRINT
  4927.      function.
  4928.  
  4929.          (print "Hello there" fp)
  4930.  
  4931.      Evaluating this  expression will  result in  the string  "Hello there"
  4932.      being written  to the file "test.dat". More data can be written to the
  4933.      file using the same technique.
  4934.  
  4935.      Once you are done writing to the file, you should close it. Closing an
  4936.      output file is just like closing an input file.
  4937.  
  4938.          (close fp)
  4939.  
  4940.      Evaluating  this expression  will close  the output  file and  make it
  4941.      permanent.
  4942.  
  4943.  
  4944.  
  4945.      A Slightly More Complicated File Example
  4946.  
  4947.      This example  shows how to open a file, read each Lisp expression from
  4948.      the file and print it. It demonstrates the use of files and the use of
  4949.      the optional "stream" argument to the READ
  4950.      function.
  4951.  
  4952.          (do* ((fp (open "test.dat" :direction :input))
  4953.                (ex (read fp) (read fp)))
  4954.               ((null ex) (close fp) nil)
  4955.            (print ex))
  4956.  
  4957.      The file will be closed with the next garbage collection.
  4958.  
  4959.  
  4960.  
  4961.  
  4962.  
  4963.  
  4964.  
  4965.       XLISP 2.1d                       INDEX                         Page 99
  4966.  
  4967.  
  4968.       INDEX
  4969.  
  4970.  
  4971.  
  4972.      :answer  20                           :superclass  19, 20
  4973.      :append  73                           :supersede  73
  4974.      :class  19                            :test    27, 31,  34-36, 39,
  4975.      :conc-name  53                                  40, 41, 59
  4976.      :constituent  12                      :test-not   27,  34-36,  39,
  4977.      :create  74                                     40, 41, 59
  4978.      :direction  73                        :tmacro  12
  4979.      :downcase  14                         :upcase  14
  4980.      :element-type  73                     :verbose  80
  4981.      :end  34-36, 49, 75                   :white-space  12
  4982.      :end1  34, 37, 50                     +  23, 43
  4983.      :end2  34, 37, 50                     ++  23
  4984.      :error  73, 74                        +++  23
  4985.      :if-does-not-exist  73                -  23, 43
  4986.      :if-exists  73                        *  23, 44
  4987.      :include  53                          **  23
  4988.      :initial-value  36                    ***  23
  4989.      :input  73                            *applyhook*  9, 22
  4990.      :invert  14                           *breakenable*  4, 22
  4991.      :io  73                               *debug-io*  22
  4992.      :iskindof  19                         *displace-macros*  8, 23
  4993.      :ismemberof  19                       *dos-input*  2, 23
  4994.      :isnew  19, 20                        *error-output*  22
  4995.      :key  27, 34-36, 39-42, 59            *evalhook*  9, 22
  4996.      :mescape  12                          *float-format*  23, 67
  4997.      :messages  20                         *gc-flag*  23
  4998.      :new  20                              *gc-hook*  9, 23
  4999.      :new-version  73                      *integer-format*  23, 67
  5000.      :nmacro  12                           *obarray*  22
  5001.      :output  73                           *print-case*  14, 23, 67
  5002.      :overwrite  73                        *print-length*  23, 67
  5003.      :preserve  14                         *print-level*  23, 67
  5004.      :prin1  19                            *random-state*  23
  5005.      :print  80                            *ratio-format*  23, 67
  5006.      :probe  73                            *readtable-case*    14,  23,
  5007.      :rename  73                                     67
  5008.      :rename-and-delete  73                *readtable*  12, 22
  5009.      :respondsto  19                       *standard-input*  22
  5010.      :sescape  12                          *standard-output*  22
  5011.      :set-ivar  55                         *struct-slots*  53
  5012.      :set-pname  55                        *terminal-io*  22
  5013.      :show  19                             *trace-output*  22
  5014.      :size  31                             *tracelimit*  4, 22
  5015.      :start  34-36, 49, 75                 *tracelist*  22
  5016.      :start1  34, 37, 50                   *tracenable*  4, 22
  5017.      :start2  34, 37, 50                   *unbound*  23
  5018.      :storeon  19, 20                      /  44
  5019.  
  5020.  
  5021.  
  5022.  
  5023.  
  5024.  
  5025.  
  5026.      XLISP 2.1d                       INDEX                        Page 100
  5027.  
  5028.  
  5029.      /=  47                                char-greaterp  52
  5030.      <  47                                 char-int  51
  5031.      <=  47                                char-lessp  52
  5032.      =  47                                 char-not-equal  52
  5033.      >  47                                 char-not-greaterp  52
  5034.      >=  47                                char-not-lessp  52
  5035.      &allow-other-keys  16                 char-upcase  51
  5036.      &aux  16                              char/=  52
  5037.      &key  16                              char<  52
  5038.      &optional  16                         char<=  52
  5039.      &rest  16                             char=  52
  5040.      1+  44                                char>  52
  5041.      1-  44                                char>=  52
  5042.      abs  44                               CHARACTER  82
  5043.      acons  38                             characterp  58
  5044.      acos  45                              cis  46
  5045.      acosh  46                             class  22
  5046.      address-of  82                        classp  58
  5047.      adjoin  41                            clean-up  3, 78
  5048.      alloc  81                             clean-up,  4
  5049.      and  60, 61                           close  74
  5050.      append  38                            CLOSURE  82
  5051.      apply  24                             clrhash  31
  5052.      applyhook  9, 79                      cls  83
  5053.      aref  26, 32                          code-char  51
  5054.      ARRAY  82                             coerce  82
  5055.      arrayp  58                            color  84
  5056.      ash  48                               comma  24
  5057.      asin  45                              comma-at  24
  5058.      asinh  46                             complex  47, 82
  5059.      assoc  39                             complexp  58
  5060.      atan  45                              concatenate  33
  5061.      atanh  46                             cond  61
  5062.      atom  57, 60                          conjugate  47
  5063.      backquote  24                         cons  38, 82
  5064.      baktrace  78                          consp  57
  5065.      block  65                             constantp  57
  5066.      both-case-p  51                       continue  3, 4, 78
  5067.      boundp  58                            copy-alist  40
  5068.      break  78                             copy-list  40
  5069.      butlast  38                           copy-tree  41
  5070.      car  26, 38                           cos  45
  5071.      case  62                              cosh  46
  5072.      catch  62                             count-if  35
  5073.      cdr  26, 38                           cxxr  38
  5074.      ceiling  43                           cxxxr  38
  5075.      cerror  78                            cxxxxr  38
  5076.      char  51                              debug  79
  5077.      char-code  51                         decf  27
  5078.      char-downcase  51                     defclass  55
  5079.      char-equal  52                        defconstant  29
  5080.  
  5081.  
  5082.  
  5083.  
  5084.  
  5085.  
  5086.  
  5087.      XLISP 2.1d                       INDEX                        Page 101
  5088.  
  5089.  
  5090.      definst  56                           FLONUM  82
  5091.      defmacro  28                          floor  43
  5092.      defmethod  55                         fmakunbound  28
  5093.      defparameter  29                      format  69
  5094.      defsetf  27                           fourth  38
  5095.      defstruct  53                         fresh-line  68
  5096.      defun  28                             FSUBR  82
  5097.      defvar  29                            funcall  24
  5098.      delete  35                            function  24, 60
  5099.      delete-file  74                       functionp  59
  5100.      delete-if  36                         gc  81
  5101.      delete-if-not  36                     gcd  45
  5102.      denominator  46                       generic  83
  5103.      digit-char  51                        gensym  28
  5104.      digit-char-p  51                      get  26, 30
  5105.      do  64                                get-internal-real-time  81
  5106.      do*  64                               get-internal-run-time  81
  5107.      dolist  64                            get-key  83
  5108.      dotimes  64                           get-lambda-expression  25
  5109.      draw  84                              get-macro-character  67
  5110.      drawrel  84                           get-output-stream-list  76
  5111.      dribble  81                           get-output-stream-string
  5112.      elt  26, 33                                     76
  5113.      endp  57                              gethash  26, 31
  5114.      eq  60                                go  65
  5115.      eql  60                               goto-xy  83
  5116.      equal  60                             hash  28
  5117.      equalp  60                            HASH-TABLE  82
  5118.      error  78                             hash-table-count  31
  5119.      errset  4, 78                         identity  24
  5120.      eval  24                              if  61
  5121.      evalhook  9, 79                       imagpart  47
  5122.      evenp  59                             incf  27
  5123.      every  33                             input-stream-p  58
  5124.      exit  83                              int-char  51
  5125.      exp  46                               integerp  57
  5126.      expand  81                            intern  28
  5127.      expt  46                              internal-time-units-per-sec
  5128.      fboundp  59                                     ond  22
  5129.      file-length  75                       intersection  41
  5130.      file-position  75                     labels  62
  5131.      FILE-STREAM  82                       lambda  25
  5132.      fill  36                              last  38
  5133.      find-if  35                           lcm  45
  5134.      first  38                             length  33
  5135.      FIXNUM  82                            let  62
  5136.      flatc  68                             let*  62
  5137.      flatsize  68                          list  38, 60, 82
  5138.      flet  62                              list*  38
  5139.      float  43                             listp  57
  5140.      floatp  57                            load  80
  5141.  
  5142.  
  5143.  
  5144.  
  5145.  
  5146.  
  5147.  
  5148.      XLISP 2.1d                       INDEX                        Page 102
  5149.  
  5150.  
  5151.      log  46                               NUMBER  60
  5152.      logand  48                            numberp  57
  5153.      logior  48                            numerator  46
  5154.      lognot  48                            nunion  41
  5155.      logtest  48                           object  22, 60, 82
  5156.      logxor  48                            objectp  58
  5157.      loop  64                              oddp  59
  5158.      lower-case-p  51                      open  73
  5159.      macroexpand  25                       open-stream-p  58
  5160.      macroexpand-1  25                     or  60, 61
  5161.      macrolet  62                          output-stream-p  58
  5162.      make-array  32                        pairlis  40
  5163.      make-hash-table  31                   peek  82
  5164.      make-random-state  45                 peek-char  72
  5165.      make-string-input-stream              phase  47
  5166.                76                          pi  22
  5167.      make-string-output-stream             plusp  59
  5168.                76                          poke  82
  5169.      make-symbol  28                       pop  27
  5170.      makunbound  28                        position-if  35
  5171.      map  33                               pp  86
  5172.      mapc  39                              pprint  68
  5173.      mapcan  40                            prin1  67
  5174.      mapcar  39                            princ  68
  5175.      mapcon  40                            print  67
  5176.      maphash  31                           prog  65
  5177.      mapl  39                              prog*  65
  5178.      maplist  39                           prog1  66
  5179.      max  44                               prog2  66
  5180.      member  39, 60                        progn  66
  5181.      min  44                               progv  65
  5182.      minusp  59                            psetq  26
  5183.      mod  44                               push  27
  5184.      mode  84                              pushnew  27
  5185.      move  84                              putprop  30
  5186.      moverel  84                           quote  24
  5187.      nconc  42                             random  45
  5188.      NIL  22                               RATIO  82
  5189.      nintersection  41                     RATIONAL  60
  5190.      nodebug  79                           rationalp  58
  5191.      not  57, 60                           read  67
  5192.      notany  33                            read-byte  74
  5193.      notevery  33                          read-char  72
  5194.      nreverse  33                          read-line  72
  5195.      nset-difference  41                   realpart  47
  5196.      nset-exclusive-or  41                 reduce  36
  5197.      nstring-downcase  49                  rem  44
  5198.      nstring-upcase  49                    remhash  31
  5199.      nth  26, 39                           remove  34
  5200.      nthcdr  39                            remove-duplicates  36
  5201.      null  57, 60                          remove-if  34
  5202.  
  5203.  
  5204.  
  5205.  
  5206.  
  5207.  
  5208.  
  5209.      XLISP 2.1d                       INDEX                        Page 103
  5210.  
  5211.  
  5212.      remove-if-not  34                     string<=  50
  5213.      remprop  30                           string=  50
  5214.      repair  87                            string>  50
  5215.      repairf  87                           string>=  50
  5216.      replace  37                           stringp  58
  5217.      rest  38                              STRUCT  60
  5218.      restore  80                           sublis  40
  5219.      return  65                            SUBR  82
  5220.      return-from  65                       subseq  34
  5221.      reverse  33                           subsetp  59
  5222.      room  81                              subst  40
  5223.      round  43                             SYMBOL  82
  5224.      rplaca  42                            symbol-function  26, 28
  5225.      rplacd  42                            symbol-name  28
  5226.      satisfies  60                         symbol-plist  26, 28
  5227.      save  80                              symbol-value  26, 28
  5228.      search  34                            symbolp  57
  5229.      second  38                            system  83
  5230.      self  18, 22                          t  22
  5231.      send  18, 26, 55                      tagbody  65
  5232.      send-super  18, 55                    tan  45
  5233.      set  26                               tanh  46
  5234.      set-difference  41                    terpri  68
  5235.      set-exclusive-or  41                  third  38
  5236.      set-macro-character  67               throw  62
  5237.      setf  26                              time  81
  5238.      setq  26                              top-level  3, 78
  5239.      signum  45                            trace  78
  5240.      sin  45                               truename  74
  5241.      sinh  46                              truncate  43
  5242.      some  33                              type-of  82
  5243.      sort  42                              typep  60
  5244.      sqrt  46                              union  41
  5245.      step  85                              unless  61
  5246.      strcat  50                            UNNAMED-STREAM  82
  5247.      STREAM  60                            untrace  78
  5248.      streamp  58                           unwind-protect  63
  5249.      string  49, 82                        upper-case-p  51
  5250.      string-downcase  49                   vector  32
  5251.      string-equal  50                      when  61
  5252.      string-greaterp  50                   with-input-from-string  76
  5253.      string-left-trim  49                  with-open-file  74
  5254.      string-lessp  50                      with-output-to-string  77
  5255.      string-not-equal  50                  write-byte  74
  5256.      string-not-greaterp  50               write-char  72
  5257.      string-not-lessp  50                  y-or-n-p  68
  5258.      string-right-trim  49                 zerop  59
  5259.      string-trim  49
  5260.      string-upcase  49
  5261.      string/=  50
  5262.      string<  50
  5263.