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