home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-10-23 | 170.2 KB | 3,916 lines |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- XLISP: An Object-oriented Lisp
-
- Version 2.0
-
- February 6, 1988
-
-
- by
- David Michael Betz
- P.O. Box 144
- Peterborough, NH 03458
-
- (603) 924-4145 (home)
-
- Copyright (c) 1988, by David Michael Betz
- All Rights Reserved
- Permission is granted for unrestricted non-commercial use
-
-
-
-
- Additions to the manual u✓_n✓_d✓_e✓_r✓_l✓_i✓_n✓_e✓_d✓_, by Tom Almy October 26, 1990.
-
- This distributed version has the added functions of XLISP 2.1
- incorporated, as well as other enhancements, all of which can be
- eliminated via compilation options.
-
-
-
-
-
-
-
-
-
- Table of Contents
-
- INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . 1
-
- A NOTE FROM THE AUTHOR . . . . . . . . . . . . . . . . . . . . . 2
-
- XLISP COMMAND LOOP . . . . . . . . . . . . . . . . . . . . . . . 3
-
- BREAK COMMAND LOOP . . . . . . . . . . . . . . . . . . . . . . . 5
-
- DATA TYPES . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
-
- THE EVALUATOR . . . . . . . . . . . . . . . . . . . . . . . . . . 8
-
- HOOK FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . . . . 9
-
- LEXICAL CONVENTIONS . . . . . . . . . . . . . . . . . . . . . . . 10
-
- READTABLES . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
-
- LAMBDA LISTS . . . . . . . . . . . . . . . . . . . . . . . . . . 14
-
- OBJECTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
-
- SYMBOLS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
-
- EVALUATION FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . 21
-
- SYMBOL FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . . . 23
-
- PROPERTY LIST FUNCTIONS . . . . . . . . . . . . . . . . . . . . . 26
-
- ARRAY FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . . . . 27
-
- SEQUENCE FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . . 28
-
- LIST FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . . . . 32
-
- DESTRUCTIVE LIST FUNCTIONS . . . . . . . . . . . . . . . . . . . 36
-
- ARITHMETIC FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . 37
-
- BITWISE LOGICAL FUNCTIONS . . . . . . . . . . . . . . . . . . . . 40
-
- STRING FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . . . 41
-
- CHARACTER FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . . 43
-
- STRUCTURE FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . . 45
-
- OBJECT FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . . . 47
-
- PREDICATE FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . . 49
-
-
-
-
-
-
-
- XLISP 2.0 Table of Contents
-
-
- CONTROL CONSTRUCTS . . . . . . . . . . . . . . . . . . . . . . . 52
-
- LOOPING CONSTRUCTS . . . . . . . . . . . . . . . . . . . . . . . 55
-
- THE PROGRAM FEATURE . . . . . . . . . . . . . . . . . . . . . . . 56
-
- INPUT/OUTPUT FUNCTIONS . . . . . . . . . . . . . . . . . . . . . 58
-
- THE FORMAT FUNCTION . . . . . . . . . . . . . . . . . . . . . . . 60
-
- FILE I/O FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . . 61
-
- STRING STREAM FUNCTIONS . . . . . . . . . . . . . . . . . . . . . 63
-
- DEBUGGING AND ERROR HANDLING FUNCTIONS . . . . . . . . . . . . . 64
-
- SYSTEM FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . . . 66
-
- ADDITIONAL FUNCTIONS AND UTILITIES . . . . . . . . . . . . . . . 69
-
- EXAMPLES: FILE I/O FUNCTIONS . . . . . . . . . . . . . . . . . . 73
-
- INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
-
-
-
-
-
-
-
- XLISP 2.0 INTRODUCTION Page 1
-
-
-
-
- INTRODUCTION
-
- XLISP is an experimental programming language combining some of the
- features of Common Lisp with an object-oriented extension capability.
- It was implemented to allow experimentation with object-oriented
- programming on small computers.
-
- There are currently implementations of XLISP running on the IBM-PC and
- clones under MS-DOS, on the Macintosh, the Atari-ST and the Amiga. It
- is completely written in the programming language 'C' and is easily
- extended with user written built-in functions and classes. It is
- available in source form to non-commercial users.
-
- Many Common Lisp functions are built into XLISP. In addition, XLISP
- defines the objects 'Object' and 'Class' as primitives. 'Object' is
- the only class that has no superclass and hence is the root of the
- class heirarchy tree. 'Class' is the class of which all classes are
- instances (it is the only object that is an instance of itself).
-
- This document is a brief description of XLISP. It assumes some
- knowledge of LISP and some understanding of the concepts of object-
- oriented programming.
-
- I recommend the book "LISP" by Winston and Horn and published by
- Addison Wesley for learning Lisp. The first edition of this book is
- based on MacLisp and the second edition is based on Common Lisp. XLISP
- will continue to migrate towards compatibility with Common Lisp.
-
- You will probably also need a copy of "Common Lisp: The Language" by
- Guy L. Steele, Jr., published by Digital Press to use as a reference
- for some of the Common Lisp functions that are described only briefly
- in this document.
-
-
-
-
-
-
-
- XLISP 2.0 A NOTE FROM THE AUTHOR Page 2
-
-
-
- A NOTE FROM THE AUTHOR
-
- If you have any problems with XLISP, feel free to contact me for help
- or advice. Please remember that since XLISP is available in source
- form in a high level language, many users have been making versions
- available on a variety of machines. If you call to report a problem
- with a specific version, I may not be able to help you if that version
- runs on a machine to which I don't have access. Please have the
- version number of the version that you are running readily accessible
- before calling me.
-
- If you find a bug in XLISP, first try to fix the bug yourself using
- the source code provided. If you are successful in fixing the bug,
- send the bug report along with the fix to me. If you don't have access
- to a C compiler or are unable to fix a bug, please send the bug report
- to me and I'll try to fix it.
-
- Any suggestions for improvements will be welcomed. Feel free to extend
- the language in whatever way suits your needs. However, PLEASE DO NOT
- RELEASE ENHANCED VERSIONS WITHOUT CHECKING WITH ME FIRST!! I would
- like to be the clearing house for new features added to XLISP. If you
- want to add features for your own personal use, go ahead. But, if you
- want to distribute your enhanced version, contact me first. Please
- remember that the goal of XLISP is to provide a language to learn and
- experiment with LISP and object-oriented programming on small
- computers. I don't want it to get so big that it requires megabytes of
- memory to run.
-
-
-
-
-
-
-
- XLISP 2.0 XLISP COMMAND LOOP Page 3
-
-
-
- XLISP COMMAND LOOP
-
- When XLISP is started, it first tries to load the workspace
- "xlisp.wks" from the current directory. If that file doesn't exist, o✓_r✓_
- t✓_h✓_e✓_ "✓_-✓_w✓_"✓_ f✓_l✓_a✓_g✓_ i✓_s✓_ i✓_n✓_ t✓_h✓_e✓_ c✓_o✓_m✓_m✓_a✓_n✓_d✓_ l✓_i✓_n✓_e✓_,✓_ XLISP builds an initial
- workspace, empty except for the built-in functions and symbols.
-
- Then,✓_ p✓_r✓_o✓_v✓_i✓_d✓_i✓_n✓_g✓_ x✓_l✓_i✓_s✓_p✓_.✓_w✓_k✓_s✓_ w✓_a✓_s✓_ n✓_o✓_t✓_ l✓_o✓_a✓_d✓_e✓_d✓_,✓_ XLISP attempts to load
- "init.lsp" from the current directory. It then loads any files named
- as parameters on the command line (after appending ".lsp" to their
- names). I✓_f✓_ t✓_h✓_e✓_ "✓_-✓_v✓_"✓_ f✓_l✓_a✓_g✓_ i✓_s✓_ i✓_n✓_ t✓_h✓_e✓_ c✓_o✓_m✓_m✓_a✓_n✓_d✓_ l✓_i✓_n✓_e✓_,✓_ t✓_h✓_e✓_n✓_ t✓_h✓_e✓_ f✓_i✓_l✓_e✓_s✓_ a✓_r✓_e✓_
- l✓_o✓_a✓_d✓_e✓_d✓_ v✓_e✓_r✓_b✓_o✓_s✓_e✓_l✓_y✓_.✓_ T✓_h✓_e✓_ o✓_p✓_t✓_i✓_o✓_n✓_ "✓_-✓_t✓_ f✓_i✓_l✓_e✓_n✓_a✓_m✓_e✓_"✓_ w✓_i✓_l✓_l✓_ o✓_p✓_e✓_n✓_ a✓_ t✓_r✓_a✓_n✓_s✓_c✓_r✓_i✓_p✓_t✓_ f✓_i✓_l✓_e✓_
- o✓_f✓_ t✓_h✓_e✓_ n✓_a✓_m✓_e✓_ "✓_f✓_i✓_l✓_e✓_n✓_a✓_m✓_e✓_"✓_.✓_
-
- XLISP then issues the following prompt:
-
- >
-
- This indicates that XLISP is waiting for an expression to be typed.
-
- When a complete expression has been entered, XLISP attempts to
- evaluate that expression. If the expression evaluates successfully,
- XLISP prints the result and then returns to the initial prompt waiting
- for another expression to be typed.
-
- T✓_h✓_e✓_ f✓_o✓_l✓_l✓_o✓_w✓_i✓_n✓_g✓_ c✓_o✓_n✓_t✓_r✓_o✓_l✓_ c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_s✓_ c✓_a✓_n✓_ b✓_e✓_ u✓_s✓_e✓_d✓_ w✓_h✓_i✓_l✓_e✓_ X✓_L✓_I✓_S✓_P✓_ i✓_s✓_ w✓_a✓_i✓_t✓_i✓_n✓_g✓_
- f✓_o✓_r✓_ i✓_n✓_p✓_u✓_t✓_:✓_
-
- B✓_a✓_c✓_k✓_s✓_p✓_a✓_c✓_e✓_ d✓_e✓_l✓_e✓_t✓_e✓_ l✓_a✓_s✓_t✓_ c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_
- D✓_e✓_l✓_ d✓_e✓_l✓_e✓_t✓_e✓_ l✓_a✓_s✓_t✓_ c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_
- t✓_a✓_b✓_ t✓_a✓_b✓_s✓_ o✓_v✓_e✓_r✓_ (✓_t✓_r✓_e✓_a✓_t✓_e✓_d✓_ a✓_s✓_ s✓_p✓_a✓_c✓_e✓_ b✓_y✓_ X✓_L✓_I✓_S✓_P✓_ r✓_e✓_a✓_d✓_e✓_r✓_)✓_
- c✓_t✓_r✓_l✓_-✓_C✓_ g✓_o✓_t✓_o✓_ t✓_o✓_p✓_ l✓_e✓_v✓_e✓_l✓_
- c✓_t✓_r✓_l✓_-✓_G✓_ c✓_l✓_e✓_a✓_n✓_u✓_p✓_ a✓_n✓_d✓_ r✓_e✓_t✓_u✓_r✓_n✓_ o✓_n✓_e✓_ l✓_e✓_v✓_e✓_l✓_
- c✓_t✓_r✓_l✓_-✓_Z✓_ e✓_n✓_d✓_ o✓_f✓_ f✓_i✓_l✓_e✓_ (✓_r✓_e✓_t✓_u✓_r✓_n✓_s✓_ o✓_n✓_e✓_ l✓_e✓_v✓_e✓_l✓_ o✓_r✓_ e✓_x✓_i✓_t✓_s✓_ p✓_r✓_o✓_g✓_r✓_a✓_m✓_)✓_
- c✓_t✓_r✓_l✓_-✓_P✓_ p✓_r✓_o✓_c✓_e✓_e✓_d✓_ (✓_c✓_o✓_n✓_t✓_i✓_n✓_u✓_e✓_)✓_
- c✓_t✓_r✓_l✓_-✓_T✓_ p✓_r✓_i✓_n✓_t✓_ i✓_n✓_f✓_o✓_r✓_m✓_a✓_t✓_i✓_o✓_n✓_ (✓_a✓_d✓_d✓_e✓_d✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_ b✓_y✓_ T✓_A✓_A✓_)✓_
-
- T✓_h✓_e✓_ f✓_o✓_l✓_l✓_o✓_w✓_i✓_n✓_g✓_ c✓_o✓_n✓_t✓_r✓_o✓_l✓_ c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_s✓_ c✓_a✓_n✓_ b✓_e✓_ t✓_y✓_p✓_e✓_d✓_ w✓_h✓_i✓_l✓_e✓_ X✓_L✓_I✓_S✓_P✓_ i✓_s✓_
- e✓_x✓_e✓_c✓_u✓_t✓_i✓_n✓_g✓_:✓_
-
- c✓_t✓_r✓_l✓_-✓_B✓_ B✓_R✓_E✓_A✓_K✓_ -✓_-✓_ e✓_n✓_t✓_e✓_r✓_ b✓_r✓_e✓_a✓_k✓_ l✓_o✓_o✓_p✓_
- c✓_t✓_r✓_l✓_-✓_S✓_ P✓_a✓_u✓_s✓_e✓_ u✓_n✓_t✓_i✓_l✓_ a✓_n✓_o✓_t✓_h✓_e✓_r✓_ k✓_e✓_y✓_ i✓_s✓_ s✓_t✓_r✓_u✓_c✓_k✓_
- c✓_t✓_r✓_l✓_-✓_C✓_ g✓_o✓_ t✓_o✓_ t✓_o✓_p✓_ l✓_e✓_v✓_e✓_l✓_ (✓_i✓_f✓_ l✓_u✓_c✓_k✓_y✓_:✓_ c✓_t✓_r✓_l✓_-✓_B✓_,✓_c✓_t✓_r✓_l✓_-✓_C✓_ i✓_s✓_ s✓_a✓_f✓_e✓_r✓_)✓_
- c✓_t✓_r✓_l✓_-✓_T✓_ p✓_r✓_i✓_n✓_t✓_ i✓_n✓_f✓_o✓_r✓_m✓_a✓_t✓_i✓_o✓_n✓_
-
- I✓_f✓_ t✓_h✓_e✓_ g✓_l✓_o✓_b✓_a✓_l✓_ v✓_a✓_r✓_i✓_a✓_b✓_l✓_e✓_ *✓_d✓_o✓_s✓_-✓_i✓_n✓_p✓_u✓_t✓_*✓_ i✓_s✓_ s✓_e✓_t✓_ n✓_o✓_n✓_-✓_n✓_i✓_l✓_,✓_ D✓_O✓_S✓_ i✓_s✓_ u✓_s✓_e✓_d✓_ t✓_o✓_ r✓_e✓_a✓_d✓_
- e✓_n✓_t✓_i✓_r✓_e✓_ i✓_n✓_p✓_u✓_t✓_ l✓_i✓_n✓_e✓_s✓_.✓_ O✓_p✓_e✓_r✓_a✓_t✓_i✓_o✓_n✓_ t✓_h✓_i✓_s✓_ w✓_a✓_y✓_ i✓_s✓_ c✓_o✓_n✓_v✓_e✓_n✓_i✓_e✓_n✓_t✓_ i✓_f✓_ c✓_e✓_r✓_t✓_a✓_i✓_n✓_ D✓_O✓_S✓_
- u✓_t✓_i✓_l✓_i✓_t✓_i✓_e✓_s✓_,✓_ s✓_u✓_c✓_h✓_ a✓_s✓_ C✓_E✓_D✓_,✓_ a✓_r✓_e✓_ u✓_s✓_e✓_d✓_,✓_ o✓_r✓_ i✓_f✓_ X✓_L✓_I✓_S✓_P✓_ i✓_s✓_ r✓_u✓_n✓_ u✓_n✓_d✓_e✓_r✓_ a✓_n✓_ e✓_d✓_i✓_t✓_o✓_r✓_
- l✓_i✓_k✓_e✓_ E✓_P✓_S✓_I✓_L✓_O✓_N✓_.✓_ I✓_n✓_ t✓_h✓_i✓_s✓_ c✓_a✓_s✓_e✓_,✓_ n✓_o✓_r✓_m✓_a✓_l✓_ c✓_o✓_m✓_m✓_a✓_n✓_d✓_ l✓_i✓_n✓_e✓_ e✓_d✓_i✓_t✓_i✓_n✓_g✓_ i✓_s✓_ a✓_v✓_a✓_i✓_l✓_a✓_b✓_l✓_e✓_,✓_
- b✓_u✓_t✓_ t✓_h✓_e✓_ c✓_o✓_n✓_t✓_r✓_o✓_l✓_ k✓_e✓_y✓_s✓_ w✓_i✓_l✓_l✓_ n✓_o✓_t✓_ w✓_o✓_r✓_k✓_ (✓_i✓_n✓_ p✓_a✓_r✓_t✓_i✓_c✓_u✓_l✓_a✓_r✓_,✓_ c✓_t✓_r✓_l✓_-✓_C✓_ w✓_i✓_l✓_l✓_ c✓_a✓_u✓_s✓_e✓_
-
-
-
-
-
-
-
- XLISP 2.0 XLISP COMMAND LOOP Page 4
-
-
- t✓_h✓_e✓_ p✓_r✓_o✓_g✓_r✓_a✓_m✓_ t✓_o✓_ e✓_x✓_i✓_t✓_!✓_)✓_.✓_ U✓_s✓_e✓_ t✓_h✓_e✓_ X✓_L✓_I✓_S✓_P✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_s✓_ t✓_o✓_p✓_-✓_l✓_e✓_v✓_e✓_l✓_,✓_ c✓_l✓_e✓_a✓_n✓_-✓_u✓_p✓_,✓_
- a✓_n✓_d✓_ c✓_o✓_n✓_t✓_i✓_n✓_u✓_e✓_ i✓_n✓_s✓_t✓_e✓_a✓_d✓_ o✓_f✓_ c✓_t✓_r✓_l✓_-✓_C✓_,✓_ c✓_t✓_r✓_l✓_-✓_G✓_,✓_ a✓_n✓_d✓_ c✓_t✓_r✓_l✓_-✓_P✓_.✓_
-
-
-
-
-
-
-
- XLISP 2.0 BREAK COMMAND LOOP Page 5
-
-
-
- BREAK COMMAND LOOP
-
- When XLISP encounters an error while evaluating an expression, it
- attempts to handle the error in the following way:
-
- If the symbol '*breakenable*' is true, the message corresponding to
- the error is printed. If the error is correctable, the correction
- message is printed.
-
- If the symbol '*tracenable*' is true, a trace back is printed. The
- number of entries printed depends on the value of the symbol
- '*tracelimit*'. If this symbol is set to something other than a
- number, the entire trace back stack is printed.
-
- XLISP then enters a read/eval/print loop to allow the user to examine
- the state of the interpreter in the context of the error. This loop
- differs from the normal top-level read/eval/print loop in that if the
- user invokes the function 'continue', XLISP will continue from a
- correctable error. If the user invokes the function 'clean-up', XLISP
- will abort the break loop and return to the top level or the next
- lower numbered break loop. When in a break loop, XLISP prefixes the
- break level to the normal prompt.
-
- If the symbol '*breakenable*' is NIL, XLISP looks for a surrounding
- errset function. If one is found, XLISP examines the value of the
- print flag. If this flag is true, the error message is printed. In any
- case, XLISP causes the errset function call to return NIL.
-
- If there is no surrounding errset function, XLISP prints the error
- message and returns to the top level.
-
-
-
-
-
-
-
- XLISP 2.0 DATA TYPES Page 6
-
-
-
- DATA TYPES
-
- (✓_M✓_a✓_j✓_o✓_r✓_ m✓_o✓_d✓_i✓_f✓_i✓_c✓_a✓_t✓_i✓_o✓_n✓_s✓_)✓_
-
- There are several different data types available to XLISP
- programmers. Typical implementation limits are shown for 32 bit word
- systems. Values in square brackets apply to 16 bit MS-DOS
- implementations.
-
- All data nodes are effectively cons cells consisting of two pointers
- and and one or two bytes of identification flags (9 or 10 bytes per
- cell). Node space is managed and garbage collected by XLISP. Array and
- string storage is either allocated by the C runtime or managed and
- garbaged collected by XLISP (compilation option). If C does the
- allocation, memory fragmentation can occur. Fragmentation can be
- eliminated by saving the image and restarting XLISP.
-
- lists
- NIL is a special pointer.
- arrays
- The CDR field of an array points to the dynamically allocated
- data array, while the CAR contains the integer length of the
- array. Elements in the data array are pointers to other cells
- [Size limited to 16383]
- character strings
- Implemented like arrays, except string array is byte indexed and
- contains the actual characters. Note that unlike the underlying
- C, the null character (value 0) is valid. [Size limited to 32767]
- symbols
- Implemented as a 4 element array. The elements are value cell,
- function cell, property list, and print name (a character string
- node).
- integers
- Small integers (> -129 and <256) are statically allocated and are
- thus always EQ integers of the same value. The CAR field is used
- to hold the value, which is a 32 bit signed integer.
- characters
- All characters are statically allocated and are thus EQ
- characters of the same value. The CAR field is used to hold the
- value. In XLISP characters are "unsigned" and thus range in value
- from 0 to 255.
- floats
- The CAR and CDR fields hold the value, which is typically a 64
- bit IEEE floating point number.
- objects
- Implemented as an array of instance variable count plus one
- elements. The first element is the object's class, while the
- remaining arguments are the instance variables.
-
-
-
-
-
-
-
- XLISP 2.0 DATA TYPES Page 7
-
-
- streams (file)
- The CAR and CDR fields are used in a system dependent way as a
- file pointer. Files are not kept open across image saves, but the
- standard files are opened automatically during image restores.
- streams (string)
- Implemented as a TCONC list of characters (see page 34).
- subrs (built-in functions)
- The CAR field points to the actual code to execute, while the CDR
- field is an internal pointer to the name of the function.
- fsubrs (special forms)
- Same implementation as subrs.
- closures (user defined functions)
- Implemented as an array of 11 elements:
- 1. name symbol or NIL
- 2. 'lambda or 'macro
- 3. list of required arguments
- 4. optional arguments as list of (<arg> <init> <specified-p>)
- triples.
- 5. &rest argument
- 6. &key arguments as list of (<key> <arg> <init> <specified-p>)
- quadruples.
- 7. &aux arguments as list of (<arg> <init>) pairs.
- 8. function body
- 9. value environment (see page 65 for format)
- 10. function environment
- 11. argument list (unprocessed)
- structures
- Implemented as an array with first element being a pointer to the
- structure name string, and the remaining elements being the
- structure elements.
-
-
-
-
-
-
-
- XLISP 2.0 THE EVALUATOR Page 8
-
-
-
- THE EVALUATOR
-
- The process of evaluation in XLISP:
-
- Strings, integers, characters, floats, objects, arrays, s✓_t✓_r✓_u✓_c✓_t✓_u✓_r✓_e✓_s✓_,✓_
- streams, subrs, fsubrs and closures evaluate to themselves.
-
- Symbols act as variables and are evaluated by retrieving the value
- associated with their current binding.
-
- Lists are evaluated by examining the first element of the list and
- then taking one of the following actions:
-
- If it is a symbol, the functional binding of the symbol is
- retrieved.
-
- If it is a lambda expression, a closure is constructed for the
- function described by the lambda expression.
-
- If it is a subr, fsubr or closure, it stands for itself.
-
- Any other value is an error.
-
- Then, the value produced by the previous step is examined:
-
- If it is a subr or closure, the remaining list elements are
- evaluated and the subr or closure is applied to these evaluated
- expressions.
-
- If it is an fsubr, the fsubr is called with the remaining list
- elements as arguments (unevaluated).
-
- If it is a macro, the macro is expanded with the remaining list
- elements as arguments (unevaluated). The macro expansion is then
- evaluated in place of the original macro call.
-
-
-
-
-
-
-
- XLISP 2.0 HOOK FUNCTIONS Page 9
-
-
-
- HOOK FUNCTIONS
-
- (✓_N✓_e✓_w✓_ s✓_e✓_c✓_t✓_i✓_o✓_n✓_)✓_
-
- The evalhook and applyhook facility are useful for implementing
- debugging programs or just observing the operation of XLISP. It is
- possible to control evaluation of forms in any context.
-
- If the symbol '*evalhook*' is bound to a function closure, then every
- call of eval will call this function. The function takes two
- arguements, the form to be evaluated and execution environment. During
- the execution of this function, *evalhook* (and *applyhook*) are
- dynamically bound to NIL to prevent undesirable recursion. This "hook"
- function returns the result of the evaluation.
-
- If the symbol '*applyhook*' is bound to a function, then every
- function application within an eval will call this function (note that
- the function apply, and others which do not use eval, will not invoke
- the apply hook function). The function takes two arguments, the
- function closure and the argument list (which is already evaluated).
- During execution of this hook function, *applyhook* (and *evalhook*)
- are dynamically bound to NIL to prevent undesired recursion. This
- function is to return the result of the function application.
-
- Note that the hook functions cannot reset *evalhook* or *applyhook* to
- NIL, because upon exit these values will be reset. An excape mechanism
- is provided -- execution of 'top-level', or any error that causes
- return to the top level, will unhook the functions. Applications
- should bind these values either via 'progv', 'evalhook', or
- 'applyhook'.
-
- The functions 'evalhook' and 'applyhook' allowed for controlled
- application of the hook functions. The form supplied as an argument to
- 'evalhook', or the function application given to 'applyhook', are not
- hooked themselves, but any subsidiary forms and applications are. In
- addition, by supplying NIL values for the hook functions, 'evalhook'
- can be used to execute a form within a specific environment passed as
- an argument.
-
-
-
-
-
-
-
- XLISP 2.0 LEXICAL CONVENTIONS Page 10
-
-
-
- LEXICAL CONVENTIONS
-
- (✓_M✓_a✓_j✓_o✓_r✓_ e✓_x✓_p✓_a✓_n✓_s✓_i✓_o✓_n✓_ o✓_f✓_ o✓_r✓_i✓_g✓_i✓_n✓_a✓_l✓_ d✓_o✓_c✓_u✓_m✓_e✓_n✓_t✓_)✓_
-
- The following conventions must be followed when entering XLISP
- programs:
-
- Comments in XLISP code begin with a semi-colon character and continue
- to the end of the line.
-
- Except when escape sequences are used, symbol names in XLISP can
- consist of any sequence of non-blank printable characters except the
- terminating macro characters:
-
- ( ) ' ` , " ;
-
- and the escape characters:
-
- \ |
-
- In addition, the first character may not be '#' (non-terminating macro
- character), nor may the symbol have identical syntax with an integer
- or floating point literal. Uppercase and lowercase characters are not
- distinguished within symbol names. All lowercase characters are mapped
- to uppercase on input.
-
- Any printing character, including whitespace, may be part of a symbol
- name when escape characters are used. The backslash escapes the
- following character, while multiple characters can be escaped by
- placing them between vertical bars. At all times the backslash must be
- used to escape either escape characters.
-
- For semantic reasons, certain chararacter sequences should/can never
- be used as symbols in XLISP. A single period is used to denote dotted
- lists. The symbol NIL represents an empty list. Symbols starting with
- a colon are keywords, and will always evaluate to themselves. Thus
- they should not be used as regular symbols. The symbol T is also
- reserved for use as the truth value.
-
- Integer literals consist of a sequence of digits optionally beginning
- with a sign ('+' or '-'). The range of values an integer can represent
- is limited by the size of a C 'long' on the machine on which XLISP is
- running.
-
- Floating point literals consist of a sequence of digits optionally
- beginning with a sign ('+' or '-') and including one or both of an
- embedded decimal point or a trailing exponent. The optional exponent
- is denoted by an 'E' followed by an optional sign and one or more
- digits. The range of values a floating point number can represent is
-
-
-
-
-
-
-
- XLISP 2.0 LEXICAL CONVENTIONS Page 11
-
-
- limited by the size of a C 'float' ('double' on machines with 32 bit
- addresses) on the machine on which XLISP is running.
-
- Integer and floating point literals cannot have embedded escape
- characters. If they do, they are treated as symbols. Thus '12\3' is a
- symbol even though it would appear to be identical to '123'.
-
- Character literals are handled via the #\ read-macro construct:
-
- #\<char> == the ASCII code of the printing character
- #\newline == ASCII linefeed character
- #\space == ASCII space character
- #\rubout == ASCII rubout (DEL)
- #\C-<char> == ASCII control character
- #\M-<char> == ASCII character with msb set (Meta character)
- #\M-C-<char> == ASCII control character with msb set
-
-
- Literal strings are sequences of characters surrounded by double
- quotes (the " read-macro). Within quoted strings the '\' character is
- used to allow non-printable characters to be included. The codes
- recognized are:
-
- \\ means the character '\'
- \n means newline
- \t means tab
- \r means return
- \f means form feed
- \nnn means the character whose octal code is nnn
-
-
-
-
-
-
-
- XLISP 2.0 READTABLES Page 12
-
-
-
- READTABLES
-
- (✓_M✓_a✓_j✓_o✓_r✓_ m✓_o✓_d✓_i✓_f✓_i✓_c✓_a✓_t✓_i✓_o✓_n✓_s✓_)✓_
-
- The behaviour of the reader is controlled by a data structure called a
- "readtable". The reader uses the symbol *readtable* to locate the
- current readtable. This table controls the interpretation of input
- characters -- if it is changed then the section LEXICAL CONVENTIONS
- may not apply. The readtable is an array with 256 entries, one for
- each of the extended ASCII character codes. Each entry contains one of
- the following values, with the initial entries assigned to the values
- indicated:
-
- :white-space A whitespace character - tab, cr, lf, ff,
- space
- (:tmacro . fun) terminating readmacro - ( ) " , ; ' `
- (:nmacro . fun) non-terminating readmacro - #
- :sescape Single escape character - \
- :mescape Multiple escape character - |
- :constituent Indicating a symbol constituent (all printing
- characters not listed above)
- nil Indicating an invalid character (everything
- else)
-
- In the case of :TMACRO and :NMACRO, the "fun" component is a function.
- This can either be a built-in readmacro function or a lambda
- expression. The function takes two parameters. The first is the input
- stream and the second is the character that caused the invocation of
- the readmacro. The readmacro function should return NIL to indicate
- that the character should be treated as white space or a value consed
- with NIL to indicate that the readmacro should be treated as an
- occurance of the specified value. Of course, the readmacro code is
- free to read additional characters from the input stream. A :nmacro is
- a symbol constituent except as the first character of a symbol.
-
- As an example, the following read macro allows the square brackets to
- be used as a more visibly appealing alternative to the SEND function:
-
-
-
-
-
-
-
- XLISP 2.0 READTABLES Page 13
-
-
- (setf (aref *readtable* (char-int #\[)) ; #\[ table entry
- (cons :tmacro
- (lambda (f c &aux ex) ; second arg is not used
- (do ()
- ((eq (peek-char t f) #\]))
- (setf ex (append ex (list (read f)))))
- (read-char f) ; toss the trailing #\]
- (cons (cons 'send ex) nil))))
-
- (setf (aref *readtable* (char-int #\]))
- (cons :tmacro
- (lambda (f c)
- (error "misplaced right bracket"))))
-
-
- XLISP defines several useful read macros:
-
- '<expr> == (quote <expr>)
- `<expr> == (backquote <expr>)
- ,<expr> == (comma <expr>)
- ,@<expr> == (comma-at <expr>)
- #'<expr> == (function <expr>)
- #(<expr>...) == an array of the specified expressions
- #S(<structtype> [<slotname> <value>]...)
- == structure of specified type and initial
- values
- #.<expr> == result of evaluating <expr>
- #x<hdigits> == a hexadecimal number (0-9,A-F)
- #o<odigits> == an octal number (0-7)
- #b<bdigits> == a binary number (0-1)
- #| |# == a comment
- #:<symbol> == an uninterned symbol
-
-
-
-
-
-
-
- XLISP 2.0 LAMBDA LISTS Page 14
-
-
-
- LAMBDA LISTS
-
- There are several forms in XLISP that require that a "lambda list" be
- specified. A lambda list is a definition of the arguments accepted by
- a function. There are four different types of arguments.
-
- The lambda list starts with required arguments. Required arguments
- must be specified in every call to the function.
-
- The required arguments are followed by the &optional arguments.
- Optional arguments may be provided or omitted in a call. An
- initialization expression may be specified to provide a default value
- for an &optional argument if it is omitted from a call. If no
- initialization expression is specified, an omitted argument is
- initialized to NIL. It is also possible to provide the name of a
- 'supplied-p' variable that can be used to determine if a call provided
- a value for the argument or if the initialization expression was used.
- If specified, the supplied-p variable will be bound to T if a value
- was specified in the call and NIL if the default value was used.
-
- The &optional arguments are followed by the &rest argument. The &rest
- argument gets bound to the remainder of the argument list after the
- required and &optional arguments have been removed.
-
- The &rest argument is followed by the &key arguments. When a keyword
- argument is passed to a function, a pair of values appears in the
- argument list. The first expression in the pair should evaluate to a
- keyword symbol (a symbol that begins with a ':'). The value of the
- second expression is the value of the keyword argument. Like &optional
- arguments, &key arguments can have initialization expressions and
- supplied-p variables. In addition, it is possible to specify the
- keyword to be used in a function call. If no keyword is specified, the
- keyword obtained by adding a ':' to the beginning of the keyword
- argument symbol is used. In other words, if the keyword argument
- symbol is 'foo', the keyword will be ':foo'. T✓_h✓_e✓_ &✓_a✓_l✓_l✓_o✓_w✓_-✓_o✓_t✓_h✓_e✓_r✓_-✓_k✓_e✓_y✓_s✓_
- m✓_a✓_r✓_k✓_e✓_r✓_ i✓_s✓_ i✓_g✓_n✓_o✓_r✓_e✓_d✓_.✓_
-
- The &key arguments are followed by the &aux variables. These are local
- variables that are bound during the evaluation of the function body.
- It is possible to have initialization expressions for the &aux
- variables.
-
-
-
-
-
-
-
- XLISP 2.0 LAMBDA LISTS Page 15
-
-
- Here is the complete syntax for lambda lists:
-
- (<rarg>...
- [&optional [<oarg> | (<oarg> [<init> [<svar>]])]...]
- [&rest <rarg>]
- [&key
- [<karg> | ([<karg> | (<key> <karg>)] [<init> [<svar>]])] ...
- &allow-other-keys]
- [&aux [<aux> | (<aux> [<init>])]...])
-
- where:
-
- <rarg> is a required argument symbol
- <oarg> is an &optional argument symbol
- <rarg> is the &rest argument symbol
- <karg> is a &key argument symbol
- <key> is a keyword symbol
- <aux> is an auxiliary variable symbol
- <init> is an initialization expression
- <svar> is a supplied-p variable symbol
-
-
-
-
-
-
-
- XLISP 2.0 OBJECTS Page 16
-
-
-
- OBJECTS
-
- Definitions:
-
- selector - a symbol used to select an appropriate method
- message - a selector and a list of actual arguments
- method - the code that implements a message
-
- Since XLISP was created to provide a simple basis for experimenting
- with object-oriented programming, one of the primitive data types
- included is 'object'. In XLISP, an object consists of a data structure
- containing a pointer to the object's class as well as an array
- containing the values of the object's instance variables.
-
- Officially, there is no way to see inside an object (look at the
- values of its instance variables). The only way to communicate with an
- object is by sending it a message.
-
- You can send a message to an object using the 'send' function. This
- function takes the object as its first argument, the message selector
- as its second argument (which must be a symbol) and the message
- arguments as its remaining arguments.
-
- The 'send' function determines the class of the receiving object and
- attempts to find a method corresponding to the message selector in the
- set of messages defined for that class. If the message is not found in
- the object's class and the class has a super-class, the search
- continues by looking at the messages defined for the super-class. This
- process continues from one super-class to the next until a method for
- the message is found. If no method is found, an error occurs.
-
- T✓_o✓_ p✓_e✓_r✓_f✓_o✓_r✓_m✓_ a✓_ m✓_e✓_t✓_h✓_o✓_d✓_ l✓_o✓_o✓_k✓_u✓_p✓_ s✓_t✓_a✓_r✓_t✓_i✓_n✓_g✓_ w✓_i✓_t✓_h✓_ t✓_h✓_e✓_ o✓_b✓_j✓_e✓_c✓_t✓_'✓_s✓_ s✓_u✓_p✓_e✓_r✓_c✓_l✓_a✓_s✓_s✓_
- r✓_a✓_t✓_h✓_e✓_r✓_ t✓_h✓_a✓_n✓_ i✓_t✓_s✓_ c✓_l✓_a✓_s✓_s✓_,✓_ u✓_s✓_e✓_ t✓_h✓_e✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_ '✓_s✓_e✓_n✓_d✓_-✓_s✓_u✓_p✓_e✓_r✓_'✓_.✓_ This allows a
- subclass to invoke a standard method in its parent class even though
- it overrides that method with its own specialized version.
-
- When a method is found, the evaluator binds the receiving object to
- the symbol 'self' and evaluates the method using the remaining
- elements of the original list as arguments to the method. These
- arguments are always evaluated prior to being bound to their
- corresponding formal arguments. The result of evaluating the method
- becomes the result of the expression.
-
- T✓_w✓_o✓_ o✓_b✓_j✓_e✓_c✓_t✓_s✓_,✓_ b✓_o✓_t✓_h✓_ c✓_l✓_a✓_s✓_s✓_e✓_s✓_,✓_ a✓_r✓_e✓_ p✓_r✓_e✓_d✓_e✓_f✓_i✓_n✓_e✓_d✓_:✓_ O✓_b✓_j✓_e✓_c✓_t✓_ a✓_n✓_d✓_ C✓_l✓_a✓_s✓_s✓_.✓_ B✓_o✓_t✓_h✓_
- O✓_b✓_j✓_e✓_c✓_t✓_ a✓_n✓_d✓_ C✓_l✓_a✓_s✓_s✓_ a✓_r✓_e✓_ o✓_f✓_ c✓_l✓_a✓_s✓_s✓_ C✓_l✓_a✓_s✓_s✓_.✓_ T✓_h✓_e✓_ s✓_u✓_p✓_e✓_r✓_c✓_l✓_a✓_s✓_s✓_ o✓_f✓_ C✓_l✓_a✓_s✓_s✓_ i✓_s✓_
- O✓_b✓_j✓_e✓_c✓_t✓_,✓_ w✓_h✓_i✓_l✓_e✓_ O✓_b✓_j✓_e✓_c✓_t✓_ h✓_a✓_s✓_ n✓_o✓_ s✓_u✓_p✓_e✓_r✓_c✓_l✓_a✓_s✓_s✓_.✓_ T✓_y✓_p✓_i✓_c✓_a✓_l✓_ u✓_s✓_e✓_ i✓_s✓_ t✓_o✓_ c✓_r✓_e✓_a✓_t✓_e✓_ n✓_e✓_w✓_
- c✓_l✓_a✓_s✓_s✓_e✓_s✓_ (✓_b✓_y✓_ s✓_e✓_n✓_d✓_i✓_n✓_g✓_ :✓_n✓_e✓_w✓_ t✓_o✓_ C✓_l✓_a✓_s✓_s✓_)✓_ t✓_o✓_ r✓_e✓_p✓_r✓_e✓_s✓_e✓_n✓_t✓_ a✓_p✓_p✓_l✓_i✓_c✓_a✓_t✓_i✓_o✓_n✓_ o✓_b✓_j✓_e✓_c✓_t✓_s✓_.✓_
- O✓_b✓_j✓_e✓_c✓_t✓_s✓_ o✓_f✓_ t✓_h✓_e✓_s✓_e✓_ c✓_l✓_a✓_s✓_s✓_e✓_s✓_,✓_ c✓_r✓_e✓_a✓_t✓_e✓_d✓_ b✓_y✓_ s✓_e✓_n✓_d✓_i✓_n✓_g✓_ :✓_n✓_e✓_w✓_ t✓_o✓_ t✓_h✓_e✓_ a✓_p✓_p✓_r✓_o✓_p✓_r✓_i✓_a✓_t✓_e✓_
- n✓_e✓_w✓_ c✓_l✓_a✓_s✓_s✓_,✓_ a✓_r✓_e✓_ s✓_u✓_b✓_c✓_l✓_a✓_s✓_s✓_e✓_s✓_ o✓_f✓_ O✓_b✓_j✓_e✓_c✓_t✓_.✓_ T✓_h✓_e✓_ O✓_b✓_j✓_e✓_c✓_t✓_ m✓_e✓_t✓_h✓_o✓_d✓_ :✓_s✓_h✓_o✓_w✓_ c✓_a✓_n✓_ b✓_e✓_
- u✓_s✓_e✓_d✓_ t✓_o✓_ v✓_i✓_e✓_w✓_ t✓_h✓_e✓_ c✓_o✓_n✓_t✓_e✓_n✓_t✓_s✓_ o✓_f✓_ a✓_n✓_y✓_ o✓_b✓_j✓_e✓_c✓_t✓_.✓_
-
-
-
-
-
-
-
- XLISP 2.0 OBJECTS Page 17
-
-
-
- THE 'Object' CLASS
-
- Object THE TOP OF THE CLASS HEIRARCHY
-
- Messages:
-
- :show SHOW AN OBJECT'S INSTANCE VARIABLES
- returns the object
-
- :class RETURN THE CLASS OF AN OBJECT
- returns the class of the object
-
- :✓_p✓_r✓_i✓_n✓_1✓_ [✓_<✓_s✓_t✓_r✓_e✓_a✓_m✓_>✓_]✓_ P✓_R✓_I✓_N✓_T✓_ T✓_H✓_E✓_ O✓_B✓_J✓_E✓_C✓_T✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ t✓_h✓_e✓_ o✓_b✓_j✓_e✓_c✓_t✓_
-
- :isnew THE DEFAULT OBJECT INITIALIZATION ROUTINE
- returns the object
-
- :✓_s✓_u✓_p✓_e✓_r✓_c✓_l✓_a✓_s✓_s✓_ G✓_E✓_T✓_ T✓_H✓_E✓_ S✓_U✓_P✓_E✓_R✓_C✓_L✓_A✓_S✓_S✓_ O✓_F✓_ T✓_H✓_E✓_ O✓_B✓_J✓_E✓_C✓_T✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ N✓_I✓_L✓_
- (✓_D✓_e✓_f✓_i✓_n✓_e✓_d✓_ i✓_n✓_ c✓_l✓_a✓_s✓_s✓_e✓_s✓_.✓_l✓_s✓_p✓_,✓_ s✓_e✓_e✓_ :✓_s✓_u✓_p✓_e✓_r✓_c✓_l✓_a✓_s✓_s✓_ b✓_e✓_l✓_o✓_w✓_)✓_
-
- :✓_i✓_s✓_m✓_e✓_m✓_b✓_e✓_r✓_o✓_f✓_ <✓_c✓_l✓_a✓_s✓_s✓_>✓_ C✓_L✓_A✓_S✓_S✓_ M✓_E✓_M✓_B✓_E✓_R✓_S✓_H✓_I✓_P✓_
- <✓_c✓_l✓_a✓_s✓_s✓_>✓_ c✓_l✓_a✓_s✓_s✓_ n✓_a✓_m✓_e✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ T✓_ i✓_f✓_ o✓_b✓_j✓_e✓_c✓_t✓_ m✓_e✓_m✓_b✓_e✓_r✓_ o✓_f✓_ c✓_l✓_a✓_s✓_s✓_,✓_ e✓_l✓_s✓_e✓_ N✓_I✓_L✓_
- (✓_d✓_e✓_f✓_i✓_n✓_e✓_d✓_ i✓_n✓_ c✓_l✓_a✓_s✓_s✓_e✓_s✓_.✓_l✓_s✓_p✓_)✓_
-
- :✓_i✓_s✓_k✓_i✓_n✓_d✓_o✓_f✓_ <✓_c✓_l✓_a✓_s✓_s✓_>✓_ C✓_L✓_A✓_S✓_S✓_ M✓_E✓_M✓_B✓_E✓_R✓_S✓_H✓_I✓_P✓_
- <✓_c✓_l✓_a✓_s✓_s✓_>✓_ c✓_l✓_a✓_s✓_s✓_ n✓_a✓_m✓_e✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ T✓_ i✓_f✓_ o✓_b✓_j✓_e✓_c✓_t✓_ m✓_e✓_m✓_b✓_e✓_r✓_ o✓_f✓_ c✓_l✓_a✓_s✓_s✓_ o✓_f✓_ s✓_u✓_b✓_c✓_l✓_a✓_s✓_s✓_ o✓_f✓_
- c✓_l✓_a✓_s✓_s✓_,✓_ e✓_l✓_s✓_e✓_ N✓_I✓_L✓_
- (✓_d✓_e✓_f✓_i✓_n✓_e✓_d✓_ i✓_n✓_ c✓_l✓_a✓_s✓_s✓_e✓_s✓_.✓_l✓_s✓_p✓_)✓_
-
- :✓_r✓_e✓_s✓_p✓_o✓_n✓_d✓_s✓_t✓_o✓_ <✓_s✓_e✓_l✓_>✓_ S✓_E✓_L✓_E✓_C✓_T✓_O✓_R✓_ K✓_N✓_O✓_W✓_L✓_E✓_D✓_G✓_E✓_
- <✓_s✓_e✓_l✓_>✓_ m✓_e✓_s✓_s✓_a✓_g✓_e✓_ s✓_e✓_l✓_e✓_c✓_t✓_o✓_r✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ T✓_ i✓_f✓_ o✓_b✓_j✓_e✓_c✓_t✓_ r✓_e✓_s✓_p✓_o✓_n✓_d✓_s✓_ t✓_o✓_ m✓_e✓_s✓_s✓_a✓_g✓_e✓_ s✓_e✓_l✓_e✓_c✓_t✓_o✓_r✓_,✓_
- e✓_l✓_s✓_e✓_ N✓_I✓_L✓_.✓_
- (✓_d✓_e✓_f✓_i✓_n✓_e✓_d✓_ i✓_n✓_ c✓_l✓_a✓_s✓_s✓_e✓_s✓_.✓_l✓_s✓_p✓_)✓_
-
- :✓_s✓_t✓_o✓_r✓_e✓_o✓_n✓_ R✓_E✓_A✓_D✓_ R✓_E✓_P✓_R✓_E✓_S✓_E✓_N✓_T✓_A✓_T✓_I✓_O✓_N✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ a✓_ l✓_i✓_s✓_t✓_,✓_ t✓_h✓_a✓_t✓_ w✓_h✓_e✓_n✓_ e✓_x✓_e✓_c✓_u✓_t✓_e✓_d✓_ w✓_i✓_l✓_l✓_ c✓_r✓_e✓_a✓_t✓_e✓_ a✓_ c✓_o✓_p✓_y✓_
- o✓_f✓_ t✓_h✓_e✓_ o✓_b✓_j✓_e✓_c✓_t✓_.✓_ O✓_n✓_l✓_y✓_ w✓_o✓_r✓_k✓_s✓_ f✓_o✓_r✓_ m✓_e✓_m✓_b✓_e✓_r✓_s✓_ o✓_f✓_
- c✓_l✓_a✓_s✓_s✓_e✓_s✓_ c✓_r✓_e✓_a✓_t✓_e✓_d✓_ w✓_i✓_t✓_h✓_ d✓_e✓_f✓_c✓_l✓_a✓_s✓_s✓_.✓_
- (✓_d✓_e✓_f✓_i✓_n✓_e✓_d✓_ i✓_n✓_ c✓_l✓_a✓_s✓_s✓_e✓_s✓_.✓_l✓_s✓_p✓_)✓_
-
-
-
-
-
-
-
- XLISP 2.0 OBJECTS Page 18
-
-
-
- THE 'Class' CLASS
-
- Class THE CLASS OF ALL OBJECT CLASSES (including itself)
-
- Messages:
-
- :new CREATE A NEW INSTANCE OF A CLASS
- returns the new class object
-
- :isnew <ivars> [<cvars> [<super>]] INITIALIZE A NEW CLASS
- <ivars> the list of instance variable symbol
- <cvars> the list of class variable symbols
- <super> the superclass (default is Object)
- returns the new class object
-
- :answer <msg> <fargs> <code> ADD A MESSAGE TO A CLASS
- <msg> the message symbol
- <fargs> the formal argument list (lambda list)
- <code> a list of executable expressions
- returns the object
-
- :✓_s✓_u✓_p✓_e✓_r✓_c✓_l✓_a✓_s✓_s✓_ G✓_E✓_T✓_ T✓_H✓_E✓_ S✓_U✓_P✓_E✓_R✓_C✓_L✓_A✓_S✓_S✓_ O✓_F✓_ T✓_H✓_E✓_ O✓_B✓_J✓_E✓_C✓_T✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ t✓_h✓_e✓_ s✓_u✓_p✓_e✓_r✓_c✓_l✓_a✓_s✓_s✓_ (✓_o✓_f✓_ t✓_h✓_e✓_ c✓_l✓_a✓_s✓_s✓_)✓_
- (✓_d✓_e✓_f✓_i✓_n✓_e✓_d✓_ i✓_n✓_ c✓_l✓_a✓_s✓_s✓_e✓_s✓_.✓_l✓_s✓_p✓_)✓_
-
- :✓_m✓_e✓_s✓_s✓_a✓_g✓_e✓_s✓_ G✓_E✓_T✓_ T✓_H✓_E✓_ L✓_I✓_S✓_T✓_ O✓_F✓_ M✓_E✓_S✓_S✓_A✓_G✓_E✓_S✓_ O✓_F✓_ T✓_H✓_E✓_ C✓_L✓_A✓_S✓_S✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ a✓_s✓_s✓_o✓_c✓_i✓_a✓_t✓_i✓_o✓_n✓_ l✓_i✓_s✓_t✓_ o✓_f✓_ m✓_e✓_s✓_s✓_a✓_g✓_e✓_ s✓_e✓_l✓_e✓_c✓_t✓_o✓_r✓_s✓_ a✓_n✓_d✓_
- c✓_l✓_o✓_s✓_u✓_r✓_e✓_s✓_ f✓_o✓_r✓_ m✓_e✓_s✓_s✓_a✓_g✓_e✓_s✓_.✓_
- (✓_d✓_e✓_f✓_i✓_n✓_e✓_d✓_ i✓_n✓_ c✓_l✓_a✓_s✓_s✓_e✓_s✓_.✓_l✓_s✓_p✓_)✓_
-
- :✓_s✓_t✓_o✓_r✓_e✓_o✓_n✓_ R✓_E✓_A✓_D✓_ R✓_E✓_P✓_R✓_E✓_S✓_E✓_N✓_T✓_A✓_T✓_I✓_O✓_N✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ a✓_ l✓_i✓_s✓_t✓_,✓_ t✓_h✓_a✓_t✓_ w✓_h✓_e✓_n✓_ e✓_x✓_e✓_c✓_u✓_t✓_e✓_d✓_ w✓_i✓_l✓_l✓_ r✓_e✓_-✓_c✓_r✓_e✓_a✓_t✓_e✓_ t✓_h✓_e✓_
- c✓_l✓_a✓_s✓_s✓_ a✓_n✓_d✓_ i✓_t✓_s✓_ m✓_e✓_t✓_h✓_o✓_d✓_s✓_.✓_
- (✓_d✓_e✓_f✓_i✓_n✓_e✓_d✓_ i✓_n✓_ c✓_l✓_a✓_s✓_s✓_e✓_s✓_.✓_l✓_s✓_p✓_)✓_
-
- When a new instance of a class is created by sending the message
- ':new' to an existing class, the message ':isnew' followed by whatever
- parameters were passed to the ':new' message is sent to the newly
- created object. T✓_h✓_e✓_r✓_e✓_f✓_o✓_r✓_e✓_,✓_ w✓_h✓_e✓_n✓_ a✓_ n✓_e✓_w✓_ c✓_l✓_a✓_s✓_s✓_ i✓_s✓_ c✓_r✓_e✓_a✓_t✓_e✓_d✓_ b✓_y✓_ s✓_e✓_n✓_d✓_i✓_n✓_g✓_
- '✓_:✓_n✓_e✓_w✓_'✓_ t✓_o✓_ c✓_l✓_a✓_s✓_s✓_ '✓_C✓_l✓_a✓_s✓_s✓_'✓_ t✓_h✓_e✓_ m✓_e✓_s✓_s✓_a✓_g✓_e✓_ '✓_:✓_i✓_s✓_n✓_e✓_w✓_'✓_ i✓_s✓_ s✓_e✓_n✓_t✓_ t✓_o✓_ C✓_l✓_a✓_s✓_s✓_
- a✓_u✓_t✓_o✓_m✓_a✓_t✓_i✓_c✓_a✓_l✓_l✓_y✓_.✓_ T✓_o✓_ c✓_r✓_e✓_a✓_t✓_e✓_ a✓_ n✓_e✓_w✓_ c✓_l✓_a✓_s✓_s✓_,✓_ a✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_ o✓_f✓_ t✓_h✓_e✓_ f✓_o✓_l✓_l✓_o✓_w✓_i✓_n✓_g✓_
- f✓_o✓_r✓_m✓_a✓_t✓_ i✓_s✓_ u✓_s✓_e✓_d✓_:✓_
- (✓_s✓_e✓_t✓_q✓_ <✓_n✓_e✓_w✓_c✓_l✓_a✓_s✓_s✓_n✓_a✓_m✓_e✓_>✓_ (✓_s✓_e✓_n✓_d✓_ C✓_l✓_a✓_s✓_s✓_ :✓_n✓_e✓_w✓_ <✓_i✓_v✓_a✓_r✓_s✓_>✓_ [✓_<✓_c✓_v✓_a✓_r✓_s✓_>✓_ [✓_<✓_s✓_u✓_p✓_e✓_r✓_>✓_]✓_]✓_)✓_)✓_
-
- When a new class is created, an optional parameter may be specified
- indicating the superclass of the new class. If this parameter is
- omitted, the new class will be a subclass of 'Object'. A class
- inherits all instance variables, class variables, and methods from its
- super-class.
-
-
-
-
-
-
-
- XLISP 2.0 OBJECTS Page 19
-
-
- I✓_N✓_S✓_T✓_A✓_N✓_C✓_E✓_ V✓_A✓_R✓_I✓_A✓_B✓_L✓_E✓_S✓_ O✓_F✓_ C✓_L✓_A✓_S✓_S✓_ '✓_C✓_L✓_A✓_S✓_S✓_'✓_:✓_
-
- M✓_E✓_S✓_S✓_A✓_G✓_E✓_S✓_ -✓_ A✓_n✓_ a✓_s✓_s✓_o✓_c✓_i✓_a✓_t✓_i✓_o✓_n✓_ l✓_i✓_s✓_t✓_ o✓_f✓_ m✓_e✓_s✓_s✓_a✓_g✓_e✓_ n✓_a✓_m✓_e✓_s✓_ a✓_n✓_d✓_ c✓_l✓_o✓_s✓_u✓_r✓_e✓_s✓_
- i✓_m✓_p✓_l✓_e✓_m✓_e✓_n✓_t✓_i✓_n✓_g✓_ t✓_h✓_e✓_ m✓_e✓_s✓_s✓_a✓_g✓_e✓_s✓_.✓_
-
- I✓_V✓_A✓_R✓_S✓_ -✓_ L✓_i✓_s✓_t✓_ o✓_f✓_ n✓_a✓_m✓_e✓_s✓_ o✓_f✓_ i✓_n✓_s✓_t✓_a✓_n✓_c✓_e✓_ v✓_a✓_r✓_i✓_a✓_b✓_l✓_e✓_s✓_.✓_
-
- C✓_V✓_A✓_R✓_S✓_ -✓_ L✓_i✓_s✓_t✓_ o✓_f✓_ n✓_a✓_m✓_e✓_s✓_ o✓_f✓_ c✓_l✓_a✓_s✓_s✓_ v✓_a✓_r✓_i✓_a✓_b✓_l✓_e✓_s✓_.✓_
-
- C✓_V✓_A✓_L✓_ -✓_ L✓_i✓_s✓_t✓_ o✓_f✓_ c✓_l✓_a✓_s✓_s✓_ v✓_a✓_r✓_i✓_a✓_b✓_l✓_e✓_ v✓_a✓_l✓_u✓_e✓_s✓_.✓_
-
- S✓_U✓_P✓_E✓_R✓_C✓_L✓_A✓_S✓_S✓_ -✓_ T✓_h✓_e✓_ s✓_u✓_p✓_e✓_r✓_c✓_l✓_a✓_s✓_s✓_ o✓_f✓_ t✓_h✓_i✓_s✓_ c✓_l✓_a✓_s✓_s✓_ o✓_r✓_ N✓_I✓_L✓_ i✓_f✓_ n✓_o✓_ s✓_u✓_p✓_e✓_r✓_c✓_l✓_a✓_s✓_s✓_
- (✓_o✓_n✓_l✓_y✓_ f✓_o✓_r✓_ c✓_l✓_a✓_s✓_s✓_ O✓_B✓_J✓_E✓_C✓_T✓_)✓_.✓_
-
- I✓_V✓_A✓_R✓_C✓_N✓_T✓_ -✓_ i✓_n✓_s✓_t✓_a✓_n✓_c✓_e✓_ v✓_a✓_r✓_i✓_a✓_b✓_l✓_e✓_s✓_ i✓_n✓_ t✓_h✓_i✓_s✓_ c✓_l✓_a✓_s✓_s✓_ (✓_l✓_e✓_n✓_g✓_t✓_h✓_ o✓_f✓_ I✓_V✓_A✓_R✓_S✓_)✓_
-
- I✓_V✓_A✓_R✓_T✓_O✓_T✓_A✓_L✓_ -✓_ t✓_o✓_t✓_a✓_l✓_ i✓_n✓_s✓_t✓_a✓_n✓_c✓_e✓_ v✓_a✓_r✓_i✓_a✓_b✓_l✓_e✓_s✓_ f✓_o✓_r✓_ t✓_h✓_i✓_s✓_ c✓_l✓_a✓_s✓_s✓_ a✓_n✓_d✓_ a✓_l✓_l✓_
- s✓_u✓_p✓_e✓_r✓_c✓_l✓_a✓_s✓_s✓_e✓_s✓_ o✓_f✓_ t✓_h✓_i✓_s✓_ c✓_l✓_a✓_s✓_s✓_.✓_
-
- P✓_N✓_A✓_M✓_E✓_ -✓_ p✓_r✓_i✓_n✓_t✓_n✓_a✓_m✓_e✓_ s✓_t✓_r✓_i✓_n✓_g✓_ f✓_o✓_r✓_ t✓_h✓_i✓_s✓_ c✓_l✓_a✓_s✓_s✓_.✓_
-
-
-
-
-
-
-
- XLISP 2.0 SYMBOLS Page 20
-
-
-
- SYMBOLS
-
-
-
- ✓_ n✓_i✓_l✓_ -✓_ t✓_h✓_e✓_ e✓_m✓_p✓_t✓_y✓_ l✓_i✓_s✓_t✓_
- ✓_ t✓_ -✓_ t✓_r✓_u✓_t✓_h✓_ v✓_a✓_l✓_u✓_e✓_
- self - the current object (within a method context)
- ✓_ o✓_b✓_j✓_e✓_c✓_t✓_ -✓_ t✓_h✓_e✓_ c✓_l✓_a✓_s✓_s✓_ '✓_O✓_b✓_j✓_e✓_c✓_t✓_'✓_
- ✓_ c✓_l✓_a✓_s✓_s✓_ -✓_ t✓_h✓_e✓_ c✓_l✓_a✓_s✓_s✓_ '✓_C✓_l✓_a✓_s✓_s✓_'✓_
- *obarray* - the object hash table
- *standard-input* - the standard input stream,✓_ s✓_t✓_d✓_i✓_n✓_
- *standard-output* - the standard output stream,✓_ s✓_t✓_d✓_o✓_u✓_t✓_
- *error-output* - the error output stream,✓_ s✓_t✓_d✓_e✓_r✓_r✓_
- *trace-output* - the trace output stream,✓_ d✓_e✓_f✓_a✓_u✓_l✓_t✓_s✓_ t✓_o✓_ s✓_t✓_d✓_e✓_r✓_r✓_
- *debug-io* - the break loop i/o stream,✓_ d✓_e✓_f✓_a✓_u✓_l✓_t✓_s✓_ t✓_o✓_ s✓_t✓_d✓_e✓_r✓_r✓_
- *breakenable* - flag controlling entering break loop on errors
- *tracelist* - list of names of functions to trace
- *tracenable* - enable trace back printout on errors
- *tracelimit* - number of levels of trace back information
- *evalhook* - user substitute for the evaluator function
- *applyhook* - u✓_s✓_e✓_r✓_ s✓_u✓_b✓_s✓_t✓_i✓_t✓_u✓_t✓_e✓_ f✓_o✓_r✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_ a✓_p✓_p✓_l✓_i✓_c✓_a✓_t✓_i✓_o✓_n✓_
- *readtable* - the current readtable
- *unbound* - indicator for unbound symbols
- *gc-flag* - controls the printing of gc messages
- *gc-hook* - function to call after garbage collection
- *integer-format* - format for printing integers ("%d" or "%ld")
- *float-format* - format for printing floats ("%g")
- *print-case* - symbol output case (:upcase or :downcase)
- ✓_ *✓_p✓_r✓_i✓_n✓_t✓_-✓_l✓_e✓_v✓_e✓_l✓_*✓_ -✓_ l✓_i✓_s✓_t✓_ l✓_e✓_v✓_e✓_l✓_s✓_ b✓_e✓_y✓_o✓_n✓_d✓_ t✓_h✓_i✓_s✓_ s✓_e✓_t✓_t✓_i✓_n✓_g✓_ a✓_r✓_e✓_ p✓_r✓_i✓_n✓_t✓_e✓_d✓_ a✓_s✓_
- '✓_#✓_'✓_
- ✓_ *✓_p✓_r✓_i✓_n✓_t✓_-✓_l✓_e✓_n✓_g✓_t✓_h✓_*✓_ -✓_ l✓_i✓_s✓_t✓_s✓_ l✓_o✓_n✓_g✓_e✓_r✓_ t✓_h✓_a✓_n✓_ t✓_h✓_i✓_s✓_ s✓_e✓_t✓_t✓_i✓_n✓_g✓_ a✓_r✓_e✓_ p✓_r✓_i✓_n✓_t✓_e✓_d✓_ a✓_s✓_
- '✓_.✓_.✓_.✓_'✓_
- ✓_ *✓_d✓_o✓_s✓_-✓_i✓_n✓_p✓_u✓_t✓_*✓_ -✓_ u✓_s✓_e✓_ d✓_o✓_s✓_ l✓_i✓_n✓_e✓_ i✓_n✓_p✓_u✓_t✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_ f✓_o✓_r✓_ r✓_e✓_a✓_d✓_.✓_
-
- There are several symbols maintained by the read/eval/print loop. The
- symbols '+', '++', and '+++' are bound to the most recent three input
- expressions. The symbols '*', '**' and '***' are bound to the most
- recent three results. The symbol '-' is bound to the expression
- currently being evaluated. It becomes the value of '+' at the end of
- the evaluation.
-
- I✓_n✓_t✓_e✓_n✓_d✓_e✓_d✓_ t✓_o✓_ b✓_e✓_ a✓_d✓_d✓_e✓_d✓_:✓_
- ✓_ *✓_p✓_r✓_i✓_n✓_t✓_-✓_b✓_a✓_s✓_e✓_*✓_ -✓_ r✓_a✓_d✓_i✓_x✓_ u✓_s✓_e✓_d✓_ i✓_n✓_ p✓_r✓_i✓_n✓_t✓_i✓_n✓_g✓_ i✓_n✓_t✓_e✓_g✓_e✓_r✓_s✓_.✓_
-
-
-
-
-
-
-
- XLISP 2.0 EVALUATION FUNCTIONS Page 21
-
-
-
- EVALUATION FUNCTIONS
-
- (eval <expr>) EVALUATE AN XLISP EXPRESSION
- <expr> the expression to be evaluated
- returns the result of evaluating the expression
-
- (apply <fun> <args>) APPLY A FUNCTION TO A LIST OF ARGUMENTS
- <fun> the function to apply (or function symbol). M✓_a✓_y✓_ n✓_o✓_t✓_ b✓_e✓_
- m✓_a✓_c✓_r✓_o✓_ o✓_r✓_ f✓_s✓_u✓_b✓_r✓_.✓_
- <args> the argument list (✓_u✓_n✓_l✓_i✓_k✓_e✓_ C✓_o✓_m✓_m✓_o✓_n✓_ L✓_i✓_s✓_p✓_,✓_ o✓_n✓_l✓_y✓_ o✓_n✓_e✓_
- a✓_l✓_l✓_o✓_w✓_e✓_d✓_)✓_
- returns the result of applying the function to the arguments
-
- (funcall <fun> <arg>...) CALL A FUNCTION WITH ARGUMENTS
- <fun> the function to call (or function symbol). M✓_a✓_y✓_ n✓_o✓_t✓_ b✓_e✓_
- m✓_a✓_c✓_r✓_o✓_ o✓_r✓_ f✓_s✓_u✓_b✓_r✓_.✓_
- <arg> arguments to pass to the function
- returns the result of calling the function with the arguments
-
- (quote <expr>) RETURN AN EXPRESSION UNEVALUATED
- f✓_s✓_u✓_b✓_r✓_
- <expr> the expression to be quoted (quoted)
- returns <expr> unevaluated
-
- (function <expr>) GET THE FUNCTIONAL INTERPRETATION
- f✓_s✓_u✓_b✓_r✓_
- <expr> the symbol or lambda expression (quoted)
- returns the functional interpretation
-
- (backquote <expr>) FILL IN A TEMPLATE
- f✓_s✓_u✓_b✓_r✓_
- <expr> the template (quoted)
- returns a copy of the template with comma and comma-at
- expressions expanded.
-
- (✓_c✓_o✓_m✓_m✓_a✓_ <✓_e✓_x✓_p✓_r✓_>✓_)✓_ C✓_O✓_M✓_M✓_A✓_ E✓_X✓_P✓_R✓_E✓_S✓_S✓_I✓_O✓_N✓_
- (✓_N✓_e✓_v✓_e✓_r✓_ e✓_x✓_e✓_c✓_u✓_t✓_e✓_d✓_)✓_ A✓_s✓_ t✓_h✓_e✓_ o✓_b✓_j✓_e✓_c✓_t✓_ o✓_f✓_ a✓_ b✓_a✓_c✓_k✓_q✓_u✓_o✓_t✓_e✓_ e✓_x✓_p✓_a✓_n✓_s✓_i✓_o✓_n✓_,✓_ t✓_h✓_e✓_
- e✓_x✓_p✓_r✓_e✓_s✓_s✓_i✓_o✓_n✓_ i✓_s✓_ e✓_v✓_a✓_l✓_u✓_a✓_t✓_e✓_d✓_ a✓_n✓_d✓_ b✓_e✓_c✓_o✓_m✓_e✓_s✓_ a✓_n✓_ o✓_b✓_j✓_e✓_c✓_t✓_ i✓_n✓_ t✓_h✓_e✓_ e✓_n✓_c✓_l✓_o✓_s✓_i✓_n✓_g✓_
- l✓_i✓_s✓_t✓_.✓_
-
- (✓_c✓_o✓_m✓_m✓_a✓_-✓_a✓_t✓_ <✓_e✓_x✓_p✓_r✓_>✓_)✓_ C✓_O✓_M✓_M✓_A✓_-✓_A✓_T✓_ E✓_X✓_P✓_R✓_E✓_S✓_S✓_I✓_O✓_N✓_
- (✓_N✓_e✓_v✓_e✓_r✓_ e✓_x✓_e✓_c✓_u✓_t✓_e✓_d✓_)✓_ A✓_s✓_ t✓_h✓_e✓_ o✓_b✓_j✓_e✓_c✓_t✓_ o✓_f✓_ a✓_ b✓_a✓_c✓_k✓_q✓_u✓_o✓_t✓_e✓_ e✓_x✓_p✓_a✓_n✓_s✓_i✓_o✓_n✓_,✓_ t✓_h✓_e✓_
- e✓_x✓_p✓_r✓_e✓_s✓_s✓_i✓_o✓_n✓_ i✓_s✓_ e✓_v✓_a✓_l✓_u✓_a✓_t✓_e✓_d✓_ (✓_a✓_n✓_d✓_ m✓_u✓_s✓_t✓_ e✓_v✓_a✓_l✓_u✓_a✓_t✓_e✓_ t✓_o✓_ a✓_ l✓_i✓_s✓_t✓_)✓_ a✓_n✓_d✓_ i✓_s✓_ t✓_h✓_e✓_n✓_
- s✓_p✓_l✓_i✓_c✓_e✓_d✓_ i✓_n✓_t✓_o✓_ t✓_h✓_e✓_ e✓_n✓_c✓_l✓_o✓_s✓_i✓_n✓_g✓_ l✓_i✓_s✓_t✓_.✓_
-
- (lambda <args> <expr>...) MAKE A FUNCTION CLOSURE
- f✓_s✓_u✓_b✓_r✓_
- <args> formal argument list (lambda list) (quoted)
- <expr> expressions of the function body (quoted)
- returns the function closure
-
-
-
-
-
-
-
- XLISP 2.0 EVALUATION FUNCTIONS Page 22
-
-
- (get-lambda-expression <closure>) GET THE LAMBDA EXPRESSION
- <closure> the closure
- returns the original lambda expression
-
- (macroexpand <form>) RECURSIVELY EXPAND MACRO CALLS
- <form> the form to expand
- returns the macro expansion
-
- (macroexpand-1 <form>) EXPAND A MACRO CALL
- <form> the macro call form
- returns the macro expansion
-
-
-
-
-
-
-
- XLISP 2.0 SYMBOL FUNCTIONS Page 23
-
-
-
- SYMBOL FUNCTIONS
-
- (set <sym> <expr>) SET THE G✓_L✓_O✓_B✓_A✓_L✓_ VALUE OF A SYMBOL
- <sym> the symbol being set
- <expr> the new value
- returns the new value
-
- (setq [<sym> <expr>]...) SET THE VALUE OF A SYMBOL
- f✓_s✓_u✓_b✓_r✓_
- <sym> the symbol being set (quoted)
- <expr> the new value
- returns the new value
-
- (psetq [<sym> <expr>]...) PARALLEL VERSION OF SETQ
- f✓_s✓_u✓_b✓_r✓_.✓_ A✓_l✓_l✓_ e✓_x✓_p✓_r✓_e✓_s✓_s✓_i✓_o✓_n✓_s✓_ a✓_r✓_e✓_ e✓_v✓_a✓_l✓_u✓_a✓_t✓_e✓_d✓_ b✓_e✓_f✓_o✓_r✓_e✓_ a✓_n✓_y✓_ a✓_s✓_s✓_i✓_g✓_n✓_m✓_e✓_n✓_t✓_s✓_
- a✓_r✓_e✓_ m✓_a✓_d✓_e✓_.✓_
- <sym> the symbol being set (quoted)
- <expr> the new value
- returns the new value
-
- (setf [<place> <expr>]...) SET THE VALUE OF A FIELD
- f✓_s✓_u✓_b✓_r✓_
- <place> the field specifier (quoted):
- <sym> set value of a symbol
- (car <expr>) set car of a cons node
- (cdr <expr>) set cdr of a cons node
- (nth <n> <expr>) set nth car of a list
- (aref <expr> <n>) set nth element of an array o✓_r✓_
- s✓_t✓_r✓_i✓_n✓_g✓_
- (✓_e✓_l✓_t✓_ <✓_e✓_x✓_p✓_r✓_>✓_ <✓_n✓_>✓_)✓_ s✓_e✓_t✓_ n✓_t✓_h✓_ e✓_l✓_e✓_m✓_e✓_n✓_t✓_ o✓_f✓_ a✓_ s✓_e✓_q✓_u✓_e✓_n✓_c✓_e✓_
- (get <sym> <prop>) set value of a property
- (symbol-value <sym>) set value of a symbol
- (symbol-function <sym>) functional value of a
- symbol
- (symbol-plist <sym>) set property list of a
- symbol
- (✓_s✓_e✓_n✓_d✓_ <✓_o✓_b✓_j✓_>✓_ :✓_<✓_i✓_v✓_a✓_r✓_>✓_)✓_ (✓_W✓_h✓_e✓_n✓_ c✓_l✓_a✓_s✓_s✓_e✓_s✓_.✓_l✓_s✓_p✓_ u✓_s✓_e✓_d✓_)✓_,✓_
- s✓_e✓_t✓_ i✓_n✓_s✓_t✓_a✓_n✓_c✓_e✓_ v✓_a✓_r✓_i✓_a✓_b✓_l✓_e✓_ o✓_f✓_
- o✓_b✓_j✓_e✓_c✓_t✓_.✓_
- (✓_<✓_s✓_y✓_m✓_>✓_-✓_<✓_e✓_l✓_e✓_m✓_e✓_n✓_t✓_>✓_ <✓_s✓_t✓_r✓_u✓_c✓_t✓_>✓_)✓_ (✓_W✓_h✓_e✓_n✓_ s✓_t✓_r✓_u✓_c✓_t✓_.✓_l✓_s✓_p✓_ u✓_s✓_e✓_d✓_)✓_,✓_
- s✓_e✓_t✓_ t✓_h✓_e✓_ e✓_l✓_e✓_m✓_e✓_n✓_t✓_ o✓_f✓_
- s✓_t✓_r✓_u✓_c✓_t✓_u✓_r✓_e✓_ s✓_t✓_r✓_u✓_c✓_t✓_,✓_ t✓_y✓_p✓_e✓_
- s✓_y✓_m✓_.✓_
- (✓_<✓_f✓_i✓_e✓_l✓_d✓_s✓_y✓_m✓_>✓_ <✓_a✓_r✓_g✓_s✓_>✓_)✓_ t✓_h✓_e✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_ s✓_t✓_o✓_r✓_e✓_d✓_ i✓_n✓_ p✓_r✓_o✓_p✓_e✓_r✓_t✓_y✓_
- *✓_s✓_e✓_t✓_f✓_*✓_ i✓_n✓_ s✓_y✓_m✓_b✓_o✓_l✓_ <✓_f✓_i✓_e✓_l✓_d✓_s✓_y✓_m✓_>✓_ i✓_s✓_
- a✓_p✓_p✓_l✓_i✓_e✓_d✓_ t✓_o✓_ (✓_<✓_a✓_r✓_g✓_s✓_>✓_ <✓_e✓_x✓_p✓_r✓_>✓_)✓_
- <value> the new value
- returns the new value
-
-
-
-
-
-
-
- XLISP 2.0 SYMBOL FUNCTIONS Page 24
-
-
- (✓_p✓_u✓_s✓_h✓_ <✓_e✓_x✓_p✓_r✓_>✓_ <✓_p✓_l✓_a✓_c✓_e✓_>✓_)✓_ C✓_O✓_N✓_S✓_ T✓_O✓_ S✓_Y✓_M✓_B✓_O✓_L✓_ V✓_A✓_L✓_U✓_E✓_
- <✓_p✓_l✓_a✓_c✓_e✓_>✓_ f✓_i✓_e✓_l✓_d✓_ s✓_p✓_e✓_c✓_i✓_f✓_i✓_e✓_r✓_ b✓_e✓_i✓_n✓_g✓_ m✓_o✓_d✓_i✓_f✓_i✓_e✓_d✓_ (✓_s✓_e✓_e✓_ s✓_e✓_t✓_f✓_)✓_
- <✓_e✓_x✓_p✓_r✓_>✓_ v✓_a✓_l✓_u✓_e✓_ t✓_o✓_ c✓_o✓_n✓_s✓_ t✓_o✓_ c✓_u✓_r✓_r✓_e✓_n✓_t✓_ s✓_y✓_m✓_b✓_o✓_l✓_ v✓_a✓_l✓_u✓_e✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ t✓_h✓_e✓_ n✓_e✓_w✓_ v✓_a✓_l✓_u✓_e✓_ w✓_h✓_i✓_c✓_h✓_ i✓_s✓_ (✓_C✓_O✓_N✓_S✓_ <✓_e✓_x✓_p✓_r✓_>✓_ <✓_p✓_l✓_a✓_c✓_e✓_>✓_)✓_
- N✓_o✓_t✓_e✓_:✓_ d✓_e✓_f✓_i✓_n✓_e✓_d✓_ a✓_s✓_ m✓_a✓_c✓_r✓_o✓_ i✓_n✓_ c✓_o✓_m✓_m✓_o✓_n✓_.✓_l✓_s✓_p✓_
-
- (✓_p✓_o✓_p✓_ <✓_p✓_l✓_a✓_c✓_e✓_>✓_)✓_ R✓_E✓_M✓_O✓_V✓_E✓_ F✓_I✓_R✓_S✓_T✓_ E✓_L✓_E✓_M✓_E✓_N✓_T✓_ O✓_F✓_ S✓_Y✓_M✓_B✓_O✓_L✓_ V✓_A✓_L✓_U✓_E✓_
- <✓_p✓_l✓_a✓_c✓_e✓_>✓_ t✓_h✓_e✓_ f✓_i✓_e✓_l✓_d✓_ b✓_e✓_i✓_n✓_g✓_ m✓_o✓_d✓_i✓_f✓_i✓_e✓_d✓_ (✓_s✓_e✓_e✓_ s✓_e✓_t✓_f✓_)✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ (✓_C✓_A✓_R✓_ <✓_p✓_l✓_a✓_c✓_e✓_>✓_)✓_,✓_ f✓_i✓_e✓_l✓_d✓_ c✓_h✓_a✓_n✓_g✓_e✓_d✓_ t✓_o✓_ (✓_C✓_D✓_R✓_ <✓_p✓_l✓_a✓_c✓_e✓_>✓_)✓_
- N✓_o✓_t✓_e✓_:✓_ d✓_e✓_f✓_i✓_n✓_e✓_d✓_ a✓_s✓_ m✓_a✓_c✓_r✓_o✓_ i✓_n✓_ c✓_o✓_m✓_m✓_o✓_n✓_.✓_l✓_s✓_p✓_
-
- (defun <sym> <fargs> <expr>...) DEFINE A FUNCTION
- (defmacro <sym> <fargs> <expr>...) DEFINE A MACRO
- f✓_s✓_u✓_b✓_r✓_
- <sym> symbol being defined (quoted)
- <fargs> formal argument list (lambda list) (quoted)
- <expr> expressions constituting the body of the function
- (quoted)
- returns the function symbol
-
- (gensym [<tag>]) GENERATE A SYMBOL
- <tag> string or number
- returns the new symbol
-
- (intern <pname>) MAKE AN INTERNED SYMBOL
- <pname> the symbol's print name string
- returns the new symbol
-
- (make-symbol <pname>) MAKE AN UNINTERNED SYMBOL
- <pname> the symbol's print name string
- returns the new symbol
-
- (symbol-name <sym>) GET THE PRINT NAME OF A SYMBOL
- <sym> the symbol
- returns the symbol's print name
-
- (symbol-value <sym>) GET THE VALUE OF A SYMBOL
- <sym> the symbol
- returns the symbol's value
-
- (symbol-function <sym>) GET THE FUNCTIONAL VALUE OF A SYMBOL
- <sym> the symbol
- returns the symbol's functional value
-
- (symbol-plist <sym>) GET THE PROPERTY LIST OF A SYMBOL
- <sym> the symbol
- returns the symbol's property list
-
- (hash <sym> <n>) COMPUTE THE HASH INDEX FOR A SYMBOL
- <sym> the symbol or string
- <n> the table size (integer)
-
-
-
-
-
-
-
- XLISP 2.0 SYMBOL FUNCTIONS Page 25
-
-
- returns the hash index (integer)
-
- (✓_m✓_a✓_k✓_u✓_n✓_b✓_o✓_u✓_n✓_d✓_ <✓_s✓_y✓_m✓_>✓_)✓_ M✓_A✓_K✓_E✓_ A✓_ S✓_Y✓_M✓_B✓_O✓_L✓_ V✓_A✓_L✓_U✓_E✓_ B✓_E✓_ U✓_N✓_B✓_O✓_U✓_N✓_D✓_
- <✓_s✓_y✓_m✓_>✓_ t✓_h✓_e✓_ s✓_y✓_m✓_b✓_o✓_l✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ t✓_h✓_e✓_ s✓_y✓_m✓_b✓_o✓_l✓_
- N✓_o✓_t✓_e✓_:✓_ d✓_e✓_f✓_i✓_n✓_e✓_d✓_ i✓_n✓_ i✓_n✓_i✓_t✓_.✓_l✓_s✓_p✓_
-
- (✓_f✓_m✓_a✓_k✓_u✓_n✓_b✓_o✓_u✓_n✓_d✓_ <✓_s✓_y✓_m✓_>✓_)✓_ M✓_A✓_K✓_E✓_ A✓_ S✓_Y✓_M✓_B✓_O✓_L✓_ F✓_U✓_N✓_C✓_T✓_I✓_O✓_N✓_ B✓_E✓_ U✓_N✓_B✓_O✓_U✓_N✓_D✓_
- <✓_s✓_y✓_m✓_>✓_ t✓_h✓_e✓_ s✓_y✓_m✓_b✓_o✓_l✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ t✓_h✓_e✓_ s✓_y✓_m✓_b✓_o✓_l✓_
- N✓_o✓_t✓_e✓_:✓_ d✓_e✓_f✓_i✓_n✓_e✓_d✓_ i✓_n✓_ i✓_n✓_i✓_t✓_.✓_l✓_s✓_p✓_
-
-
-
-
-
-
-
- XLISP 2.0 PROPERTY LIST FUNCTIONS Page 26
-
-
-
- PROPERTY LIST FUNCTIONS
-
- (get <sym> <prop>) GET THE VALUE OF A PROPERTY
- <sym> the symbol
- <prop> the property symbol
- returns the property value or nil
-
- (putprop <sym> <val> <prop>) PUT A PROPERTY ONTO A PROPERTY LIST
- <sym> the symbol
- <val> the property value
- <prop> the property symbol
- returns the property value
-
- (remprop <sym> <prop>) REMOVE A PROPERTY
- <sym> the symbol
- <prop> the property symbol
- returns nil
-
-
-
-
-
-
-
- XLISP 2.0 ARRAY FUNCTIONS Page 27
-
-
-
- ARRAY FUNCTIONS
-
- (aref <array> <n>) GET THE NTH ELEMENT OF AN ARRAY
- T✓_h✓_i✓_s✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_ n✓_o✓_w✓_ a✓_l✓_s✓_o✓_ w✓_o✓_r✓_k✓_s✓_ o✓_n✓_ s✓_t✓_r✓_i✓_n✓_g✓_s✓_.✓_
- <array> the array
- <n> the array index (integer)
- returns the value of the array element
-
- (make-array <size>) MAKE A NEW ARRAY
- <size> the size of the new array (integer)
- returns the new array
-
- (vector <expr>...) MAKE AN INITIALIZED VECTOR
- <expr> the vector elements
- returns the new vector
-
-
-
-
-
-
-
- XLISP 2.0 SEQUENCE FUNCTIONS Page 28
-
-
-
- SEQUENCE FUNCTIONS
-
- T✓_h✓_e✓_s✓_e✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_s✓_ w✓_o✓_r✓_k✓_ o✓_n✓_ s✓_e✓_q✓_u✓_e✓_n✓_c✓_e✓_s✓_ -✓_-✓_ l✓_i✓_s✓_t✓_s✓_,✓_ a✓_r✓_r✓_a✓_y✓_s✓_,✓_ o✓_r✓_ s✓_t✓_r✓_i✓_n✓_g✓_s✓_,✓_ a✓_n✓_d✓_
- f✓_o✓_r✓_ t✓_h✓_e✓_ m✓_o✓_s✓_t✓_ p✓_a✓_r✓_t✓_ r✓_e✓_p✓_r✓_e✓_s✓_e✓_n✓_t✓_ a✓_n✓_ e✓_x✓_t✓_e✓_n✓_s✓_i✓_o✓_n✓_ o✓_f✓_ t✓_h✓_e✓_ d✓_i✓_s✓_t✓_r✓_i✓_b✓_u✓_t✓_i✓_o✓_n✓_ X✓_L✓_I✓_S✓_P✓_
- 2✓_.✓_0✓_.✓_
-
- (concatenate <type> <expr> ...) CONCATENATE SEQUENCES
- <type> result type, one of cons, array, or string
- <expr> zero or more sequences to concatenate
- returns a sequence which is the concatenation of the arguement
- sequences
- NOTE: if result type is string, sequences must contain only
- characters.
-
- (elt <expr> <n>) GET THE NTH ELEMENT OF A SEQUENCE
- <expr> the sequence
- <n> the index of element to return
- returns the element if the index is in bounds, otherwise error
-
- (map <type> <fcn> <expr> ...) APPLY FUNCTION TO SUCCESSIVE ELEMENTS
- <type> result type, one of cons, array, string, or nil
- <fcn> the function or function name
- <expr> a sequence for each argument of the function
- returns a new sequence of type <type>.
-
- (every <fcn> <expr> ...) APPLY FUNCTION TO ELEMENTS UNTIL FALSE
- (notevery <fcn> <expr> ...)
- <fcn> the function or function name
- <expr> a sequence for each argument of the function
- returns every returns last evaluated function result, or T
- notevery returns T if there is a nil function result,
- else NIL
-
- (some <fcn> <expr> ...) APPLY FUNCTION TO ELEMENTS UNTIL TRUE
- (notany <fcn> <expr> ...)
- <fcn> the function or function name
- <expr> a sequence for each argument of the function
- returns some returns first non-nil function result, or NIL
- notany returns NIL if there is a non-nil function
- result, else T
-
- (length <expr>) FIND THE LENGTH OF A SEQUENCE
- U✓_n✓_c✓_h✓_a✓_n✓_g✓_e✓_d✓_ f✓_r✓_o✓_m✓_ t✓_h✓_e✓_ d✓_i✓_s✓_t✓_r✓_i✓_b✓_u✓_t✓_i✓_o✓_n✓_
- <expr> the list, vector or string
- returns the length of the list, vector or string
-
-
-
-
-
-
-
- XLISP 2.0 SEQUENCE FUNCTIONS Page 29
-
-
- (reverse <expr>) REVERSE A SEQUENCE
- (✓_n✓_r✓_e✓_v✓_e✓_r✓_s✓_e✓_ <✓_e✓_x✓_p✓_r✓_>✓_)✓_ D✓_E✓_S✓_T✓_R✓_U✓_C✓_T✓_I✓_V✓_E✓_L✓_Y✓_ R✓_E✓_V✓_E✓_R✓_S✓_E✓_ A✓_ S✓_E✓_Q✓_U✓_E✓_N✓_C✓_E✓_
- D✓_i✓_s✓_t✓_r✓_i✓_b✓_u✓_t✓_i✓_o✓_n✓_ o✓_n✓_l✓_y✓_ w✓_o✓_r✓_k✓_e✓_d✓_ o✓_n✓_ l✓_i✓_s✓_t✓_s✓_.✓_
- <expr> the sequence to reverse
- returns a new sequence in the reverse order
-
- (subseq <seq> <start> [<end>]) EXTRACT A SUBSEQUENCE
- D✓_i✓_s✓_t✓_r✓_i✓_b✓_u✓_t✓_i✓_o✓_n✓_ o✓_n✓_l✓_y✓_ w✓_o✓_r✓_k✓_e✓_d✓_ o✓_n✓_ s✓_t✓_r✓_i✓_n✓_g✓_s✓_.✓_
- <seq> the sequence
- <start> the starting position (zero origin)
- <end> the ending position + 1 (defaults to end) o✓_r✓_ N✓_I✓_L✓_ f✓_o✓_r✓_
- e✓_n✓_d✓_ o✓_f✓_ s✓_e✓_q✓_u✓_e✓_n✓_c✓_e✓_
- returns the sequence between <start> and <end>
-
- (search <seq1> <seq2> &key :test :test-not :start1 :end1 :start2
- :end2)
- SEARCH FOR SEQUENCE
- Note: added function
- <seq1> the sequence to search for
- <seq2> the sequence to search in
- :test the test function (defaults to eql)
- :test-not the test function (sense inverted)
- :start1 starting index in <seq1>
- :end1 index of end+1 in <seq1> or NIL for end of sequence
- :start2 starting index in <seq2>
- :end2 index of end+1 in <seq2> or NIL for end of sequence
- returns position of first match
-
- (remove <expr> <seq> &key :test :test-not :start :end)
- REMOVE ELEMENTS FROM A SEQUENCE
- D✓_i✓_s✓_t✓_r✓_i✓_b✓_u✓_t✓_i✓_o✓_n✓_ o✓_n✓_l✓_y✓_ w✓_o✓_r✓_k✓_e✓_d✓_ o✓_n✓_ l✓_i✓_s✓_t✓_s✓_.✓_
- <expr> the element to remove
- <seq> the sequence
- :test the test function (defaults to eql)
- :test-not the test function (sense inverted)
- :✓_s✓_t✓_a✓_r✓_t✓_ s✓_t✓_a✓_r✓_t✓_i✓_n✓_g✓_ i✓_n✓_d✓_e✓_x✓_
- :✓_e✓_n✓_d✓_ i✓_n✓_d✓_e✓_x✓_ o✓_f✓_ e✓_n✓_d✓_+✓_1✓_,✓_ o✓_r✓_ N✓_I✓_L✓_ f✓_o✓_r✓_ (✓_l✓_e✓_n✓_g✓_t✓_h✓_ <✓_s✓_e✓_q✓_>✓_)✓_
- returns copy of sequence with matching expressions removed
-
- (remove-if <test> <seq> &key :start :end)
- REMOVE ELEMENTS THAT PASS TEST
- D✓_i✓_s✓_t✓_r✓_i✓_b✓_u✓_t✓_i✓_o✓_n✓_ o✓_n✓_l✓_y✓_ w✓_o✓_r✓_k✓_e✓_d✓_ o✓_n✓_ l✓_i✓_s✓_t✓_s✓_.✓_
- <test> the test predicate
- <seq> the sequence
- :✓_s✓_t✓_a✓_r✓_t✓_ s✓_t✓_a✓_r✓_t✓_i✓_n✓_g✓_ i✓_n✓_d✓_e✓_x✓_
- :✓_e✓_n✓_d✓_ i✓_n✓_d✓_e✓_x✓_ o✓_f✓_ e✓_n✓_d✓_+✓_1✓_,✓_ o✓_r✓_ N✓_I✓_L✓_ f✓_o✓_r✓_ (✓_l✓_e✓_n✓_g✓_t✓_h✓_ <✓_s✓_e✓_q✓_>✓_)✓_
- returns copy of sequence with matching elements removed
-
-
-
-
-
-
-
- XLISP 2.0 SEQUENCE FUNCTIONS Page 30
-
-
- (remove-if-not <test> <seq> &key :start :end)
- REMOVE ELEMENTS THAT FAIL TEST
- D✓_i✓_s✓_t✓_r✓_i✓_b✓_u✓_t✓_i✓_o✓_n✓_ o✓_n✓_l✓_y✓_ w✓_o✓_r✓_k✓_e✓_d✓_ o✓_n✓_ l✓_i✓_s✓_t✓_s✓_.✓_
- <test> the test predicate
- <seq> the sequence
- :✓_s✓_t✓_a✓_r✓_t✓_ s✓_t✓_a✓_r✓_t✓_i✓_n✓_g✓_ i✓_n✓_d✓_e✓_x✓_
- :✓_e✓_n✓_d✓_ i✓_n✓_d✓_e✓_x✓_ o✓_f✓_ e✓_n✓_d✓_+✓_1✓_,✓_ o✓_r✓_ N✓_I✓_L✓_ f✓_o✓_r✓_ (✓_l✓_e✓_n✓_g✓_t✓_h✓_ <✓_s✓_e✓_q✓_>✓_)✓_
- returns copy of sequence with non-matching elements removed
-
- (count-if <test> <seq> &key :start :end) COUNT ELEMENTS THAT PASS TEST
- Note: added function
- <test> the test predicate
- <seq> the sequence
- :start starting index
- :end index of end+1, or NIL for (length <seq>)
- returns count of matching elements
-
- (find-if <test> <seq> &key :start :end)
- FIND FIRST ELEMENT THAT PASSES TEST
- Note: added function
- <test> the test predicate
- <seq> the list
- :start starting index
- :end index of end+1, or NIL for (length <seq>)
- returns first element of sequence that passes test
-
- (position-if <test> <seq> &key :start :end)
- FIND POSITION OF FIRST ELEMENT THAT PASSES TEST
- Note: added function
- <test> the test predicate
- <seq> the list
- :start starting index
- :end index of end+1, or NIL for (length <seq>)
- returns position of first element of sequence that passes test,
- or NIL.
-
-
- (delete <expr> <seq> &key :test :test-not :start :end)
- DELETE ELEMENTS FROM A SEQUENCE
- D✓_i✓_s✓_t✓_r✓_i✓_b✓_u✓_t✓_i✓_o✓_n✓_ o✓_n✓_l✓_y✓_ w✓_o✓_r✓_k✓_e✓_d✓_ o✓_n✓_ l✓_i✓_s✓_t✓_s✓_.✓_
- <expr> the element to delete
- <seq> the sequence
- :test the test function (defaults to eql)
- :test-not the test function (sense inverted)
- :✓_s✓_t✓_a✓_r✓_t✓_ s✓_t✓_a✓_r✓_t✓_i✓_n✓_g✓_ i✓_n✓_d✓_e✓_x✓_
- :✓_e✓_n✓_d✓_ i✓_n✓_d✓_e✓_x✓_ o✓_f✓_ e✓_n✓_d✓_+✓_1✓_,✓_ o✓_r✓_ N✓_I✓_L✓_ f✓_o✓_r✓_ (✓_l✓_e✓_n✓_g✓_t✓_h✓_ <✓_e✓_x✓_p✓_r✓_>✓_)✓_
- returns the sequence with the matching expressions deleted
-
-
-
-
-
-
-
- XLISP 2.0 SEQUENCE FUNCTIONS Page 31
-
-
- (delete-if <test> <seq> &key :start :end)
- DELETE ELEMENTS THAT PASS TEST
- D✓_i✓_s✓_t✓_r✓_i✓_b✓_u✓_t✓_i✓_o✓_n✓_ o✓_n✓_l✓_y✓_ w✓_o✓_r✓_k✓_e✓_d✓_ o✓_n✓_ l✓_i✓_s✓_t✓_s✓_.✓_
- <test> the test predicate
- <seq> the sequence
- :✓_s✓_t✓_a✓_r✓_t✓_ s✓_t✓_a✓_r✓_t✓_i✓_n✓_g✓_ i✓_n✓_d✓_e✓_x✓_
- :✓_e✓_n✓_d✓_ i✓_n✓_d✓_e✓_x✓_ o✓_f✓_ e✓_n✓_d✓_+✓_1✓_,✓_ o✓_r✓_ N✓_I✓_L✓_ f✓_o✓_r✓_ (✓_l✓_e✓_n✓_g✓_t✓_h✓_ <✓_e✓_x✓_p✓_r✓_>✓_)✓_
- returns the sequence with matching elements deleted
-
- (delete-if-not <test> <seq> &key :start :end)
- DELETE ELEMENTS THAT FAIL TEST
- D✓_i✓_s✓_t✓_r✓_i✓_b✓_u✓_t✓_i✓_o✓_n✓_ o✓_n✓_l✓_y✓_ w✓_o✓_r✓_k✓_e✓_d✓_ o✓_n✓_ l✓_i✓_s✓_t✓_s✓_.✓_
- <test> the test predicate
- <seq> the sequence
- :✓_s✓_t✓_a✓_r✓_t✓_ s✓_t✓_a✓_r✓_t✓_i✓_n✓_g✓_ i✓_n✓_d✓_e✓_x✓_
- :✓_e✓_n✓_d✓_ i✓_n✓_d✓_e✓_x✓_ o✓_f✓_ e✓_n✓_d✓_+✓_1✓_,✓_ o✓_r✓_ N✓_I✓_L✓_ f✓_o✓_r✓_ (✓_l✓_e✓_n✓_g✓_t✓_h✓_ <✓_e✓_x✓_p✓_r✓_>✓_)✓_
- returns the sequence with non-matching elements deleted
-
-
-
-
-
-
-
- XLISP 2.0 LIST FUNCTIONS Page 32
-
-
-
- LIST FUNCTIONS
-
- (car <expr>) RETURN THE CAR OF A LIST NODE
- <expr> the list node
- returns the car of the list node
-
- (cdr <expr>) RETURN THE CDR OF A LIST NODE
- <expr> the list node
- returns the cdr of the list node
-
- (cxxr <expr>) ALL CxxR COMBINATIONS
- (cxxxr <expr>) ALL CxxxR COMBINATIONS
- (cxxxxr <expr>) ALL CxxxxR COMBINATIONS
-
- (first <expr>) A SYNONYM FOR CAR
- (second <expr>) A SYNONYM FOR CADR
- (third <expr>) A SYNONYM FOR CADDR
- (fourth <expr>) A SYNONYM FOR CADDDR
- (rest <expr>) A SYNONYM FOR CDR
-
- (cons <expr1> <expr2>) CONSTRUCT A NEW LIST NODE
- <expr1> the car of the new list node
- <expr2> the cdr of the new list node
- returns the new list node
-
- (list <expr>...) CREATE A LIST OF VALUES
- (✓_l✓_i✓_s✓_t✓_*✓_ <✓_e✓_x✓_p✓_r✓_>✓_ .✓_.✓_.✓_ <✓_l✓_i✓_s✓_t✓_>✓_)✓_
- l✓_i✓_s✓_t✓_*✓_ i✓_s✓_ d✓_e✓_f✓_i✓_n✓_e✓_d✓_ i✓_n✓_ c✓_o✓_m✓_m✓_o✓_n✓_.✓_l✓_s✓_p✓_
- <expr> expressions to be combined into a list
- returns the new list
-
- (append <expr>...) APPEND LISTS
- <expr> lists whose elements are to be appended
- returns the new list
-
- (last <list>) RETURN THE LAST LIST NODE OF A LIST
- <list> the list
- returns the last list node in the list
-
- (member <expr> <list> &key :test :test-not)
- FIND AN EXPRESSION IN A LIST
- <expr> the expression to find
- <list> the list to search
- :test the test function (defaults to eql)
- :test-not the test function (sense inverted)
- returns the remainder of the list starting with the expression
-
-
-
-
-
-
-
- XLISP 2.0 LIST FUNCTIONS Page 33
-
-
- (assoc <expr> <alist> &key :test :test-not)
- FIND AN EXPRESSION IN AN A-LIST
- <expr> the expression to find
- <alist> the association list
- :test the test function (defaults to eql)
- :test-not the test function (sense inverted)
- returns the alist entry or nil
-
- (nth <n> <list>) RETURN THE NTH ELEMENT OF A LIST
- <n> the number of the element to return (zero origin)
- <list> the list
- returns the nth element or nil if the list isn't that long
-
- (nthcdr <n> <list>) RETURN THE NTH CDR OF A LIST
- <n> the number of the element to return (zero origin)
- <list> the list
- returns the nth cdr or nil if the list isn't that long
-
- (mapc <fcn> <list1> <list>...) APPLY FUNCTION TO SUCCESSIVE CARS
- <fcn> the function or function name
- <listn> a list for each argument of the function
- returns the first list of arguments
-
- (mapcar <fcn> <list1> <list>...) APPLY FUNCTION TO SUCCESSIVE CARS
- <fcn> the function or function name
- <listn> a list for each argument of the function
- returns a list of the values returned
-
- (mapl <fcn> <list1> <list>...) APPLY FUNCTION TO SUCCESSIVE CDRS
- <fcn> the function or function name
- <listn> a list for each argument of the function
- returns the first list of arguments
-
- (maplist <fcn> <list1> <list>...) APPLY FUNCTION TO SUCCESSIVE CDRS
- <fcn> the function or function name
- <listn> a list for each argument of the function
- returns a list of the values returned
-
- (✓_m✓_a✓_p✓_c✓_a✓_n✓_ <✓_f✓_c✓_n✓_>✓_ <✓_l✓_i✓_s✓_t✓_1✓_>✓_ <✓_l✓_i✓_s✓_t✓_>✓_.✓_.✓_.✓_)✓_ A✓_P✓_P✓_L✓_Y✓_ F✓_U✓_N✓_C✓_T✓_I✓_O✓_N✓_ T✓_O✓_ S✓_U✓_C✓_C✓_E✓_S✓_S✓_I✓_V✓_E✓_ C✓_A✓_R✓_S✓_
- <✓_f✓_c✓_n✓_>✓_ t✓_h✓_e✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_ o✓_r✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_ n✓_a✓_m✓_e✓_
- <✓_l✓_i✓_s✓_t✓_n✓_>✓_ a✓_ l✓_i✓_s✓_t✓_ f✓_o✓_r✓_ e✓_a✓_c✓_h✓_ a✓_r✓_g✓_u✓_m✓_e✓_n✓_t✓_ o✓_f✓_ t✓_h✓_e✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ l✓_i✓_s✓_t✓_ o✓_f✓_ r✓_e✓_t✓_u✓_r✓_n✓_ v✓_a✓_l✓_u✓_e✓_s✓_ n✓_c✓_o✓_n✓_c✓_'✓_d✓_ t✓_o✓_g✓_e✓_t✓_h✓_e✓_r✓_
- N✓_o✓_t✓_e✓_:✓_ t✓_h✓_i✓_s✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_ i✓_s✓_ i✓_n✓_ i✓_n✓_i✓_t✓_.✓_l✓_s✓_p✓_
-
- (✓_m✓_a✓_p✓_c✓_o✓_n✓_ <✓_f✓_c✓_n✓_>✓_ <✓_l✓_i✓_s✓_t✓_1✓_>✓_ <✓_l✓_i✓_s✓_t✓_>✓_.✓_.✓_.✓_)✓_ A✓_P✓_P✓_L✓_Y✓_ F✓_U✓_N✓_C✓_T✓_I✓_O✓_N✓_ T✓_O✓_ S✓_U✓_C✓_C✓_E✓_S✓_S✓_I✓_V✓_E✓_ C✓_D✓_R✓_S✓_
- <✓_f✓_c✓_n✓_>✓_ t✓_h✓_e✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_ o✓_r✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_ n✓_a✓_m✓_e✓_
- <✓_l✓_i✓_s✓_t✓_n✓_>✓_ a✓_ l✓_i✓_s✓_t✓_ f✓_o✓_r✓_ e✓_a✓_c✓_h✓_ a✓_r✓_g✓_u✓_m✓_e✓_n✓_t✓_ o✓_f✓_ t✓_h✓_e✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ l✓_i✓_s✓_t✓_ o✓_f✓_ r✓_e✓_t✓_u✓_r✓_n✓_ v✓_a✓_l✓_u✓_e✓_s✓_ n✓_c✓_o✓_n✓_c✓_'✓_d✓_ t✓_o✓_g✓_e✓_t✓_h✓_e✓_r✓_
- N✓_o✓_t✓_e✓_:✓_ t✓_h✓_i✓_s✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_ i✓_s✓_ i✓_n✓_ i✓_n✓_i✓_t✓_.✓_l✓_s✓_p✓_
-
-
-
-
-
-
-
- XLISP 2.0 LIST FUNCTIONS Page 34
-
-
- (subst <to> <from> <expr> &key :test :test-not) SUBSTITUTE EXPRESSIONS
- M✓_o✓_d✓_i✓_f✓_i✓_e✓_d✓_ t✓_o✓_ d✓_o✓_ m✓_i✓_n✓_i✓_m✓_u✓_m✓_ c✓_o✓_p✓_y✓_i✓_n✓_g✓_ a✓_s✓_ i✓_n✓_ C✓_o✓_m✓_m✓_o✓_n✓_ L✓_i✓_s✓_p✓_
- <to> the new expression
- <from> the old expression
- <expr> the expression in which to do the substitutions
- :test the test function (defaults to eql)
- :test-not the test function (sense inverted)
- returns the expression with substitutions
-
- (sublis <alist> <expr> &key :test :test-not) SUBSTITUTE WITH AN A-LIST
- M✓_o✓_d✓_i✓_f✓_i✓_e✓_d✓_ t✓_o✓_ d✓_o✓_ m✓_i✓_n✓_i✓_m✓_u✓_m✓_ c✓_o✓_p✓_y✓_i✓_n✓_g✓_ a✓_s✓_ i✓_n✓_ C✓_o✓_m✓_m✓_o✓_n✓_ L✓_i✓_s✓_p✓_
- <alist> the association list
- <expr> the expression in which to do the substitutions
- :test the test function (defaults to eql)
- :test-not the test function (sense inverted)
- returns the expression with substitutions
-
- (✓_p✓_a✓_i✓_r✓_l✓_i✓_s✓_ <✓_k✓_e✓_y✓_s✓_>✓_ <✓_v✓_a✓_l✓_u✓_e✓_s✓_>✓_ <✓_a✓_l✓_i✓_s✓_t✓_>✓_)✓_ B✓_U✓_I✓_L✓_D✓_ A✓_N✓_ A✓_-✓_L✓_I✓_S✓_T✓_ F✓_R✓_O✓_M✓_ T✓_W✓_O✓_ L✓_I✓_S✓_T✓_S✓_
- I✓_n✓_ f✓_i✓_l✓_e✓_ c✓_o✓_m✓_m✓_o✓_n✓_.✓_l✓_s✓_p✓_
- <✓_k✓_e✓_y✓_s✓_>✓_ l✓_i✓_s✓_t✓_ o✓_f✓_ a✓_s✓_s✓_o✓_c✓_i✓_a✓_t✓_i✓_o✓_n✓_ k✓_e✓_y✓_s✓_
- <✓_v✓_a✓_l✓_u✓_e✓_s✓_>✓_ l✓_i✓_s✓_t✓_ o✓_f✓_ a✓_s✓_s✓_o✓_c✓_i✓_a✓_t✓_i✓_o✓_n✓_ v✓_a✓_l✓_u✓_e✓_s✓_,✓_ s✓_a✓_m✓_e✓_ l✓_e✓_n✓_g✓_t✓_h✓_ a✓_s✓_ k✓_e✓_y✓_s✓_
- <✓_a✓_l✓_i✓_s✓_t✓_>✓_ e✓_x✓_i✓_s✓_t✓_i✓_n✓_g✓_ a✓_s✓_s✓_o✓_c✓_i✓_a✓_t✓_i✓_o✓_n✓_ l✓_i✓_s✓_t✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ n✓_e✓_w✓_ a✓_s✓_s✓_o✓_c✓_i✓_a✓_t✓_i✓_o✓_n✓_ l✓_i✓_s✓_t✓_
-
- (✓_c✓_o✓_p✓_y✓_-✓_l✓_i✓_s✓_t✓_ <✓_l✓_i✓_s✓_t✓_>✓_)✓_ C✓_O✓_P✓_Y✓_ T✓_H✓_E✓_ T✓_O✓_P✓_ L✓_E✓_V✓_E✓_L✓_ O✓_F✓_ A✓_ L✓_I✓_S✓_T✓_
- I✓_n✓_ f✓_i✓_l✓_e✓_ c✓_o✓_m✓_m✓_o✓_n✓_.✓_l✓_s✓_p✓_
- <✓_l✓_i✓_s✓_t✓_>✓_ t✓_h✓_e✓_ l✓_i✓_s✓_t✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ a✓_ c✓_o✓_p✓_y✓_ o✓_f✓_ t✓_h✓_e✓_ l✓_i✓_s✓_t✓_ (✓_n✓_e✓_w✓_ c✓_o✓_n✓_s✓_ c✓_e✓_l✓_l✓_s✓_ i✓_n✓_ t✓_o✓_p✓_ l✓_e✓_v✓_e✓_l✓_)✓_
-
- (✓_c✓_o✓_p✓_y✓_-✓_a✓_l✓_i✓_s✓_t✓_ <✓_a✓_l✓_i✓_s✓_t✓_>✓_)✓_ C✓_O✓_P✓_Y✓_ A✓_N✓_ A✓_S✓_S✓_O✓_C✓_I✓_A✓_T✓_I✓_O✓_N✓_ L✓_I✓_S✓_T✓_
- I✓_n✓_ f✓_i✓_l✓_e✓_ c✓_o✓_m✓_m✓_o✓_n✓_.✓_l✓_s✓_p✓_
- <✓_a✓_l✓_i✓_s✓_t✓_>✓_ t✓_h✓_e✓_ a✓_s✓_s✓_o✓_c✓_i✓_a✓_t✓_i✓_o✓_n✓_ l✓_i✓_s✓_t✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ a✓_ c✓_o✓_p✓_y✓_ o✓_f✓_ t✓_h✓_e✓_ a✓_s✓_s✓_o✓_c✓_i✓_a✓_t✓_i✓_o✓_n✓_ l✓_i✓_s✓_t✓_ (✓_k✓_e✓_y✓_s✓_ a✓_n✓_d✓_ v✓_a✓_l✓_u✓_e✓_s✓_ n✓_o✓_t✓_
- c✓_o✓_p✓_i✓_e✓_s✓_)✓_
-
- (✓_c✓_o✓_p✓_y✓_-✓_t✓_r✓_e✓_e✓_ <✓_t✓_r✓_e✓_e✓_>✓_)✓_ C✓_O✓_P✓_Y✓_ A✓_ T✓_R✓_E✓_E✓_
- I✓_n✓_ f✓_i✓_l✓_e✓_ c✓_o✓_m✓_m✓_o✓_n✓_.✓_l✓_s✓_p✓_
- <✓_t✓_r✓_e✓_e✓_>✓_ a✓_ t✓_r✓_e✓_e✓_ s✓_t✓_r✓_u✓_c✓_t✓_u✓_r✓_e✓_ o✓_f✓_ c✓_o✓_n✓_s✓_ c✓_e✓_l✓_l✓_s✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ a✓_ c✓_o✓_p✓_y✓_ o✓_f✓_ t✓_h✓_e✓_ t✓_r✓_e✓_e✓_ s✓_t✓_r✓_u✓_c✓_t✓_u✓_r✓_e✓_
-
- (✓_m✓_a✓_k✓_e✓__✓_t✓_c✓_o✓_n✓_c✓_)✓_ M✓_A✓_K✓_E✓_ A✓_ T✓_C✓_O✓_N✓_C✓_ S✓_T✓_R✓_U✓_C✓_T✓_U✓_R✓_E✓_
- I✓_n✓_ f✓_i✓_l✓_e✓_ c✓_o✓_m✓_m✓_o✓_n✓_.✓_l✓_s✓_p✓_.✓_ (✓_n✓_o✓_t✓_e✓_ t✓_h✓_a✓_t✓_ s✓_t✓_r✓_i✓_n✓_g✓_ s✓_t✓_r✓_e✓_a✓_m✓_s✓_ a✓_r✓_e✓_ i✓_n✓_t✓_e✓_r✓_n✓_a✓_l✓_l✓_y✓_
- i✓_m✓_p✓_l✓_e✓_m✓_e✓_n✓_t✓_e✓_d✓_ a✓_s✓_ T✓_C✓_O✓_N✓_C✓_s✓_.✓_ O✓_l✓_d✓_e✓_r✓_ v✓_e✓_r✓_s✓_i✓_o✓_n✓_s✓_ o✓_f✓_ x✓_l✓_i✓_s✓_p✓_ a✓_l✓_l✓_o✓_w✓_e✓_d✓_ a✓_n✓_y✓_ T✓_C✓_O✓_N✓_C✓_
- t✓_o✓_ b✓_e✓_ u✓_s✓_e✓_d✓_ a✓_s✓_ a✓_ s✓_t✓_e✓_a✓_m✓_,✓_ b✓_u✓_t✓_ 2✓_.✓_0✓_ i✓_m✓_p✓_l✓_e✓_m✓_e✓_n✓_t✓_s✓_ a✓_ s✓_p✓_e✓_c✓_i✓_a✓_l✓_ s✓_t✓_r✓_i✓_n✓_g✓_ s✓_t✓_r✓_e✓_a✓_m✓_
- t✓_y✓_p✓_e✓_.✓_)✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ a✓_n✓_ e✓_m✓_p✓_t✓_y✓_ t✓_c✓_o✓_n✓_c✓_ s✓_t✓_r✓_u✓_c✓_t✓_u✓_r✓_e✓_
-
-
-
-
-
-
-
- XLISP 2.0 LIST FUNCTIONS Page 35
-
-
- (✓_t✓_c✓_o✓_n✓_c✓_ <✓_t✓_c✓_o✓_n✓_c✓_>✓_ <✓_e✓_x✓_p✓_r✓_>✓_)✓_ A✓_D✓_D✓_ T✓_O✓_ T✓_A✓_I✓_L✓_ O✓_F✓_ T✓_C✓_O✓_N✓_C✓_ S✓_T✓_R✓_U✓_C✓_T✓_U✓_R✓_E✓_
- (✓_l✓_c✓_o✓_n✓_c✓_ <✓_t✓_c✓_o✓_n✓_c✓_>✓_ <✓_l✓_i✓_s✓_t✓_>✓_)✓_
- I✓_n✓_ f✓_i✓_l✓_e✓_ c✓_o✓_m✓_m✓_o✓_n✓_.✓_l✓_s✓_p✓_
- <✓_t✓_c✓_o✓_n✓_c✓_>✓_ a✓_ t✓_c✓_o✓_n✓_c✓_ s✓_t✓_r✓_u✓_c✓_t✓_u✓_r✓_e✓_
- <✓_e✓_x✓_p✓_r✓_>✓_ e✓_l✓_e✓_m✓_e✓_n✓_t✓_ t✓_o✓_ a✓_d✓_d✓_ t✓_o✓_ t✓_a✓_i✓_l✓_
- <✓_l✓_i✓_s✓_t✓_>✓_ l✓_i✓_s✓_t✓_ o✓_f✓_ e✓_l✓_e✓_m✓_e✓_n✓_t✓_s✓_ t✓_o✓_ a✓_d✓_d✓_ t✓_o✓_ t✓_a✓_i✓_l✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ m✓_o✓_d✓_i✓_f✓_i✓_e✓_d✓_ t✓_c✓_o✓_n✓_c✓_
-
- (✓_r✓_e✓_m✓_o✓_v✓_e✓_-✓_h✓_e✓_a✓_d✓_ <✓_t✓_c✓_o✓_n✓_c✓_>✓_)✓_ R✓_E✓_M✓_O✓_V✓_E✓_ F✓_R✓_O✓_M✓_ H✓_E✓_A✓_D✓_ O✓_F✓_ T✓_C✓_O✓_N✓_C✓_ S✓_T✓_R✓_U✓_C✓_T✓_U✓_R✓_E✓_
- I✓_n✓_ f✓_i✓_l✓_e✓_ c✓_o✓_m✓_m✓_o✓_n✓_.✓_l✓_s✓_p✓_
- <✓_t✓_c✓_o✓_n✓_c✓_>✓_ a✓_ t✓_c✓_o✓_n✓_c✓_ s✓_t✓_r✓_u✓_c✓_t✓_u✓_r✓_e✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ h✓_e✓_a✓_d✓_ o✓_f✓_ t✓_c✓_o✓_n✓_c✓_ (✓_t✓_c✓_o✓_n✓_c✓_ i✓_s✓_ m✓_o✓_d✓_i✓_f✓_i✓_e✓_d✓_)✓_
-
-
-
-
-
-
-
- XLISP 2.0 DESTRUCTIVE LIST FUNCTIONS Page 36
-
-
-
- DESTRUCTIVE LIST FUNCTIONS
-
- S✓_e✓_e✓_ a✓_l✓_s✓_o✓_ n✓_r✓_e✓_v✓_e✓_r✓_s✓_e✓_,✓_ d✓_e✓_l✓_e✓_t✓_e✓_,✓_ d✓_e✓_l✓_e✓_t✓_e✓_-✓_i✓_f✓_,✓_ a✓_n✓_d✓_ d✓_e✓_l✓_e✓_t✓_e✓_-✓_i✓_f✓_-✓_n✓_o✓_t✓_,✓_ u✓_n✓_d✓_e✓_r✓_
- S✓_E✓_Q✓_U✓_E✓_N✓_C✓_E✓_ F✓_U✓_N✓_C✓_T✓_I✓_O✓_N✓_S✓_.✓_
-
- (rplaca <list> <expr>) REPLACE THE CAR OF A LIST NODE
- <list> the list node
- <expr> the new value for the car of the list node
- returns the list node after updating the car
-
- (rplacd <list> <expr>) REPLACE THE CDR OF A LIST NODE
- <list> the list node
- <expr> the new value for the cdr of the list node
- returns the list node after updating the cdr
-
- (nconc <list>...) DESTRUCTIVELY CONCATENATE LISTS
- <list> lists to concatenate
- returns the result of concatenating the lists
-
- (sort <list> <test>) SORT A LIST
- <list> the list to sort
- <test> the comparison function
- returns the sorted list
-
-
-
-
-
-
-
- XLISP 2.0 ARITHMETIC FUNCTIONS Page 37
-
-
-
- ARITHMETIC FUNCTIONS
-
- W✓_a✓_r✓_n✓_i✓_n✓_g✓_:✓_ i✓_n✓_t✓_e✓_g✓_e✓_r✓_ c✓_a✓_l✓_c✓_u✓_l✓_a✓_t✓_i✓_o✓_n✓_s✓_ t✓_h✓_a✓_t✓_ o✓_v✓_e✓_r✓_f✓_l✓_o✓_w✓_ g✓_i✓_v✓_e✓_ e✓_r✓_r✓_o✓_n✓_e✓_o✓_u✓_s✓_ r✓_e✓_s✓_u✓_l✓_t✓_s✓_.✓_
- A✓_S✓_I✓_N✓_,✓_ A✓_C✓_O✓_S✓_,✓_ a✓_n✓_d✓_ A✓_T✓_A✓_N✓_ a✓_r✓_e✓_ r✓_e✓_t✓_r✓_o✓_f✓_i✓_t✓_t✓_e✓_d✓_ f✓_r✓_o✓_m✓_ X✓_L✓_I✓_S✓_P✓_ 2✓_.✓_1✓_.✓_
-
- (truncate <expr>) TRUNCATES A FLOATING POINT NUMBER TO AN INTEGER
- <expr> the number
- returns the result of truncating the number
-
- (float <expr>) CONVERTS AN INTEGER TO A FLOATING POINT NUMBER
- <expr> the number
- returns the result of floating the integer
-
- (+ <expr>...) ADD A LIST OF NUMBERS
- <expr> the numbers
- returns the result of the addition
-
- (- <expr>...) SUBTRACT A LIST OF NUMBERS OR NEGATE A SINGLE NUMBER
- <expr> the numbers
- returns the result of the subtraction
-
- (* <expr>...) MULTIPLY A LIST OF NUMBERS
- <expr> the numbers
- returns the result of the multiplication
-
- (/ <expr>...) DIVIDE A LIST OF NUMBERS OR INVERT A SINGLE NUMBER
- <expr> the numbers
- returns the result of the division
-
- (1+ <expr>) ADD ONE TO A NUMBER
- <expr> the number
- returns the number plus one
-
- (1- <expr>) SUBTRACT ONE FROM A NUMBER
- <expr> the number
- returns the number minus one
-
- (rem <expr>...) REMAINDER OF A LIST OF NUMBERS
- <expr> the numbers
- returns the result of the remainder operation
-
- (min <expr>...) THE SMALLEST OF A LIST OF NUMBERS
- <expr> the expressions to be checked
- returns the smallest number in the list
-
- (max <expr>...) THE LARGEST OF A LIST OF NUMBERS
- <expr> the expressions to be checked
- returns the largest number in the list
-
-
-
-
-
-
-
- XLISP 2.0 ARITHMETIC FUNCTIONS Page 38
-
-
- (abs <expr>) THE ABSOLUTE VALUE OF A NUMBER
- <expr> the number
- returns the absolute value of the number
-
- (gcd <n1> <n2>...) COMPUTE THE GREATEST COMMON DIVISOR
- <n1> the first number (integer)
- <n2> the second number(s) (integer)
- returns the greatest common divisor
-
- (random <n>) COMPUTE A RANDOM NUMBER BETWEEN 1 and N-1
- <n> the upper bound (integer)
- returns a random number
-
- (sin <expr>) COMPUTE THE SINE OF A NUMBER
- <expr> the floating point number
- returns the sine of the number
-
- (cos <expr>) COMPUTE THE COSINE OF A NUMBER
- <expr> the floating point number
- returns the cosine of the number
-
- (tan <expr>) COMPUTE THE TANGENT OF A NUMBER
- <expr> the floating point number
- returns the tangent of the number
-
- (asin <expr>) COMPUTE THE ARC SINE OF A NUMBER
- <expr> the floating point number
- returns the arc sine of the number
-
- (acos <expr>) COMPUTE THE ARC COSINE OF A NUMBER
- <expr> the floating point number
- returns the arc cosine of the number
-
- (atan <expr>) COMPUTE THE ARC TANGENT OF A NUMBER
- <expr> the floating point number
- returns the arc tangent of the number
-
- (expt <x-expr> <y-expr>) COMPUTE X TO THE Y POWER
- <x-expr> the floating point number
- <y-expr> the floating point exponent
- returns x to the y power
-
- (exp <x-expr>) COMPUTE E TO THE X POWER
- <x-expr> the floating point number
- returns e to the x power
-
- (sqrt <expr>) COMPUTE THE SQUARE ROOT OF A NUMBER
- <expr> the floating point number
- returns the square root of the number
-
-
-
-
-
-
-
- XLISP 2.0 ARITHMETIC FUNCTIONS Page 39
-
-
- (< <n1> <n2>...) TEST FOR LESS THAN
- (<= <n1> <n2>...) TEST FOR LESS THAN OR EQUAL TO
- (= <n1> <n2>...) TEST FOR EQUAL TO
- (/= <n1> <n2>...) TEST FOR NOT EQUAL TO
- (>= <n1> <n2>...) TEST FOR GREATER THAN OR EQUAL TO
- (> <n1> <n2>...) TEST FOR GREATER THAN
- <n1> the first number to compare
- <n2> the second number to compare
- returns the result of comparing <n1> with <n2>...
-
-
-
-
-
-
-
- XLISP 2.0 BITWISE LOGICAL FUNCTIONS Page 40
-
-
-
- BITWISE LOGICAL FUNCTIONS
-
- (logand <expr>...) THE BITWISE AND OF A LIST OF NUMBERS
- <expr> the numbers
- returns the result of the and operation
-
- (logior <expr>...) THE BITWISE INCLUSIVE OR OF A LIST OF NUMBERS
- <expr> the numbers
- returns the result of the inclusive or operation
-
- (logxor <expr>...) THE BITWISE EXCLUSIVE OR OF A LIST OF NUMBERS
- <expr> the numbers
- returns the result of the exclusive or operation
-
- (lognot <expr>) THE BITWISE NOT OF A NUMBER
- <expr> the number
- returns the bitwise inversion of number
-
-
-
-
-
-
-
- XLISP 2.0 STRING FUNCTIONS Page 41
-
-
-
- STRING FUNCTIONS
-
- E✓_x✓_t✓_e✓_n✓_s✓_i✓_o✓_n✓_ b✓_e✓_y✓_o✓_n✓_d✓_ d✓_i✓_s✓_t✓_r✓_i✓_b✓_u✓_t✓_i✓_o✓_n✓_:✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_s✓_ w✓_i✓_t✓_h✓_ n✓_a✓_m✓_e✓_s✓_ s✓_t✓_a✓_r✓_t✓_i✓_n✓_g✓_ "✓_s✓_t✓_r✓_i✓_n✓_g✓_"✓_
- w✓_i✓_l✓_l✓_ a✓_l✓_s✓_o✓_ a✓_c✓_c✓_e✓_p✓_t✓_ a✓_ s✓_y✓_m✓_b✓_o✓_l✓_,✓_ i✓_n✓_ w✓_h✓_i✓_c✓_h✓_ c✓_a✓_s✓_e✓_ t✓_h✓_e✓_ s✓_y✓_m✓_b✓_o✓_l✓_'✓_s✓_ p✓_r✓_i✓_n✓_t✓_ n✓_a✓_m✓_e✓_ i✓_s✓_
- u✓_s✓_e✓_d✓_.✓_
-
- (string <expr>) MAKE A STRING FROM AN INTEGER ASCII VALUE
- <expr> a✓_n✓_ i✓_n✓_t✓_e✓_g✓_e✓_r✓_ (✓_w✓_h✓_i✓_c✓_h✓_ i✓_s✓_ f✓_i✓_r✓_s✓_t✓_ c✓_o✓_n✓_v✓_e✓_r✓_t✓_e✓_d✓_ i✓_n✓_t✓_o✓_ i✓_t✓_s✓_ A✓_S✓_C✓_I✓_I✓_
- c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_ v✓_a✓_l✓_u✓_e✓_)✓_,✓_ s✓_t✓_r✓_i✓_n✓_g✓_,✓_ c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_,✓_ o✓_r✓_ s✓_y✓_m✓_b✓_o✓_l✓_
- returns t✓_h✓_e✓_ s✓_t✓_r✓_i✓_n✓_g✓_ r✓_e✓_p✓_r✓_e✓_s✓_e✓_n✓_t✓_a✓_t✓_i✓_o✓_n✓_ o✓_f✓_ t✓_h✓_e✓_ a✓_r✓_g✓_u✓_m✓_e✓_n✓_t✓_
-
- (string-trim <bag> <str>) TRIM BOTH ENDS OF A STRING
- <bag> a string containing characters to trim
- <str> the string to trim
- returns a trimed copy of the string
-
- (string-left-trim <bag> <str>) TRIM THE LEFT END OF A STRING
- <bag> a string containing characters to trim
- <str> the string to trim
- returns a trimed copy of the string
-
- (string-right-trim <bag> <str>) TRIM THE RIGHT END OF A STRING
- <bag> a string containing characters to trim
- <str> the string to trim
- returns a trimed copy of the string
-
- (string-upcase <str> &key :start :end) CONVERT TO UPPERCASE
- <str> the string
- :start the starting offset
- :end the ending offset + 1 o✓_r✓_ N✓_I✓_L✓_ f✓_o✓_r✓_ e✓_n✓_d✓_ o✓_f✓_ s✓_t✓_r✓_i✓_n✓_g✓_
- returns a converted copy of the string
-
- (string-downcase <str> &key :start :end) CONVERT TO LOWERCASE
- <str> the string
- :start the starting offset
- :end the ending offset + 1 o✓_r✓_ N✓_I✓_L✓_ f✓_o✓_r✓_ e✓_n✓_d✓_ o✓_f✓_ s✓_t✓_r✓_i✓_n✓_g✓_
- returns a converted copy of the string
-
- (nstring-upcase <str> &key :start :end) CONVERT TO UPPERCASE
- <str> the string
- :start the starting offset
- :end the ending offset + 1 o✓_r✓_ N✓_I✓_L✓_ f✓_o✓_r✓_ e✓_n✓_d✓_ o✓_f✓_ s✓_t✓_r✓_i✓_n✓_g✓_
- returns the converted string (not a copy)
-
- (nstring-downcase <str> &key :start :end) CONVERT TO LOWERCASE
- <str> the string
- :start the starting offset
- :end the ending offset + 1 o✓_r✓_ N✓_I✓_L✓_ f✓_o✓_r✓_ e✓_n✓_d✓_ o✓_f✓_ s✓_t✓_r✓_i✓_n✓_g✓_
- returns the converted string (not a copy)
-
-
-
-
-
-
-
- XLISP 2.0 STRING FUNCTIONS Page 42
-
-
- (strcat <expr>...) CONCATENATE STRINGS
- M✓_a✓_c✓_r✓_o✓_ i✓_n✓_ i✓_n✓_i✓_t✓_.✓_l✓_s✓_p✓_,✓_ t✓_o✓_ m✓_a✓_i✓_n✓_t✓_a✓_i✓_n✓_ c✓_o✓_m✓_p✓_a✓_t✓_i✓_b✓_i✓_l✓_i✓_t✓_y✓_ w✓_i✓_t✓_h✓_ d✓_i✓_s✓_t✓_r✓_i✓_b✓_u✓_t✓_i✓_o✓_n✓_.✓_
- S✓_e✓_e✓_ "✓_c✓_o✓_n✓_c✓_a✓_t✓_e✓_n✓_a✓_t✓_e✓_"✓_.✓_
- <expr> the strings to concatenate
- returns the result of concatenating the strings
-
- (string< <str1> <str2> &key :start1 :end1 :start2 :end2)
- (string<= <str1> <str2> &key :start1 :end1 :start2 :end2)
- (string= <str1> <str2> &key :start1 :end1 :start2 :end2)
- (string/= <str1> <str2> &key :start1 :end1 :start2 :end2)
- (string>= <str1> <str2> &key :start1 :end1 :start2 :end2)
- (string> <str1> <str2> &key :start1 :end1 :start2 :end2)
- <str1> the first string to compare
- <str2> the second string to compare
- :start1 first substring starting offset
- :end1 first substring ending offset + 1 o✓_r✓_ N✓_I✓_L✓_ f✓_o✓_r✓_ e✓_n✓_d✓_ o✓_f✓_
- s✓_t✓_r✓_i✓_n✓_g✓_
- :start2 second substring starting offset
- :end2 second substring ending offset + 1 o✓_r✓_ N✓_I✓_L✓_ f✓_o✓_r✓_ e✓_n✓_d✓_ o✓_f✓_
- s✓_t✓_r✓_i✓_n✓_g✓_
- returns t if predicate is true, nil otherwise
- Note: case is significant with these comparison functions.
-
- (string-lessp <str1> <str2> &key :start1 :end1 :start2 :end2)
- (string-not-greaterp <str1> <str2> &key :start1 :end1 :start2 :end2)
- (string-equalp <str1> <str2> &key :start1 :end1 :start2 :end2)
- (string-not-equalp <str1> <str2> &key :start1 :end1 :start2 :end2)
- (string-not-lessp <str1> <str2> &key :start1 :end1 :start2 :end2)
- (string-greaterp <str1> <str2> &key :start1 :end1 :start2 :end2)
- <str1> the first string to compare
- <str2> the second string to compare
- :start1 first substring starting offset
- :end1 first substring ending offset + 1 o✓_r✓_ N✓_I✓_L✓_ f✓_o✓_r✓_ e✓_n✓_d✓_ o✓_f✓_
- s✓_t✓_r✓_i✓_n✓_g✓_
- :start2 second substring starting offset
- :end2 second substring ending offset + 1 o✓_r✓_ N✓_I✓_L✓_ f✓_o✓_r✓_ e✓_n✓_d✓_ o✓_f✓_
- s✓_t✓_r✓_i✓_n✓_g✓_
- returns t if predicate is true, nil otherwise
- Note: case is not significant with these comparison functions.
-
-
-
-
-
-
-
- XLISP 2.0 CHARACTER FUNCTIONS Page 43
-
-
-
- CHARACTER FUNCTIONS
-
- (char <string> <index>) EXTRACT A CHARACTER FROM A STRING
- <string> the string
- <index> the string index (zero relative)
- returns the ascii code of the character
-
- (upper-case-p <chr>) IS THIS AN UPPER CASE CHARACTER?
- <chr> the character
- returns true if the character is upper case, nil otherwise
-
- (lower-case-p <chr>) IS THIS A LOWER CASE CHARACTER?
- <chr> the character
- returns true if the character is lower case, nil otherwise
-
- (both-case-p <chr>) IS THIS AN ALPHABETIC (EITHER CASE) CHARACTER?
- <chr> the character
- returns true if the character is alphabetic, nil otherwise
-
- (digit-char-p <chr>) IS THIS A DIGIT CHARACTER?
- <chr> the character
- returns the digit weight if character is a digit, nil otherwise
-
- (char-code <chr>) GET THE ASCII CODE OF A CHARACTER
- <chr> the character
- returns the ASCII character code (integer,✓_ p✓_a✓_r✓_i✓_t✓_y✓_ b✓_i✓_t✓_ s✓_t✓_r✓_i✓_p✓_p✓_e✓_d✓_)
-
- (code-char <code>) GET THE CHARACTER WITH A SPECFIED ASCII CODE
- <code> the ASCII code (integer,✓_ r✓_a✓_n✓_g✓_e✓_ 0✓_-✓_1✓_2✓_7✓_)
- returns the character with that code or nil
-
- (char-upcase <chr>) CONVERT A CHARACTER TO UPPER CASE
- <chr> the character
- returns the upper case character
-
- (char-downcase <chr>) CONVERT A CHARACTER TO LOWER CASE
- <chr> the character
- returns the lower case character
-
- (digit-char <n>) CONVERT A DIGIT WEIGHT TO A DIGIT
- <n> the digit weight (integer)
- returns the digit character or nil
-
- (char-int <chr>) CONVERT A CHARACTER TO AN INTEGER
- <chr> the character
- returns the ASCII character code (✓_r✓_a✓_n✓_g✓_e✓_ 0✓_-✓_2✓_5✓_5✓_)✓_
-
- (int-char <int>) CONVERT AN INTEGER TO A CHARACTER
- <int> the ASCII character code (✓_t✓_r✓_e✓_a✓_t✓_e✓_d✓_ m✓_o✓_d✓_u✓_l✓_o✓_ 2✓_5✓_6✓_)✓_
- returns the character with that code
-
-
-
-
-
-
-
- XLISP 2.0 CHARACTER FUNCTIONS Page 44
-
-
- (char< <chr1> <chr2>...)
- (char<= <chr1> <chr2>...)
- (char= <chr1> <chr2>...)
- (char/= <chr1> <chr2>...)
- (char>= <chr1> <chr2>...)
- (char> <chr1> <chr2>...)
- <chr1> the first character to compare
- <chr2> the second character(s) to compare
- returns t if predicate is true, nil otherwise
- Note: case is significant with these comparison functions.
-
- (char-lessp <chr1> <chr2>...)
- (char-not-greaterp <chr1> <chr2>...)
- (char-equalp <chr1> <chr2>...)
- (char-not-equalp <chr1> <chr2>...)
- (char-not-lessp <chr1> <chr2>...)
- (char-greaterp <chr1> <chr2>...)
- <chr1> the first string to compare
- <chr2> the second string(s) to compare
- returns t if predicate is true, nil otherwise
- Note: case is not significant with these comparison functions.
-
-
-
-
-
-
-
- XLISP 2.0 STRUCTURE FUNCTIONS Page 45
-
-
-
- STRUCTURE FUNCTIONS
-
- (✓_A✓_d✓_d✓_e✓_d✓_ f✓_e✓_a✓_t✓_u✓_r✓_e✓_ f✓_r✓_o✓_m✓_ X✓_L✓_I✓_S✓_P✓_ 2✓_.✓_1✓_)✓_
-
- XLISP provides a subset of the Common Lisp structure definition
- facility. No slot options are allowed, but slots can have default
- initialization expressions.
-
- (defstruct name <slot-desc>...)
- or
- (defstruct (name <option>...) <slot-desc>...)
- fsubr
- <name> the structure name symbol (quoted)
- <option> option description (quoted)
- <slot-desc> slot descriptions (quoted)
- returns the structure name
-
- The recognized options are:
-
- (:conc-name name)
- (:include name [<slot-desc>...])
-
- Note that if :CONC-NAME appears, it should be before :INCLUDE.
-
- Each slot description takes the form:
-
- <name>
- or
- (<name> <defexpr>)
-
- If the default initialization expression is not specified, the slot
- will be initialized to NIL if no keyword argument is passed to the
- creation function.
-
- DEFSTRUCT causes access functions to be created for each of the slots
- and also arranges that SETF will work with those access functions. The
- access function names are constructed by taking the structure name,
- appending a '-' and then appending the slot name. This can be
- overridden by using the :CONC-NAME option.
-
- DEFSTRUCT also makes a creation function called MAKE-<structname>, a
- copy function called COPY-<structname> and a predicate function called
- <structname>-P. The creation function takes keyword arguments for each
- of the slots. Structures can be created using the #S( read macro, as
- well.
-
- The property *struct-slots* is added to the symbol that names the
- structure. This property consists of an association list of slot names
- and closures that evaluate to the initial values (NIL if no initial
- value expression).
-
-
-
-
-
-
-
- XLISP 2.0 STRUCTURE FUNCTIONS Page 46
-
-
- For instance:
-
- (defstruct foo bar (gag 2))
-
- creates the following functions:
-
- (foo-bar <expr>)
- (setf (foo-bar <expr>) <value>)
- (foo-gag <expr>)
- (setf (foo-gag <expr>) <value>)
- (make-foo &key :bar :gag)
- (copy-foo <expr>)
- (foo-p <expr>)
-
-
-
-
-
-
-
- XLISP 2.0 OBJECT FUNCTIONS Page 47
-
-
-
- OBJECT FUNCTIONS
-
- T✓_h✓_i✓_s✓_ s✓_e✓_c✓_t✓_i✓_o✓_n✓_ i✓_s✓_ c✓_o✓_m✓_p✓_l✓_e✓_t✓_e✓_l✓_y✓_ n✓_e✓_w✓_.✓_ N✓_o✓_t✓_e✓_ t✓_h✓_a✓_t✓_ t✓_h✓_e✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_s✓_ p✓_r✓_o✓_v✓_i✓_d✓_e✓_d✓_ i✓_n✓_
- c✓_l✓_a✓_s✓_s✓_e✓_s✓_.✓_l✓_s✓_p✓_ a✓_r✓_e✓_ u✓_s✓_e✓_f✓_u✓_l✓_ b✓_u✓_t✓_ n✓_o✓_t✓_ n✓_e✓_c✓_e✓_s✓_s✓_a✓_r✓_y✓_.✓_
-
- Messages defined for Object and Class are listed starting on page 17.
-
- (send <object> <message> [<args>...]) SEND A MESSAGE
- <object> the object to receive the message
- <message> message sent to object
- <args> arguments to method (if any)
- returns the result of the method
-
- (send-super <message> [<args>]) SEND A MESSAGE TO SUPERCLASS
- valid only in method context
- <message> message sent to objects superclass
- <args> arguments to method (if any)
- returns the result of the method
-
- (defclass <sym> <ivars> [<cvars> [<super>]]) DEFINE A NEW CLASS
- defined in class.lsp as a macro
- <sym> symbol whose value is to be bound to the class object
- (quoted)
- <ivars> list of instance variables (quoted). Instance variables
- specified either as <ivar> or (<ivar> <init>) to
- specify non-nil default initial value.
- <cvars> list of class variables (quoted)
- <super> superclass, or Object if absent.
- This function sends :SET-PNAME (defined in classes.lsp) to the
- new class to set the class' print name instance variable.
- Methods defined for classes defined with defclass:
- (send <object> :<ivar>)
- Returns the specified instance variable
- (send <object> :SET-IVAR <ivar> <value>)
- Used to set an instance variable, typically with setf.
- (send <sym> :NEW {:<ivar> <init>})
- Actually definition for :ISNEW. Creates new object
- initializing instance variables as specified in keyword
- arguments, or to their default if keyword argument is
- missing. Returns the object.
-
- (defmethod <class> <sym> <fargs> <expr> ...) DEFINE A NEW METHOD
- defined in class.lsp as a macro
- <class> Class which will respond to message
- <sym> Message name (quoted)
- <fargs> Formal argument list. Leading "self" is implied
- (quoted)
- <expr> Expressions constituting body of method (quoted)
- returns the class object.
-
-
-
-
-
-
-
- XLISP 2.0 OBJECT FUNCTIONS Page 48
-
-
- (definst <class> <sym> [<args>...]) DEFINE A NEW GLOBAL INSTANCE
- defined in class.lsp as a macro
- <class> Class of new object
- <sym> Symbol whose value will be set to new object
- <args> Arguments passed to :NEW (typically initial values for
- instance variables)
-
-
-
-
-
-
-
- XLISP 2.0 PREDICATE FUNCTIONS Page 49
-
-
-
- PREDICATE FUNCTIONS
-
- (atom <expr>) IS THIS AN ATOM?
- <expr> the expression to check
- returns t if the value is an atom, nil otherwise
-
- (symbolp <expr>) IS THIS A SYMBOL?
- <expr> the expression to check
- returns t if the expression is a symbol, nil otherwise
-
- (numberp <expr>) IS THIS A NUMBER?
- <expr> the expression to check
- returns t if the expression is a number, nil otherwise
-
- (null <expr>) IS THIS AN EMPTY LIST?
- <expr> the list to check
- returns t if the list is empty, nil otherwise
-
- (not <expr>) IS THIS FALSE?
- <expr> the expression to check
- return t if the value is nil, nil otherwise
-
- (listp <expr>) IS THIS A LIST?
- <expr> the expression to check
- returns t if the value is a cons or nil, nil otherwise
-
- (endp <list>) IS THIS THE END OF A LIST?
- <list> the list
- returns t if the value is nil, nil otherwise
-
- (consp <expr>) IS THIS A NON-EMPTY LIST?
- <expr> the expression to check
- returns t if the value is a cons, nil otherwise
-
- (integerp <expr>) IS THIS AN INTEGER?
- <expr> the expression to check
- returns t if the value is an integer, nil otherwise
-
- (floatp <expr>) IS THIS A FLOAT?
- <expr> the expression to check
- returns t if the value is a float, nil otherwise
-
- (stringp <expr>) IS THIS A STRING?
- <expr> the expression to check
- returns t if the value is a string, nil otherwise
-
- (characterp <expr>) IS THIS A CHARACTER?
- <expr> the expression to check
- returns t if the value is a character, nil otherwise
-
-
-
-
-
-
-
- XLISP 2.0 PREDICATE FUNCTIONS Page 50
-
-
- (arrayp <expr>) IS THIS AN ARRAY?
- <expr> the expression to check
- returns t if the value is an array, nil otherwise
-
- (streamp <expr>) IS THIS A STREAM?
- <expr> the expression to check
- returns t if the value is a stream, nil otherwise
-
- (objectp <expr>) IS THIS AN OBJECT?
- <expr> the expression to check
- returns t if the value is an object, nil otherwise
-
- (classp <expr>) IS THIS A CLASS OBJECT?
- <expr> the expression to check
- returns t if the value is a class object, nil otherwise
-
- (boundp <sym>) IS A VALUE BOUND TO THIS SYMBOL?
- <sym> the symbol
- returns t if a value is bound to the symbol, nil otherwise
-
- (fboundp <sym>) IS A FUNCTIONAL VALUE BOUND TO THIS SYMBOL?
- <sym> the symbol
- returns t if a functional value is bound to the symbol, nil
- otherwise
-
- (minusp <expr>) IS THIS NUMBER NEGATIVE?
- <expr> the number to test
- returns t if the number is negative, nil otherwise
-
- (zerop <expr>) IS THIS NUMBER ZERO?
- <expr> the number to test
- returns t if the number is zero, nil otherwise
-
- (plusp <expr>) IS THIS NUMBER POSITIVE?
- <expr> the number to test
- returns t if the number is positive, nil otherwise
-
- (evenp <expr>) IS THIS INTEGER EVEN?
- <expr> the integer to test
- returns t if the integer is even, nil otherwise
-
- (oddp <expr>) IS THIS INTEGER ODD?
- <expr> the integer to test
- returns t if the integer is odd, nil otherwise
-
- (eq <expr1> <expr2>) ARE THE EXPRESSIONS IDENTICAL?
- <expr1> the first expression
- <expr2> the second expression
- returns t if they are equal, nil otherwise
-
-
-
-
-
-
-
- XLISP 2.0 PREDICATE FUNCTIONS Page 51
-
-
- (eql <expr1> <expr2>) ARE THE EXPRESSIONS IDENTICAL?
- Note: works with all numbers
- <expr1> the first expression
- <expr2> the second expression
- returns t if they are equal, nil otherwise
-
- (equal <expr1> <expr2>) ARE THE EXPRESSIONS EQUAL?
- <expr1> the first expression
- <expr2> the second expression
- returns t if they are equal, nil otherwise
-
-
-
-
-
-
-
- XLISP 2.0 CONTROL CONSTRUCTS Page 52
-
-
-
- CONTROL CONSTRUCTS
-
- (cond <pair>...) EVALUATE CONDITIONALLY
- f✓_s✓_u✓_b✓_r✓_
- <pair> pair consisting of:
- (<pred> <expr>...)
- where
- <pred> is a predicate expression
- <expr> evaluated if the predicate is not nil
- returns the value of the first expression whose predicate is
- not nil
-
- (and <expr>...) THE LOGICAL AND OF A LIST OF EXPRESSIONS
- f✓_s✓_u✓_b✓_r✓_
- <expr> the expressions to be ANDed
- returns nil if any expression evaluates to nil, otherwise the
- value of the last expression (evaluation of expressions
- stops after the first expression that evaluates to nil)
-
- (or <expr>...) THE LOGICAL OR OF A LIST OF EXPRESSIONS
- f✓_s✓_u✓_b✓_r✓_
- <expr> the expressions to be ORed
- returns nil if all expressions evaluate to nil, otherwise the
- value of the first non-nil expression (evaluation of
- expressions stops after the first expression that does
- not evaluate to nil)
-
- (if <texpr> <expr1> [<expr2>]) EVALUATE EXPRESSIONS CONDITIONALLY
- f✓_s✓_u✓_b✓_r✓_
- <texpr> the test expression
- <expr1> the expression to be evaluated if texpr is non-nil
- <expr2> the expression to be evaluated if texpr is nil
- returns the value of the selected expression
-
- (when <texpr> <expr>...) EVALUATE ONLY WHEN A CONDITION IS TRUE
- f✓_s✓_u✓_b✓_r✓_
- <texpr> the test expression
- <expr> the expression(s) to be evaluted if texpr is non-nil
- returns the value of the last expression or nil
-
- (unless <texpr> <expr>...) EVALUATE ONLY WHEN A CONDITION IS FALSE
- f✓_s✓_u✓_b✓_r✓_
- <texpr> the test expression
- <expr> the expression(s) to be evaluated if texpr is nil
- returns the value of the last expression or nil
-
-
-
-
-
-
-
- XLISP 2.0 CONTROL CONSTRUCTS Page 53
-
-
- (case <expr> <case>...[(t <expr>)]) SELECT BY CASE
- f✓_s✓_u✓_b✓_r✓_
- <expr> the selection expression
- <case> pair consisting of:
- (<value> <expr>...)
- where:
- <value> is a single expression or a list of
- expressions (unevaluated)
- <expr> are expressions to execute if the case
- matches
- (t <expr>) default case (no previous matching)
- returns the value of the last expression of the matching case
-
- (let (<binding>...) <expr>...) CREATE LOCAL BINDINGS
- (let* (<binding>...) <expr>...) LET WITH SEQUENTIAL BINDING
- f✓_s✓_u✓_b✓_r✓_
- <binding> the variable bindings each of which is either:
- 1) a symbol (which is initialized to nil)
- 2) a list whose car is a symbol and whose cadr
- is an initialization expression
- <expr> the expressions to be evaluated
- returns the value of the last expression
-
- (flet (<binding>...) <expr>...) CREATE LOCAL FUNCTIONS
- (labels (<binding>...) <expr>...) FLET WITH RECURSIVE FUNCTIONS
- (macrolet (<binding>...) <expr>...) CREATE LOCAL MACROS
- f✓_s✓_u✓_b✓_r✓_
- <binding> the function bindings each of which is:
- (<sym> <fargs> <expr>...)
- where:
- <sym> the function/macro name
- <fargs> formal argument list (lambda list)
- <expr> expressions constituting the body of the
- function/macro
- <expr> the expressions to be evaluated
- returns the value of the last expression
-
- (catch <sym> <expr>...) EVALUATE EXPRESSIONS AND CATCH THROWS
- f✓_s✓_u✓_b✓_r✓_
- <sym> the catch tag
- <expr> expressions to evaluate
- returns the value of the last expression the throw expression
-
- (throw <sym> [<expr>]) THROW TO A CATCH
- f✓_s✓_u✓_b✓_r✓_
- <sym> the catch tag
- <expr> the value for the catch to return (defaults to nil)
- returns never returns
-
-
-
-
-
-
-
- XLISP 2.0 CONTROL CONSTRUCTS Page 54
-
-
- (unwind-protect <expr> <cexpr>...) PROTECT EVALUATION OF AN EXPRESSION
- f✓_s✓_u✓_b✓_r✓_
- <expr> the expression to protect
- <cexpr> the cleanup expressions
- returns the value of the expression
- Note: unwind-protect guarantees to execute the cleanup
- expressions even if a non-local exit terminates the evaluation of
- the protected expression
-
-
-
-
-
-
-
- XLISP 2.0 LOOPING CONSTRUCTS Page 55
-
-
-
- LOOPING CONSTRUCTS
-
- (loop <expr>...) BASIC LOOPING FORM
- f✓_s✓_u✓_b✓_r✓_
- <expr> the body of the loop
- returns never returns (must use non-local exit)
-
- (do (<binding>...) (<texpr> <rexpr>...) <expr>...)GENERAL LOOPING FORM
- (do* (<binding>...) (<texpr> <rexpr>...) <expr>...)
- f✓_s✓_u✓_b✓_r✓_.✓_ d✓_o✓_ b✓_i✓_n✓_d✓_s✓_ s✓_i✓_m✓_u✓_l✓_t✓_a✓_n✓_e✓_o✓_u✓_s✓_l✓_y✓_,✓_ d✓_o✓_*✓_ b✓_i✓_n✓_d✓_s✓_ s✓_e✓_q✓_u✓_e✓_n✓_t✓_i✓_a✓_l✓_l✓_y✓_
- <binding> the variable bindings each of which is either:
- 1) a symbol (which is initialized to nil)
- 2) a list of the form: (<sym> <init> [<step>])
- where:
- <sym> is the symbol to bind
- <init> the initial value of the symbol
- <step> a step expression
- <texpr> the termination test expression
- <rexpr> result expressions (the default is nil)
- <expr> the body of the loop (treated like an implicit prog)
- returns the value of the last result expression
-
- (dolist (<sym> <expr> [<rexpr>]) <expr>...) LOOP THROUGH A LIST
- f✓_s✓_u✓_b✓_r✓_
- <sym> the symbol to bind to each list element
- <expr> the list expression
- <rexpr> the result expression (the default is nil)
- <expr> the body of the loop (treated like an implicit prog)
-
- (dotimes (<sym> <expr> [<rexpr>]) <expr>...) LOOP FROM ZERO TO N-1
- f✓_s✓_u✓_b✓_r✓_
- <sym> the symbol to bind to each value from 0 to n-1
- <expr> the number of times to loop
- <rexpr> the result expression (the default is nil)
- <expr> the body of the loop (treated like an implicit prog)
-
-
-
-
-
-
-
- XLISP 2.0 THE PROGRAM FEATURE Page 56
-
-
-
- THE PROGRAM FEATURE
-
- (prog (<binding>...) <expr>...) THE PROGRAM FEATURE
- (prog* (<binding>...) <expr>...) PROG WITH SEQUENTIAL BINDING
- f✓_s✓_u✓_b✓_r✓_
- <binding> the variable bindings each of which is either:
- 1) a symbol (which is initialized to nil)
- 2) a list whose car is a symbol and whose cadr
- is an initialization expression
- <expr> expressions to evaluate or tags (symbols)
- returns nil or the argument passed to the return function
-
- (block <name> <expr>...) NAMED BLOCK
- f✓_s✓_u✓_b✓_r✓_
- <name> the block name (quoted symbol)
- <expr> the block body
- returns the value of the last expression
-
- (return [<expr>]) CAUSE A PROG CONSTRUCT TO RETURN A VALUE
- f✓_s✓_u✓_b✓_r✓_
- <expr> the value (defaults to nil)
- returns never returns
-
- (return-from <name> [<value>]) RETURN FROM A NAMED BLOCK O✓_R✓_ F✓_U✓_N✓_C✓_T✓_I✓_O✓_N✓_
- f✓_s✓_u✓_b✓_r✓_
- <name> the block o✓_r✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_ name (quoted symbol)
- <value> the value to return (defaults to nil)
- returns never returns
-
- (tagbody <expr>...) BLOCK WITH LABELS
- f✓_s✓_u✓_b✓_r✓_
- <expr> expression(s) to evaluate or tags (symbols)
- returns nil
-
- (go <sym>) GO TO A TAG WITHIN A TAGBODY OR PROG
- f✓_s✓_u✓_b✓_r✓_
- <sym> the tag (quoted)
- returns never returns
-
- (progv <slist> <vlist> <expr>...) DYNAMICALLY BIND SYMBOLS
- f✓_s✓_u✓_b✓_r✓_
- <slist> list of symbols (evaluated)
- <vlist> list of values to bind to the symbols (evaluated)
- <expr> expression(s) to evaluate
- returns the value of the last expression
-
-
-
-
-
-
-
- XLISP 2.0 THE PROGRAM FEATURE Page 57
-
-
- (prog1 <expr1> <expr>...) EXECUTE EXPRESSIONS SEQUENTIALLY
- f✓_s✓_u✓_b✓_r✓_
- <expr1> the first expression to evaluate
- <expr> the remaining expressions to evaluate
- returns the value of the first expression
-
- (prog2 <expr1> <expr2> <expr>...) EXECUTE EXPRESSIONS SEQUENTIALLY
- f✓_s✓_u✓_b✓_r✓_
- <expr1> the first expression to evaluate
- <expr2> the second expression to evaluate
- <expr> the remaining expressions to evaluate
- returns the value of the second expression
-
- (progn <expr>...) EXECUTE EXPRESSIONS SEQUENTIALLY
- f✓_s✓_u✓_b✓_r✓_
- <expr> the expressions to evaluate
- returns the value of the last expression (or nil)
-
-
-
-
-
-
-
- XLISP 2.0 INPUT/OUTPUT FUNCTIONS Page 58
-
-
-
- INPUT/OUTPUT FUNCTIONS
-
- N✓_o✓_t✓_e✓_ t✓_h✓_a✓_t✓_ w✓_h✓_e✓_n✓_ p✓_r✓_i✓_n✓_t✓_i✓_n✓_g✓_ o✓_b✓_j✓_e✓_c✓_t✓_s✓_,✓_ p✓_r✓_i✓_n✓_t✓_i✓_n✓_g✓_ i✓_s✓_ a✓_c✓_c✓_o✓_m✓_p✓_l✓_i✓_s✓_h✓_e✓_d✓_ b✓_y✓_ s✓_e✓_n✓_d✓_i✓_n✓_g✓_
- t✓_h✓_e✓_ m✓_e✓_s✓_s✓_a✓_g✓_e✓_ :✓_p✓_r✓_i✓_n✓_1✓_ t✓_o✓_ t✓_h✓_e✓_ o✓_b✓_j✓_e✓_c✓_t✓_ (✓_t✓_h✓_i✓_s✓_ i✓_s✓_ a✓_ m✓_o✓_d✓_i✓_f✓_i✓_c✓_a✓_t✓_i✓_o✓_n✓_ o✓_f✓_ t✓_h✓_e✓_
- d✓_i✓_s✓_t✓_r✓_i✓_b✓_u✓_t✓_i✓_o✓_n✓_)✓_.✓_
-
- (read [<stream> [<eof> [<rflag>]]]) READ AN EXPRESSION
- <stream> the input stream (default is *standard-input*)
- <eof> the value to return on end of file (default is nil)
- <rflag> recursive read flag (default is nil, u✓_n✓_u✓_s✓_e✓_d✓_ i✓_n✓_ t✓_h✓_i✓_s✓_
- i✓_m✓_p✓_l✓_e✓_m✓_e✓_n✓_t✓_a✓_t✓_i✓_o✓_n✓_)
- returns the expression read
-
- (✓_s✓_e✓_t✓_-✓_m✓_a✓_c✓_r✓_o✓_-✓_c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_ <✓_c✓_h✓_>✓_ <✓_f✓_c✓_n✓_>✓_ [✓_ T✓_ ]✓_)✓_ M✓_O✓_D✓_I✓_F✓_Y✓_ R✓_E✓_A✓_D✓_ T✓_A✓_B✓_L✓_E✓_
- d✓_e✓_f✓_i✓_n✓_e✓_d✓_ i✓_n✓_ i✓_n✓_i✓_t✓_.✓_l✓_s✓_p✓_
- <✓_c✓_h✓_>✓_ c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_ t✓_o✓_ d✓_e✓_f✓_i✓_n✓_e✓_
- <✓_f✓_c✓_n✓_>✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_ t✓_o✓_ b✓_i✓_n✓_d✓_ t✓_o✓_ c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_ (✓_s✓_e✓_e✓_ p✓_a✓_g✓_e✓_ 1✓_2✓_)✓_
- T✓_ i✓_f✓_ T✓_M✓_A✓_C✓_R✓_O✓_ r✓_a✓_t✓_h✓_e✓_r✓_ t✓_h✓_a✓_n✓_ N✓_M✓_A✓_C✓_R✓_O✓_
-
- (✓_g✓_e✓_t✓_-✓_m✓_a✓_c✓_r✓_o✓_-✓_c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_ <✓_c✓_h✓_>✓_)✓_ E✓_X✓_A✓_M✓_I✓_N✓_E✓_ R✓_E✓_A✓_D✓_ T✓_A✓_B✓_L✓_E✓_
- d✓_e✓_f✓_i✓_n✓_e✓_d✓_ i✓_n✓_ i✓_n✓_i✓_t✓_.✓_l✓_s✓_p✓_
- <✓_c✓_h✓_>✓_ c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_ b✓_o✓_u✓_n✓_d✓_ t✓_o✓_ c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_
-
- (print <expr> [<stream>]) PRINT AN EXPRESSION ON A NEW LINE
- <expr> the expression to be printed
- <stream> the output stream (default is *standard-output*)
- returns the expression
-
- (prin1 <expr> [<stream>]) PRINT AN EXPRESSION
- s✓_y✓_m✓_b✓_o✓_l✓_s✓_,✓_ c✓_o✓_n✓_s✓_ c✓_e✓_l✓_l✓_s✓_ (✓_w✓_i✓_t✓_h✓_o✓_u✓_t✓_ c✓_i✓_r✓_c✓_u✓_l✓_a✓_r✓_i✓_t✓_i✓_e✓_s✓_)✓_,✓_ a✓_r✓_r✓_a✓_y✓_s✓_,✓_ s✓_t✓_r✓_i✓_n✓_g✓_s✓_,✓_ a✓_n✓_d✓_
- c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_s✓_ a✓_r✓_e✓_ p✓_r✓_i✓_n✓_t✓_e✓_d✓_ i✓_n✓_ a✓_ f✓_o✓_r✓_m✓_a✓_t✓_ a✓_c✓_c✓_e✓_p✓_t✓_a✓_b✓_l✓_e✓_ t✓_o✓_ t✓_h✓_e✓_ r✓_e✓_a✓_d✓_
- f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_.✓_
- <expr> the expression to be printed
- <stream> the output stream (default is *standard-output*)
- returns the expression
-
- (princ <expr> [<stream>]) PRINT AN EXPRESSION WITHOUT QUOTING
- <expr> the expressions to be printed
- <stream> the output stream (default is *standard-output*)
- returns the expression
-
- (pprint <expr> [<stream>]) PRETTY PRINT AN EXPRESSION
- <expr> the expressions to be printed
- <stream> the output stream (default is *standard-output*)
- returns the expression
-
- (terpri [<stream>]) TERMINATE THE CURRENT PRINT LINE
- <stream> the output stream (default is *standard-output*)
- returns nil
-
-
-
-
-
-
-
- XLISP 2.0 INPUT/OUTPUT FUNCTIONS Page 59
-
-
- (flatsize <expr>) LENGTH OF PRINTED REPRESENTATION USING PRIN1
- <expr> the expression
- returns the length
-
- (flatc <expr>) LENGTH OF PRINTED REPRESENTATION USING PRINC
- <expr> the expression
- returns the length
-
-
-
-
-
-
-
- XLISP 2.0 THE FORMAT FUNCTION Page 60
-
-
-
- THE FORMAT FUNCTION
-
- (format <stream> <fmt> <arg>...) DO FORMATTED OUTPUT
- <stream> the output stream
- <fmt> the format string
- <arg> the format arguments
- returns output string if <stream> is nil, nil otherwise
-
- I✓_f✓_ <✓_s✓_t✓_r✓_e✓_a✓_m✓_>✓_ i✓_s✓_ T✓_,✓_ t✓_h✓_e✓_n✓_ *✓_S✓_T✓_A✓_N✓_D✓_A✓_R✓_D✓_-✓_O✓_U✓_T✓_P✓_U✓_T✓_*✓_ i✓_s✓_ a✓_s✓_s✓_u✓_m✓_e✓_d✓_.✓_
-
- The format string can contain characters that should be copied
- directly to the output and formatting directives. The formatting
- directives are:
-
- ~A o✓_r✓_ ~✓_a✓_ print next argument using princ
- ~S o✓_r✓_ ~✓_s✓_ print next argument using prin1
- ~% start a new line
- ~~ print a tilde character
- ~✓_\✓_n✓_ i✓_g✓_n✓_o✓_r✓_e✓_ r✓_e✓_t✓_u✓_r✓_n✓_ a✓_n✓_d✓_ f✓_o✓_l✓_l✓_o✓_w✓_i✓_n✓_g✓_ w✓_h✓_i✓_t✓_e✓_s✓_p✓_a✓_c✓_e✓_
-
- I✓_f✓_ X✓_L✓_I✓_S✓_P✓_ i✓_s✓_ c✓_o✓_m✓_p✓_i✓_l✓_e✓_d✓_ w✓_i✓_t✓_h✓_ E✓_N✓_H✓_F✓_O✓_R✓_M✓_A✓_T✓_ d✓_e✓_f✓_i✓_n✓_e✓_d✓_,✓_ t✓_h✓_e✓_n✓_ t✓_h✓_e✓_ f✓_o✓_r✓_m✓_a✓_t✓_
- d✓_i✓_r✓_e✓_c✓_t✓_i✓_v✓_e✓_s✓_ c✓_a✓_n✓_ c✓_o✓_n✓_t✓_a✓_i✓_n✓_ o✓_p✓_t✓_i✓_o✓_n✓_a✓_l✓_ p✓_r✓_e✓_f✓_i✓_x✓_ a✓_n✓_d✓_ o✓_p✓_t✓_i✓_o✓_n✓_a✓_l✓_ c✓_o✓_l✓_o✓_n✓_ (✓_:✓_)✓_ o✓_r✓_ a✓_t✓_-✓_
- s✓_i✓_g✓_n✓_ (✓_@✓_)✓_ m✓_o✓_d✓_i✓_f✓_i✓_e✓_r✓_s✓_ b✓_e✓_t✓_w✓_e✓_e✓_n✓_ t✓_h✓_e✓_ t✓_i✓_l✓_d✓_e✓_ a✓_n✓_d✓_ d✓_i✓_r✓_e✓_c✓_t✓_i✓_v✓_e✓_ c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_.✓_ P✓_r✓_e✓_f✓_i✓_x✓_
- c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_s✓_ a✓_r✓_e✓_ u✓_n✓_s✓_i✓_g✓_n✓_e✓_d✓_ i✓_n✓_t✓_e✓_g✓_e✓_r✓_s✓_,✓_ o✓_r✓_ t✓_h✓_e✓_ c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_ '✓_v✓_'✓_ t✓_o✓_ i✓_n✓_d✓_i✓_c✓_a✓_t✓_e✓_ t✓_h✓_e✓_
- n✓_u✓_m✓_b✓_e✓_r✓_ i✓_s✓_ t✓_a✓_k✓_e✓_n✓_ f✓_r✓_o✓_m✓_ t✓_h✓_e✓_ n✓_e✓_x✓_t✓_ a✓_r✓_g✓_u✓_m✓_e✓_n✓_t✓_,✓_ o✓_r✓_ a✓_ s✓_i✓_n✓_g✓_l✓_e✓_ q✓_u✓_o✓_t✓_e✓_ (✓_'✓_)✓_ f✓_o✓_l✓_l✓_o✓_w✓_e✓_d✓_
- b✓_y✓_ a✓_ s✓_i✓_n✓_g✓_l✓_e✓_ c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_ f✓_o✓_r✓_ t✓_h✓_o✓_s✓_e✓_ p✓_a✓_r✓_a✓_m✓_e✓_t✓_e✓_r✓_s✓_ t✓_h✓_a✓_t✓_ s✓_h✓_o✓_u✓_l✓_d✓_ b✓_e✓_ a✓_ s✓_i✓_n✓_g✓_l✓_e✓_
- c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_.✓_
-
- F✓_o✓_r✓_ ~✓_A✓_ a✓_n✓_d✓_ ~✓_S✓_ t✓_h✓_e✓_ f✓_u✓_l✓_l✓_ f✓_o✓_r✓_m✓_ i✓_s✓_:✓_
-
- ~✓_m✓_i✓_n✓_c✓_o✓_l✓_,✓_c✓_o✓_l✓_i✓_n✓_c✓_,✓_m✓_i✓_n✓_p✓_a✓_d✓_,✓_p✓_a✓_d✓_c✓_h✓_a✓_r✓_:✓_@✓_A✓_ (✓_o✓_r✓_ S✓_)✓_
-
- T✓_h✓_e✓_ s✓_t✓_r✓_i✓_n✓_g✓_ i✓_s✓_ p✓_a✓_d✓_d✓_e✓_d✓_ o✓_n✓_ t✓_h✓_e✓_ r✓_i✓_g✓_h✓_t✓_ (✓_o✓_r✓_ l✓_e✓_f✓_t✓_,✓_ i✓_s✓_ @✓_ i✓_s✓_ g✓_i✓_v✓_e✓_n✓_)✓_ w✓_i✓_t✓_h✓_ a✓_t✓_
- l✓_e✓_a✓_s✓_t✓_ "✓_m✓_i✓_n✓_p✓_a✓_d✓_"✓_ c✓_o✓_p✓_i✓_e✓_s✓_ o✓_f✓_ t✓_h✓_e✓_ "✓_p✓_a✓_d✓_c✓_h✓_a✓_r✓_"✓_.✓_ P✓_a✓_d✓_d✓_i✓_n✓_g✓_ c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_s✓_ a✓_r✓_e✓_ t✓_h✓_e✓_n✓_
- i✓_n✓_s✓_e✓_r✓_t✓_e✓_d✓_ "✓_c✓_o✓_l✓_i✓_n✓_c✓_"✓_ c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_s✓_ a✓_t✓_ a✓_ t✓_i✓_m✓_e✓_ u✓_n✓_t✓_i✓_l✓_ t✓_h✓_e✓_ t✓_o✓_t✓_a✓_l✓_ w✓_i✓_d✓_t✓_h✓_ i✓_s✓_ a✓_t✓_
- l✓_e✓_a✓_s✓_t✓_ "✓_m✓_i✓_n✓_c✓_o✓_l✓_"✓_.✓_ T✓_h✓_e✓_ d✓_e✓_f✓_a✓_u✓_l✓_t✓_s✓_ a✓_r✓_e✓_ 0✓_ f✓_o✓_r✓_ m✓_i✓_n✓_c✓_o✓_l✓_ a✓_n✓_d✓_ m✓_i✓_n✓_p✓_a✓_d✓_,✓_ 1✓_ f✓_o✓_r✓_
- c✓_o✓_l✓_i✓_n✓_c✓_,✓_ a✓_n✓_d✓_ s✓_p✓_a✓_c✓_e✓_ f✓_o✓_r✓_ p✓_a✓_d✓_c✓_h✓_a✓_r✓_.✓_ F✓_o✓_r✓_ e✓_x✓_a✓_m✓_p✓_l✓_e✓_:✓_
-
- ~✓_1✓_5✓_,✓_,✓_2✓_,✓_'✓_.✓_@✓_A✓_
-
- T✓_h✓_e✓_ o✓_u✓_t✓_p✓_u✓_t✓_ i✓_s✓_ p✓_a✓_d✓_d✓_e✓_d✓_ o✓_n✓_ t✓_h✓_e✓_ l✓_e✓_f✓_t✓_ w✓_i✓_t✓_h✓_ a✓_t✓_ l✓_e✓_a✓_s✓_t✓_ 2✓_ p✓_e✓_r✓_i✓_o✓_d✓_s✓_ u✓_n✓_t✓_i✓_l✓_ t✓_h✓_e✓_
- o✓_u✓_t✓_p✓_u✓_t✓_ i✓_s✓_ a✓_t✓_ l✓_e✓_a✓_s✓_t✓_ 1✓_5✓_ c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_s✓_ w✓_i✓_d✓_e✓_.✓_
-
- F✓_o✓_r✓_ ~✓_%✓_ a✓_n✓_d✓_ ~✓_~✓_,✓_ t✓_h✓_e✓_ f✓_u✓_l✓_l✓_ f✓_o✓_r✓_m✓_ i✓_s✓_ ~✓_n✓_%✓_ o✓_r✓_ ~✓_n✓_~✓_,✓_ w✓_h✓_e✓_r✓_e✓_ n✓_ i✓_s✓_ a✓_n✓_ u✓_n✓_s✓_i✓_g✓_n✓_e✓_d✓_
- i✓_n✓_t✓_e✓_g✓_e✓_r✓_.✓_ "✓_n✓_"✓_ c✓_o✓_p✓_i✓_e✓_s✓_ (✓_d✓_e✓_f✓_a✓_u✓_l✓_t✓_=✓_1✓_)✓_ o✓_f✓_ t✓_h✓_e✓_ c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_ a✓_r✓_e✓_ o✓_u✓_t✓_p✓_u✓_t✓_.✓_
-
- F✓_o✓_r✓_ ~✓_\✓_n✓_,✓_ i✓_f✓_ t✓_h✓_e✓_ c✓_o✓_l✓_o✓_n✓_ m✓_o✓_d✓_i✓_f✓_i✓_e✓_r✓_ i✓_s✓_ u✓_s✓_e✓_d✓_,✓_ t✓_h✓_e✓_n✓_ t✓_h✓_e✓_ f✓_o✓_r✓_m✓_a✓_t✓_ d✓_i✓_r✓_e✓_c✓_t✓_i✓_v✓_e✓_ i✓_s✓_
- i✓_g✓_n✓_o✓_r✓_e✓_d✓_ (✓_a✓_l✓_l✓_o✓_w✓_i✓_n✓_g✓_ e✓_m✓_b✓_e✓_d✓_d✓_e✓_d✓_ r✓_e✓_t✓_u✓_r✓_n✓_s✓_ i✓_n✓_ t✓_h✓_e✓_ s✓_o✓_u✓_r✓_c✓_e✓_ f✓_o✓_r✓_ e✓_n✓_h✓_a✓_n✓_c✓_e✓_d✓_
- r✓_e✓_a✓_d✓_a✓_b✓_i✓_l✓_i✓_t✓_y✓_)✓_.✓_ I✓_f✓_ t✓_h✓_e✓_ a✓_t✓_-✓_s✓_i✓_g✓_n✓_ m✓_o✓_d✓_i✓_f✓_i✓_e✓_r✓_ i✓_s✓_ u✓_s✓_e✓_d✓_,✓_ t✓_h✓_e✓_n✓_ a✓_ c✓_a✓_r✓_r✓_i✓_a✓_g✓_e✓_ r✓_e✓_t✓_u✓_r✓_n✓_
- i✓_s✓_ e✓_m✓_i✓_t✓_t✓_e✓_d✓_,✓_ a✓_n✓_d✓_ f✓_o✓_l✓_l✓_o✓_w✓_i✓_n✓_g✓_ w✓_h✓_i✓_t✓_e✓_s✓_p✓_a✓_c✓_e✓_ i✓_s✓_ i✓_g✓_n✓_o✓_r✓_e✓_d✓_.✓_
-
-
-
-
-
-
-
- XLISP 2.0 FILE I/O FUNCTIONS Page 61
-
-
-
- FILE I/O FUNCTIONS
-
- N✓_o✓_t✓_e✓_ t✓_h✓_a✓_t✓_ i✓_n✓_i✓_t✓_i✓_a✓_l✓_l✓_y✓_,✓_ w✓_h✓_e✓_n✓_ s✓_t✓_a✓_r✓_t✓_i✓_n✓_g✓_ x✓_l✓_i✓_s✓_p✓_,✓_ t✓_h✓_e✓_r✓_e✓_ a✓_r✓_e✓_ f✓_i✓_v✓_e✓_ s✓_y✓_s✓_t✓_e✓_m✓_ s✓_t✓_r✓_e✓_a✓_m✓_
- s✓_y✓_m✓_b✓_o✓_l✓_s✓_ w✓_h✓_i✓_c✓_h✓_ a✓_r✓_e✓_ a✓_s✓_s✓_o✓_c✓_i✓_a✓_t✓_e✓_d✓_ w✓_i✓_t✓_h✓_ t✓_h✓_r✓_e✓_e✓_ s✓_t✓_r✓_e✓_a✓_m✓_s✓_.✓_ *✓_S✓_T✓_A✓_N✓_D✓_A✓_R✓_D✓_-✓_I✓_N✓_P✓_U✓_T✓_*✓_ i✓_s✓_
- b✓_o✓_u✓_n✓_d✓_ t✓_o✓_ s✓_t✓_a✓_n✓_d✓_a✓_r✓_d✓_ i✓_n✓_p✓_u✓_t✓_ a✓_n✓_d✓_ *✓_S✓_T✓_A✓_N✓_D✓_A✓_R✓_D✓_-✓_O✓_U✓_T✓_P✓_U✓_T✓_*✓_ i✓_s✓_ b✓_o✓_u✓_n✓_d✓_ t✓_o✓_ s✓_t✓_a✓_n✓_d✓_a✓_r✓_d✓_
- o✓_u✓_t✓_p✓_u✓_t✓_.✓_ *✓_E✓_R✓_R✓_O✓_R✓_-✓_O✓_U✓_T✓_P✓_U✓_T✓_*✓_ (✓_e✓_r✓_r✓_o✓_r✓_ m✓_e✓_s✓_s✓_a✓_g✓_e✓_ o✓_u✓_t✓_p✓_u✓_t✓_)✓_,✓_ *✓_T✓_R✓_A✓_C✓_E✓_-✓_O✓_U✓_T✓_P✓_U✓_T✓_*✓_ (✓_f✓_r✓_o✓_m✓_
- T✓_R✓_A✓_C✓_E✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_)✓_,✓_ a✓_n✓_d✓_ *✓_D✓_E✓_B✓_U✓_G✓_-✓_I✓_O✓_*✓_ (✓_b✓_r✓_e✓_a✓_k✓_ l✓_o✓_o✓_p✓_ i✓_/✓_o✓_)✓_ a✓_r✓_e✓_ a✓_l✓_l✓_ b✓_o✓_u✓_n✓_d✓_ t✓_o✓_
- s✓_t✓_a✓_n✓_d✓_a✓_r✓_d✓_ e✓_r✓_r✓_o✓_r✓_,✓_ w✓_h✓_i✓_c✓_h✓_ i✓_s✓_ j✓_u✓_s✓_t✓_ a✓_b✓_o✓_u✓_t✓_ a✓_l✓_w✓_a✓_y✓_s✓_ t✓_h✓_e✓_ c✓_o✓_n✓_s✓_o✓_l✓_e✓_.✓_
-
- W✓_h✓_e✓_n✓_ t✓_h✓_e✓_ t✓_r✓_a✓_n✓_s✓_c✓_r✓_i✓_p✓_t✓_ i✓_s✓_ a✓_c✓_t✓_i✓_v✓_e✓_ (✓_e✓_i✓_t✓_h✓_e✓_r✓_ -✓_t✓_ o✓_n✓_ t✓_h✓_e✓_ c✓_o✓_m✓_m✓_a✓_n✓_d✓_ l✓_i✓_n✓_e✓_ o✓_r✓_ t✓_h✓_e✓_
- D✓_R✓_I✓_B✓_B✓_L✓_E✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_)✓_,✓_ a✓_l✓_l✓_ c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_s✓_ t✓_h✓_a✓_t✓_ w✓_o✓_u✓_l✓_d✓_ b✓_e✓_ s✓_e✓_n✓_t✓_ t✓_o✓_ t✓_h✓_e✓_ d✓_i✓_s✓_p✓_l✓_a✓_y✓_
- v✓_i✓_a✓_ e✓_i✓_t✓_h✓_e✓_r✓_ s✓_t✓_a✓_n✓_d✓_a✓_r✓_d✓_ o✓_u✓_t✓_p✓_u✓_t✓_ o✓_r✓_ s✓_t✓_a✓_n✓_d✓_a✓_r✓_d✓_ e✓_r✓_r✓_o✓_r✓_ a✓_r✓_e✓_ a✓_l✓_s✓_o✓_ p✓_l✓_a✓_c✓_e✓_d✓_ i✓_n✓_ t✓_h✓_e✓_
- t✓_r✓_a✓_n✓_s✓_c✓_r✓_i✓_p✓_t✓_ f✓_i✓_l✓_e✓_.✓_
-
- X✓_L✓_I✓_S✓_P✓_ g✓_i✓_v✓_e✓_s✓_ s✓_p✓_e✓_c✓_i✓_a✓_l✓_ t✓_r✓_e✓_a✓_t✓_m✓_e✓_n✓_t✓_ t✓_o✓_ i✓_/✓_o✓_ t✓_h✓_r✓_o✓_u✓_g✓_h✓_ s✓_t✓_a✓_n✓_d✓_a✓_r✓_d✓_
- i✓_n✓_p✓_u✓_t✓_/✓_o✓_u✓_t✓_p✓_u✓_t✓_/✓_e✓_r✓_r✓_o✓_r✓_,✓_ a✓_s✓_ s✓_h✓_o✓_w✓_n✓_ o✓_n✓_ p✓_a✓_g✓_e✓_ 3✓_.✓_ A✓_n✓_ X✓_L✓_I✓_S✓_P✓_ p✓_r✓_o✓_g✓_r✓_a✓_m✓_ w✓_h✓_i✓_c✓_h✓_ a✓_l✓_t✓_e✓_r✓_s✓_
- a✓_n✓_y✓_ o✓_f✓_ t✓_h✓_e✓_ s✓_y✓_s✓_t✓_e✓_m✓_ s✓_t✓_r✓_e✓_a✓_m✓_ v✓_a✓_l✓_u✓_e✓_s✓_ s✓_h✓_o✓_u✓_l✓_d✓_ s✓_a✓_v✓_e✓_ t✓_h✓_e✓_ o✓_r✓_i✓_g✓_i✓_n✓_a✓_l✓_ v✓_a✓_l✓_u✓_e✓_s✓_ t✓_o✓_
- r✓_e✓_s✓_t✓_o✓_r✓_e✓_ t✓_h✓_e✓_m✓_.✓_ U✓_s✓_i✓_n✓_g✓_ t✓_h✓_e✓_ O✓_P✓_E✓_N✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_ t✓_o✓_ r✓_e✓_-✓_o✓_p✓_e✓_n✓_ t✓_h✓_e✓_ c✓_o✓_n✓_s✓_o✓_l✓_e✓_ w✓_i✓_l✓_l✓_ n✓_o✓_t✓_
- r✓_e✓_s✓_t✓_o✓_r✓_e✓_ i✓_/✓_o✓_ t✓_h✓_r✓_o✓_u✓_g✓_h✓_ s✓_t✓_a✓_n✓_d✓_a✓_r✓_d✓_ i✓_n✓_p✓_u✓_t✓_/✓_o✓_u✓_t✓_p✓_u✓_t✓_/✓_e✓_r✓_r✓_o✓_r✓_.✓_
-
- (open <fname> &key :direction :✓_e✓_l✓_e✓_m✓_e✓_n✓_t✓_-✓_t✓_y✓_p✓_e✓_) OPEN A FILE STREAM
- <fname> the file name string or symbol
- :direction :input, :output, or :✓_i✓_o✓_ (default is :input).
- A file opened for input must already exist. A
- file opened for output will delete any
- existing file by the same name. A file opened
- for input or io is positioned at its start.
- :✓_e✓_l✓_e✓_m✓_e✓_n✓_t✓_-✓_t✓_y✓_p✓_e✓_ F✓_I✓_X✓_N✓_U✓_M✓_ o✓_r✓_ C✓_H✓_A✓_R✓_A✓_C✓_T✓_E✓_R✓_ (✓_d✓_e✓_f✓_a✓_u✓_l✓_t✓_ i✓_s✓_ C✓_H✓_A✓_R✓_A✓_C✓_T✓_E✓_R✓_)✓_,✓_
- a✓_s✓_ r✓_e✓_t✓_u✓_r✓_n✓_e✓_d✓_ b✓_y✓_ t✓_y✓_p✓_e✓_-✓_o✓_f✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_.✓_ F✓_i✓_l✓_e✓_s✓_ o✓_p✓_e✓_n✓_e✓_d✓_
- w✓_i✓_t✓_h✓_ t✓_y✓_p✓_e✓_ F✓_I✓_X✓_N✓_U✓_M✓_ a✓_r✓_e✓_ b✓_i✓_n✓_a✓_r✓_y✓_ f✓_i✓_l✓_e✓_s✓_ i✓_n✓_s✓_t✓_e✓_a✓_d✓_ o✓_f✓_
- a✓_s✓_c✓_i✓_i✓_,✓_ w✓_h✓_i✓_c✓_h✓_ m✓_e✓_a✓_n✓_s✓_ n✓_o✓_ c✓_r✓_l✓_f✓_ t✓_o✓_/✓_f✓_r✓_o✓_m✓_ l✓_f✓_
- c✓_o✓_n✓_v✓_e✓_r✓_s✓_i✓_o✓_n✓_ t✓_a✓_k✓_e✓_s✓_ p✓_l✓_a✓_c✓_e✓_,✓_ a✓_n✓_d✓_ c✓_o✓_n✓_t✓_r✓_o✓_l✓_-✓_Z✓_ w✓_i✓_l✓_l✓_
- n✓_o✓_t✓_ t✓_e✓_r✓_m✓_i✓_n✓_a✓_t✓_e✓_ a✓_n✓_ i✓_n✓_p✓_u✓_t✓_ f✓_i✓_l✓_e✓_.✓_ I✓_t✓_ i✓_s✓_ t✓_h✓_e✓_ i✓_n✓_t✓_e✓_n✓_t✓_
- o✓_f✓_ C✓_o✓_m✓_m✓_o✓_n✓_ L✓_i✓_s✓_p✓_ t✓_h✓_a✓_t✓_ b✓_i✓_n✓_a✓_r✓_y✓_ f✓_i✓_l✓_e✓_s✓_ o✓_n✓_l✓_y✓_ b✓_e✓_
- a✓_c✓_c✓_e✓_s✓_s✓_e✓_d✓_ w✓_i✓_t✓_h✓_ r✓_e✓_a✓_d✓_-✓_b✓_y✓_t✓_e✓_ a✓_n✓_d✓_ w✓_r✓_i✓_t✓_e✓_-✓_b✓_y✓_t✓_e✓_ w✓_h✓_i✓_l✓_e✓_
- a✓_s✓_c✓_i✓_i✓_ f✓_i✓_l✓_e✓_s✓_ b✓_e✓_ a✓_c✓_c✓_e✓_s✓_s✓_e✓_d✓_ w✓_i✓_t✓_h✓_ a✓_n✓_y✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_ b✓_u✓_t✓_
- r✓_e✓_a✓_d✓_-✓_b✓_y✓_t✓_e✓_ a✓_n✓_d✓_ w✓_r✓_i✓_t✓_e✓_-✓_b✓_y✓_t✓_e✓_.✓_ X✓_L✓_I✓_S✓_P✓_ d✓_o✓_e✓_s✓_ n✓_o✓_t✓_
- e✓_n✓_f✓_o✓_r✓_c✓_e✓_ t✓_h✓_a✓_t✓_ d✓_i✓_s✓_t✓_i✓_n✓_c✓_t✓_i✓_o✓_n✓_.✓_
- returns a file stream
-
- (close <stream>) CLOSE A FILE STREAM
- <stream> the file stream
- returns nil
-
- (✓_f✓_i✓_l✓_e✓_-✓_l✓_e✓_n✓_g✓_t✓_h✓_ <✓_s✓_t✓_r✓_e✓_a✓_m✓_>✓_)✓_ G✓_E✓_T✓_ L✓_E✓_N✓_G✓_T✓_H✓_ O✓_F✓_ F✓_I✓_L✓_E✓_
- F✓_o✓_r✓_ a✓_n✓_ a✓_s✓_c✓_i✓_i✓_ f✓_i✓_l✓_e✓_,✓_ t✓_h✓_e✓_ l✓_e✓_n✓_g✓_t✓_h✓_ r✓_e✓_p✓_o✓_r✓_t✓_e✓_d✓_ m✓_a✓_y✓_ b✓_e✓_ l✓_a✓_r✓_g✓_e✓_r✓_ t✓_h✓_a✓_n✓_ t✓_h✓_e✓_
- n✓_u✓_m✓_b✓_e✓_r✓_ o✓_f✓_ c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_s✓_ r✓_e✓_a✓_d✓_ o✓_r✓_ w✓_r✓_i✓_t✓_t✓_e✓_n✓_ b✓_e✓_c✓_a✓_u✓_s✓_e✓_ o✓_f✓_ C✓_R✓_ c✓_o✓_n✓_v✓_e✓_r✓_s✓_i✓_o✓_n✓_.✓_
- <✓_s✓_t✓_r✓_e✓_a✓_m✓_>✓_ t✓_h✓_e✓_ f✓_i✓_l✓_e✓_ s✓_t✓_r✓_e✓_a✓_m✓_ (✓_s✓_h✓_o✓_u✓_l✓_d✓_ b✓_e✓_ d✓_i✓_s✓_k✓_ f✓_i✓_l✓_e✓_)✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ l✓_e✓_n✓_g✓_t✓_h✓_ o✓_f✓_ f✓_i✓_l✓_e✓_,✓_ o✓_r✓_ N✓_I✓_L✓_ i✓_f✓_ c✓_a✓_n✓_n✓_o✓_t✓_ b✓_e✓_ d✓_e✓_t✓_u✓_r✓_m✓_i✓_n✓_e✓_d✓_.✓_
-
-
-
-
-
-
-
- XLISP 2.0 FILE I/O FUNCTIONS Page 62
-
-
- (✓_f✓_i✓_l✓_e✓_-✓_p✓_o✓_s✓_i✓_t✓_i✓_o✓_n✓_ <✓_s✓_t✓_r✓_e✓_a✓_m✓_>✓_ [✓_<✓_e✓_x✓_p✓_r✓_>✓_]✓_)✓_ G✓_E✓_T✓_ O✓_R✓_ S✓_E✓_T✓_ F✓_I✓_L✓_E✓_ P✓_O✓_S✓_I✓_T✓_I✓_O✓_N✓_
- F✓_o✓_r✓_ a✓_n✓_ a✓_s✓_c✓_i✓_i✓_ f✓_i✓_l✓_e✓_,✓_ t✓_h✓_e✓_ f✓_i✓_l✓_e✓_ p✓_o✓_s✓_i✓_t✓_i✓_o✓_n✓_ m✓_a✓_y✓_ n✓_o✓_t✓_ b✓_e✓_ t✓_h✓_e✓_ s✓_a✓_m✓_e✓_ a✓_s✓_ t✓_h✓_e✓_
- n✓_u✓_m✓_b✓_e✓_r✓_ o✓_f✓_ c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_s✓_ r✓_e✓_a✓_d✓_ o✓_r✓_ w✓_r✓_i✓_t✓_t✓_e✓_n✓_ b✓_e✓_c✓_a✓_u✓_s✓_e✓_ o✓_f✓_ C✓_R✓_ c✓_o✓_n✓_v✓_e✓_r✓_s✓_i✓_o✓_n✓_.✓_ I✓_t✓_
- w✓_i✓_l✓_l✓_ b✓_e✓_ t✓_r✓_u✓_e✓_ h✓_o✓_w✓_e✓_v✓_e✓_r✓_,✓_ t✓_h✓_a✓_t✓_ u✓_s✓_i✓_n✓_g✓_ f✓_i✓_l✓_e✓_-✓_p✓_o✓_s✓_i✓_t✓_i✓_o✓_n✓_ t✓_o✓_ p✓_o✓_s✓_i✓_t✓_i✓_o✓_n✓_ a✓_ f✓_i✓_l✓_e✓_
- a✓_t✓_ a✓_ l✓_o✓_c✓_a✓_t✓_i✓_o✓_n✓_ e✓_a✓_r✓_l✓_i✓_e✓_r✓_ r✓_e✓_p✓_o✓_r✓_t✓_e✓_d✓_ b✓_y✓_ f✓_i✓_l✓_e✓_-✓_p✓_o✓_s✓_i✓_t✓_i✓_o✓_n✓_.✓_
- <✓_s✓_t✓_r✓_e✓_a✓_m✓_>✓_ t✓_h✓_e✓_ f✓_i✓_l✓_e✓_ s✓_t✓_r✓_e✓_a✓_m✓_ (✓_s✓_h✓_o✓_u✓_l✓_d✓_ b✓_e✓_ a✓_ d✓_i✓_s✓_k✓_ f✓_i✓_l✓_e✓_)✓_
- <✓_e✓_x✓_p✓_r✓_>✓_ d✓_e✓_s✓_i✓_r✓_e✓_d✓_ f✓_i✓_l✓_e✓_ p✓_o✓_s✓_i✓_t✓_i✓_o✓_n✓_,✓_ i✓_f✓_ s✓_e✓_t✓_t✓_i✓_n✓_g✓_ p✓_o✓_s✓_i✓_t✓_i✓_o✓_n✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ i✓_f✓_ s✓_e✓_t✓_t✓_i✓_n✓_g✓_ p✓_o✓_s✓_i✓_t✓_i✓_o✓_n✓_,✓_ a✓_n✓_d✓_ s✓_u✓_c✓_c✓_e✓_s✓_s✓_f✓_u✓_l✓_,✓_ t✓_h✓_e✓_n✓_ T✓_;✓_ i✓_f✓_ g✓_e✓_t✓_t✓_i✓_n✓_g✓_
- p✓_o✓_s✓_i✓_t✓_i✓_o✓_n✓_ a✓_n✓_d✓_ s✓_u✓_c✓_c✓_e✓_s✓_s✓_f✓_u✓_l✓_ t✓_h✓_e✓_n✓_ t✓_h✓_e✓_ p✓_o✓_s✓_i✓_t✓_i✓_o✓_n✓_;✓_ o✓_t✓_h✓_e✓_r✓_w✓_i✓_s✓_e✓_
- N✓_I✓_L✓_
-
- (read-char [<stream>]) READ A CHARACTER FROM A STREAM
- <stream> the input stream (default is *standard-input*)
- returns the character
-
- (peek-char [<flag> [<stream>]]) PEEK AT THE NEXT CHARACTER
- <flag> flag for skipping white space (default is nil)
- <stream> the input stream (default is *standard-input*)
- returns the character (integer)
-
- (write-char <ch> [<stream>]) WRITE A CHARACTER TO A STREAM
- <ch> the character to write
- <stream> the output stream (default is *standard-output*)
- returns the character
-
- (read-line [<stream>]) READ A LINE FROM A STREAM
- <stream> the input stream (default is *standard-input*)
- returns the string
-
- (read-byte [<stream>]) READ A BYTE FROM A STREAM
- <stream> the input stream (default is *standard-input*)
- returns the byte (integer)
-
- (write-byte <byte> [<stream>]) WRITE A BYTE TO A STREAM
- <byte> the byte to write (integer)
- <stream> the output stream (default is *standard-output*)
- returns the byte (integer)
-
-
-
-
-
-
-
- XLISP 2.0 STRING STREAM FUNCTIONS Page 63
-
-
-
- STRING STREAM FUNCTIONS
-
- These functions operate on unnamed streams. An unnamed output stream
- collects characters sent to it when it is used as the destination of
- any output function. The functions 'get-output-stream' string and list
- return a sting or list of the characters.
-
- An unnamed input stream is setup with the 'make-string-input-stream'
- function and returns each character of the string when it is used as
- the source of any input function.
-
- N✓_o✓_t✓_e✓_ t✓_h✓_a✓_t✓_ t✓_h✓_e✓_r✓_e✓_ i✓_s✓_ n✓_o✓_ d✓_i✓_f✓_f✓_e✓_r✓_e✓_n✓_c✓_e✓_ b✓_e✓_t✓_w✓_e✓_e✓_n✓_ u✓_n✓_n✓_a✓_m✓_e✓_d✓_ i✓_n✓_p✓_u✓_t✓_ a✓_n✓_d✓_ o✓_u✓_t✓_p✓_u✓_t✓_
- s✓_t✓_r✓_e✓_a✓_m✓_s✓_.✓_ U✓_n✓_n✓_a✓_m✓_e✓_d✓_ i✓_n✓_p✓_u✓_t✓_ s✓_t✓_r✓_e✓_a✓_m✓_s✓_ m✓_a✓_y✓_ b✓_e✓_ w✓_r✓_i✓_t✓_t✓_e✓_n✓_ t✓_o✓_ b✓_y✓_ o✓_u✓_t✓_p✓_u✓_t✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_s✓_,✓_
- i✓_n✓_ w✓_h✓_i✓_c✓_h✓_ c✓_a✓_s✓_e✓_ t✓_h✓_e✓_ c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_s✓_ a✓_r✓_e✓_ a✓_p✓_p✓_e✓_n✓_d✓_e✓_d✓_ t✓_o✓_ t✓_h✓_e✓_ t✓_a✓_i✓_l✓_ e✓_n✓_d✓_ o✓_f✓_ t✓_h✓_e✓_
- s✓_t✓_r✓_e✓_a✓_m✓_.✓_ U✓_n✓_n✓_a✓_m✓_e✓_d✓_ o✓_u✓_t✓_p✓_u✓_t✓_ s✓_t✓_r✓_e✓_a✓_m✓_s✓_ m✓_a✓_y✓_ a✓_l✓_s✓_o✓_ b✓_e✓_ (✓_d✓_e✓_s✓_t✓_r✓_u✓_c✓_t✓_i✓_v✓_e✓_l✓_y✓_)✓_ r✓_e✓_a✓_d✓_ b✓_y✓_ a✓_n✓_y✓_
- i✓_n✓_p✓_u✓_t✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_ a✓_s✓_ w✓_e✓_l✓_l✓_ a✓_s✓_ t✓_h✓_e✓_ g✓_e✓_t✓_-✓_o✓_u✓_t✓_p✓_u✓_t✓_-✓_s✓_t✓_r✓_e✓_a✓_m✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_s✓_.✓_
-
- (make-string-input-stream <str> [<start> [<end>]])
- <str> the string
- <start> the starting offset
- <end> the ending offset + 1 o✓_r✓_ N✓_I✓_L✓_ f✓_o✓_r✓_ e✓_n✓_d✓_ o✓_f✓_ s✓_t✓_r✓_i✓_n✓_g✓_
- returns an unnamed stream that reads from the string
-
- (make-string-output-stream)
- returns an unnamed output stream
-
- (get-output-stream-string <stream>)
- <stream> the output stream
- returns the output so far as a string
- Note: the output stream is emptied by this function
-
- (get-output-stream-list <stream>)
- <stream> the output stream
- returns the output so far as a list
- Note: the output stream is emptied by this function
-
-
-
-
-
-
-
- XLISP 2.0 DEBUGGING AND ERROR HANDLING Page 64
-
-
-
- DEBUGGING AND ERROR HANDLING FUNCTIONS
-
- (trace [<sym>...]) ADD A FUNCTION TO THE TRACE LIST
- f✓_s✓_u✓_b✓_r✓_
- <sym> the function(s) to add (quoted)
- returns the trace list
-
- (untrace [<sym>...]) REMOVE A FUNCTION FROM THE TRACE LIST
- f✓_s✓_u✓_b✓_r✓_.✓_ I✓_f✓_ n✓_o✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_s✓_ g✓_i✓_v✓_e✓_n✓_,✓_ a✓_l✓_l✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_s✓_ a✓_r✓_e✓_ r✓_e✓_m✓_o✓_v✓_e✓_d✓_ f✓_r✓_o✓_m✓_ t✓_h✓_e✓_
- t✓_r✓_a✓_c✓_e✓_ l✓_i✓_s✓_t✓_.✓_
- <sym> the function(s) to remove (quoted)
- returns the trace list
-
- (error <emsg> [<arg>]) SIGNAL A NON-CORRECTABLE ERROR
- <emsg> the error message string
- <arg> the argument expression (printed after the message)
- returns never returns
-
- (cerror <cmsg> <emsg> [<arg>]) SIGNAL A CORRECTABLE ERROR
- <cmsg> the continue message string
- <emsg> the error message string
- <arg> the argument expression (printed after the message)
- returns nil when continued from the break loop
-
- (break [<bmsg> [<arg>]]) ENTER A BREAK LOOP
- <bmsg> the break message string (defaults to "**BREAK**")
- <arg> the argument expression (printed after the message)
- returns nil when continued from the break loop
-
- (clean-up) CLEAN-UP AFTER AN ERROR
- returns never returns
-
- (top-level) CLEAN-UP AFTER AN ERROR AND RETURN TO THE TOP LEVEL
- returns never returns
-
- (continue) CONTINUE FROM A CORRECTABLE ERROR
- returns never returns
-
- (errset <expr> [<pflag>]) TRAP ERRORS
- f✓_s✓_u✓_b✓_r✓_
- <expr> the expression to execute
- <pflag> flag to control printing of the error message
- returns the value of the last expression consed with nil or nil
- on error
-
- (baktrace [<n>]) PRINT N LEVELS OF TRACE BACK INFORMATION
- <n> the number of levels (defaults to all levels)
- returns nil
-
-
-
-
-
-
-
- XLISP 2.0 DEBUGGING AND ERROR HANDLING Page 65
-
-
- (evalhook <expr> <ehook> <ahook> [<env>]) EVALUATE WITH HOOKS
- <expr> the expression to evaluate. <✓_e✓_h✓_o✓_o✓_k✓_>✓_ i✓_s✓_ n✓_o✓_t✓_ u✓_s✓_e✓_d✓_ a✓_t✓_ t✓_h✓_e✓_
- t✓_o✓_p✓_ l✓_e✓_v✓_e✓_l✓_.✓_
- <ehook> the value for *evalhook*
- <ahook> the value for *applyhook*
- <env> the environment (default is nil). T✓_h✓_e✓_ f✓_o✓_r✓_m✓_a✓_t✓_ i✓_s✓_ a✓_
- d✓_o✓_t✓_t✓_e✓_d✓_ p✓_a✓_i✓_r✓_ o✓_f✓_ v✓_a✓_l✓_u✓_e✓_ (✓_c✓_a✓_r✓_)✓_ a✓_n✓_d✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_ (✓_c✓_d✓_r✓_)✓_ b✓_i✓_n✓_d✓_i✓_n✓_g✓_
- l✓_i✓_s✓_t✓_s✓_.✓_ E✓_a✓_c✓_h✓_ b✓_i✓_n✓_d✓_i✓_n✓_g✓_ l✓_i✓_s✓_t✓_ i✓_s✓_ a✓_ l✓_i✓_s✓_t✓_ o✓_f✓_ l✓_e✓_v✓_e✓_l✓_ b✓_i✓_n✓_d✓_i✓_n✓_g✓_ a✓_-✓_
- l✓_i✓_s✓_t✓_s✓_,✓_ w✓_i✓_t✓_h✓_ t✓_h✓_e✓_ i✓_n✓_n✓_e✓_r✓_m✓_o✓_s✓_t✓_ a✓_-✓_l✓_i✓_s✓_t✓_ f✓_i✓_r✓_s✓_t✓_.✓_ T✓_h✓_e✓_ l✓_e✓_v✓_e✓_l✓_
- b✓_i✓_n✓_d✓_i✓_n✓_g✓_ a✓_-✓_l✓_i✓_s✓_t✓_ a✓_s✓_s✓_o✓_c✓_i✓_a✓_t✓_e✓_s✓_ t✓_h✓_e✓_ b✓_o✓_u✓_n✓_d✓_ s✓_y✓_m✓_b✓_o✓_l✓_ w✓_i✓_t✓_h✓_ i✓_t✓_s✓_
- v✓_a✓_l✓_u✓_e✓_.✓_
- returns the result of evaluating the expression
-
- (✓_a✓_p✓_p✓_l✓_y✓_h✓_o✓_o✓_k✓_ <✓_f✓_u✓_n✓_>✓_ <✓_a✓_r✓_g✓_l✓_i✓_s✓_t✓_>✓_ <✓_e✓_h✓_o✓_o✓_k✓_>✓_ <✓_a✓_h✓_o✓_o✓_k✓_>✓_)✓_ A✓_P✓_P✓_L✓_Y✓_ W✓_I✓_T✓_H✓_ H✓_O✓_O✓_K✓_S✓_
- <✓_f✓_u✓_n✓_>✓_ T✓_h✓_e✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_ c✓_l✓_o✓_s✓_u✓_r✓_e✓_.✓_ <✓_a✓_h✓_o✓_o✓_k✓_>✓_ i✓_s✓_ n✓_o✓_t✓_ u✓_s✓_e✓_d✓_ f✓_o✓_r✓_ t✓_h✓_i✓_s✓_
- f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_ a✓_p✓_p✓_l✓_i✓_c✓_a✓_t✓_i✓_o✓_n✓_.✓_
- <✓_a✓_r✓_g✓_l✓_i✓_s✓_t✓_>✓_ T✓_h✓_e✓_ l✓_i✓_s✓_t✓_ o✓_f✓_ a✓_r✓_g✓_u✓_m✓_e✓_n✓_t✓_s✓_.✓_
- <✓_e✓_h✓_o✓_o✓_k✓_>✓_ t✓_h✓_e✓_ v✓_a✓_l✓_u✓_e✓_ f✓_o✓_r✓_ *✓_e✓_v✓_a✓_l✓_h✓_o✓_o✓_k✓_*✓_
- <✓_a✓_h✓_o✓_o✓_k✓_>✓_ t✓_h✓_e✓_ v✓_a✓_l✓_u✓_e✓_ f✓_o✓_r✓_ *✓_a✓_p✓_p✓_l✓_y✓_h✓_o✓_o✓_k✓_*✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ t✓_h✓_e✓_ r✓_e✓_s✓_u✓_l✓_t✓_ o✓_f✓_ a✓_p✓_p✓_l✓_y✓_i✓_n✓_g✓_ <✓_f✓_u✓_n✓_>✓_ t✓_o✓_ <✓_a✓_r✓_g✓_l✓_i✓_s✓_t✓_>✓_
-
- (✓_d✓_e✓_b✓_u✓_g✓_)✓_ E✓_N✓_A✓_B✓_L✓_E✓_ D✓_E✓_B✓_U✓_G✓_ B✓_R✓_E✓_A✓_K✓_S✓_
- (✓_n✓_o✓_d✓_e✓_b✓_u✓_g✓_)✓_ D✓_I✓_S✓_A✓_B✓_L✓_E✓_ D✓_E✓_B✓_U✓_G✓_ B✓_R✓_E✓_A✓_K✓_S✓_
- D✓_e✓_f✓_i✓_n✓_e✓_d✓_ i✓_n✓_ i✓_n✓_i✓_t✓_.✓_l✓_s✓_p✓_
-
-
-
-
-
-
-
- XLISP 2.0 SYSTEM FUNCTIONS Page 66
-
-
-
- SYSTEM FUNCTIONS
-
- (load <fname> &key :verbose :print) LOAD A SOURCE FILE
- <fname> the filename string or symbol
- :verbose the verbose flag (default is t)
- :print the print flag (default is nil)
- returns the filename
-
- (restore <fname>) RESTORE WORKSPACE FROM A FILE
- <fname> the filename string or symbol
- returns nil on failure, otherwise never returns
-
- (save <fname>) SAVE WORKSPACE TO A FILE
- <fname> the filename string or symbol
- returns t if workspace was written, nil otherwise
-
- (✓_s✓_a✓_v✓_e✓_f✓_u✓_n✓_ <✓_f✓_c✓_n✓_>✓_)✓_ S✓_A✓_V✓_E✓_ F✓_U✓_N✓_C✓_T✓_I✓_O✓_N✓_ T✓_O✓_ A✓_ F✓_I✓_L✓_E✓_
- d✓_e✓_f✓_i✓_n✓_e✓_d✓_ i✓_n✓_ i✓_n✓_i✓_t✓_.✓_l✓_s✓_p✓_
- <✓_f✓_c✓_n✓_>✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_ n✓_a✓_m✓_e✓_ (✓_s✓_a✓_v✓_e✓_s✓_ i✓_t✓_ t✓_o✓_ f✓_i✓_l✓_e✓_ o✓_f✓_ s✓_a✓_m✓_e✓_ n✓_a✓_m✓_e✓_,✓_ w✓_i✓_t✓_h✓_
- e✓_x✓_t✓_e✓_n✓_s✓_i✓_o✓_n✓_ "✓_.✓_l✓_s✓_p✓_"✓_)✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ t✓_ i✓_f✓_ s✓_u✓_c✓_c✓_e✓_s✓_s✓_f✓_u✓_l✓_
-
- (dribble [<fname>]) CREATE A FILE WITH A TRANSCRIPT OF A SESSION
- <fname> file name string or symbol
- (if missing, close current transcript)
- returns t if the transcript is opened, nil if it is closed
-
- (gc) FORCE GARBAGE COLLECTION
- returns nil
-
- (expand [<num>]) EXPAND MEMORY BY ADDING SEGMENTS
- <num> the number of segments to add, default 1
- returns the number of segments added
-
- (alloc <num>) CHANGE NUMBER OF NODES TO ALLOCATE IN EACH SEGMENT
- <num> the number of nodes to allocate
- returns the old number of nodes to allocate
-
- (room) SHOW MEMORY ALLOCATION STATISTICS
- returns nil
-
- (✓_t✓_i✓_m✓_e✓_ <✓_e✓_x✓_p✓_r✓_>✓_)✓_ M✓_E✓_A✓_S✓_U✓_R✓_E✓_ E✓_X✓_E✓_C✓_U✓_T✓_I✓_O✓_N✓_ T✓_I✓_M✓_E✓_
- f✓_s✓_u✓_b✓_r✓_.✓_ N✓_o✓_t✓_e✓_:✓_ a✓_d✓_d✓_e✓_d✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_
- <✓_e✓_x✓_p✓_r✓_>✓_ t✓_h✓_e✓_ e✓_x✓_p✓_r✓_e✓_s✓_s✓_i✓_o✓_n✓_ t✓_o✓_ e✓_v✓_a✓_l✓_u✓_a✓_t✓_e✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ t✓_h✓_e✓_ e✓_x✓_e✓_c✓_u✓_t✓_i✓_o✓_n✓_ t✓_i✓_m✓_e✓_,✓_ i✓_n✓_ s✓_e✓_c✓_o✓_n✓_d✓_s✓_ (✓_f✓_l✓_o✓_a✓_t✓_i✓_n✓_g✓_ p✓_o✓_i✓_n✓_t✓_)✓_
-
-
-
-
-
-
-
- XLISP 2.0 SYSTEM FUNCTIONS Page 67
-
-
- (✓_c✓_o✓_e✓_r✓_c✓_e✓_ <✓_e✓_x✓_p✓_r✓_>✓_ <✓_t✓_y✓_p✓_e✓_>✓_)✓_ F✓_O✓_R✓_C✓_E✓_ E✓_X✓_P✓_R✓_E✓_S✓_S✓_I✓_O✓_N✓_ T✓_O✓_ D✓_E✓_S✓_I✓_G✓_N✓_A✓_T✓_E✓_D✓_ T✓_Y✓_P✓_E✓_
- N✓_o✓_t✓_e✓_:✓_ a✓_d✓_d✓_e✓_d✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_
- <✓_e✓_x✓_p✓_r✓_>✓_ t✓_h✓_e✓_ e✓_x✓_p✓_r✓_e✓_s✓_s✓_i✓_o✓_n✓_ t✓_o✓_ c✓_o✓_e✓_r✓_c✓_e✓_
- <✓_t✓_y✓_p✓_e✓_>✓_ d✓_e✓_s✓_i✓_r✓_e✓_d✓_ t✓_y✓_p✓_e✓_,✓_ a✓_s✓_ r✓_e✓_t✓_u✓_r✓_n✓_e✓_d✓_ b✓_y✓_ t✓_y✓_p✓_e✓_-✓_o✓_f✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ <✓_e✓_x✓_p✓_r✓_>✓_ i✓_f✓_ t✓_y✓_p✓_e✓_ i✓_s✓_ c✓_o✓_r✓_r✓_e✓_c✓_t✓_,✓_ o✓_r✓_ c✓_o✓_n✓_v✓_e✓_r✓_t✓_e✓_d✓_ o✓_b✓_j✓_e✓_c✓_t✓_.✓_
- S✓_e✓_q✓_u✓_e✓_n✓_c✓_e✓_s✓_ c✓_a✓_n✓_ b✓_e✓_ c✓_o✓_e✓_r✓_c✓_e✓_d✓_ i✓_n✓_t✓_o✓_ o✓_t✓_h✓_e✓_r✓_ s✓_e✓_q✓_u✓_e✓_n✓_c✓_e✓_s✓_,✓_ s✓_i✓_n✓_g✓_l✓_e✓_ c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_
- s✓_t✓_r✓_i✓_n✓_g✓_s✓_ o✓_r✓_ s✓_y✓_m✓_b✓_o✓_l✓_s✓_ w✓_i✓_t✓_h✓_ s✓_i✓_n✓_g✓_l✓_e✓_ c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_ p✓_r✓_i✓_n✓_t✓_n✓_a✓_m✓_e✓_s✓_ c✓_a✓_n✓_ b✓_e✓_
- c✓_o✓_e✓_r✓_c✓_e✓_d✓_ i✓_n✓_t✓_o✓_ c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_s✓_,✓_ i✓_n✓_t✓_e✓_g✓_e✓_r✓_s✓_ c✓_a✓_n✓_ b✓_e✓_ c✓_o✓_e✓_r✓_c✓_e✓_d✓_ i✓_n✓_t✓_o✓_ c✓_h✓_a✓_r✓_a✓_c✓_t✓_e✓_r✓_s✓_
- o✓_r✓_ f✓_l✓_o✓_n✓_u✓_m✓_s✓_.✓_
-
- (type-of <expr>) RETURNS THE TYPE OF THE EXPRESSION
- <expr> the expression to return the type of
- returns nil if the value is nil otherwise one of the symbols:
- SYMBOL for symbols
- OBJECT for objects
- CONS for conses
- SUBR for built-in functions
- FSUBR for special forms
- CLOSURE for defined functions
- STRING for strings
- FIXNUM for integers
- FLONUM for floating point numbers
- CHARACTER for characters
- FILE-STREAM for file pointers
- UNNAMED-STREAM for unnamed streams
- ARRAY for arrays
- s✓_y✓_m✓_ f✓_o✓_r✓_ s✓_t✓_r✓_u✓_c✓_t✓_u✓_r✓_e✓_s✓_ o✓_f✓_ t✓_y✓_p✓_e✓_ "✓_s✓_y✓_m✓_"✓_
-
- (✓_g✓_e✓_n✓_e✓_r✓_i✓_c✓_ <✓_e✓_x✓_p✓_r✓_>✓_)✓_ C✓_R✓_E✓_A✓_T✓_E✓_ A✓_ G✓_E✓_N✓_E✓_R✓_I✓_C✓_ T✓_Y✓_P✓_E✓_D✓_ C✓_O✓_P✓_Y✓_ O✓_F✓_ T✓_H✓_E✓_ E✓_X✓_P✓_R✓_E✓_S✓_S✓_I✓_O✓_N✓_
- N✓_o✓_t✓_e✓_:✓_ a✓_d✓_d✓_e✓_d✓_ f✓_u✓_n✓_c✓_t✓_i✓_o✓_n✓_,✓_ T✓_o✓_m✓_ A✓_l✓_m✓_y✓_'✓_s✓_ i✓_n✓_v✓_e✓_n✓_t✓_i✓_o✓_n✓_.✓_
- <✓_e✓_x✓_p✓_r✓_>✓_ t✓_h✓_e✓_ e✓_x✓_p✓_r✓_e✓_s✓_s✓_i✓_o✓_n✓_ t✓_o✓_ c✓_o✓_p✓_y✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ n✓_i✓_l✓_ i✓_f✓_ v✓_a✓_l✓_u✓_e✓_ i✓_s✓_ n✓_i✓_l✓_,✓_ o✓_t✓_h✓_e✓_r✓_w✓_i✓_s✓_e✓_ i✓_f✓_ t✓_y✓_p✓_e✓_ i✓_s✓_:✓_
- S✓_Y✓_M✓_B✓_O✓_L✓_ c✓_o✓_p✓_y✓_ a✓_s✓_ a✓_n✓_ A✓_R✓_R✓_A✓_Y✓_
- O✓_B✓_J✓_E✓_C✓_T✓_ c✓_o✓_p✓_y✓_ a✓_s✓_ a✓_n✓_ A✓_R✓_R✓_A✓_Y✓_
- C✓_O✓_N✓_S✓_ (✓_C✓_O✓_N✓_S✓_ (✓_C✓_A✓_R✓_ <✓_e✓_x✓_p✓_r✓_>✓_)✓_(✓_C✓_D✓_R✓_ <✓_e✓_x✓_p✓_r✓_>✓_)✓_)✓_
- C✓_L✓_O✓_S✓_U✓_R✓_E✓_ c✓_o✓_p✓_y✓_ a✓_s✓_ a✓_n✓_ A✓_R✓_R✓_A✓_Y✓_
- S✓_T✓_R✓_I✓_N✓_G✓_ c✓_o✓_p✓_y✓_ o✓_f✓_ t✓_h✓_e✓_ s✓_t✓_r✓_i✓_n✓_g✓_
- F✓_I✓_X✓_N✓_U✓_M✓_ v✓_a✓_l✓_u✓_e✓_
- F✓_L✓_O✓_N✓_U✓_M✓_ v✓_a✓_l✓_u✓_e✓_
- C✓_H✓_A✓_R✓_A✓_C✓_T✓_E✓_R✓_ v✓_a✓_l✓_u✓_e✓_
- U✓_N✓_N✓_A✓_M✓_E✓_D✓_-✓_S✓_T✓_R✓_E✓_A✓_M✓_ c✓_o✓_p✓_y✓_ a✓_s✓_ a✓_ C✓_O✓_N✓_S✓_
- A✓_R✓_R✓_A✓_Y✓_ c✓_o✓_p✓_y✓_ o✓_f✓_ t✓_h✓_e✓_ a✓_r✓_r✓_a✓_y✓_
-
- (peek <addrs>) PEEK AT A LOCATION IN MEMORY
- <addrs> the address to peek at (integer)
- returns the value at the specified address (integer)
-
- (poke <addrs> <value>) POKE A VALUE INTO MEMORY
- <addrs> the address to poke (integer)
- <value> the value to poke into the address (integer)
- returns the value
-
-
-
-
-
-
-
- XLISP 2.0 SYSTEM FUNCTIONS Page 68
-
-
- (address-of <expr>) GET THE ADDRESS OF AN XLISP NODE
- <expr> the node
- returns the address of the node (integer)
-
- (✓_g✓_e✓_t✓_k✓_e✓_y✓_)✓_ R✓_E✓_A✓_D✓_ A✓_ K✓_E✓_Y✓_S✓_T✓_R✓_O✓_K✓_E✓_ F✓_R✓_O✓_M✓_ C✓_O✓_N✓_S✓_O✓_L✓_E✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ i✓_n✓_t✓_e✓_g✓_e✓_r✓_ v✓_a✓_l✓_u✓_e✓_ o✓_f✓_ k✓_e✓_y✓_ (✓_n✓_o✓_ e✓_c✓_h✓_o✓_)✓_
-
- (✓_s✓_y✓_s✓_t✓_e✓_m✓_ <✓_c✓_o✓_m✓_m✓_a✓_n✓_d✓_>✓_)✓_ E✓_X✓_E✓_C✓_U✓_T✓_E✓_ A✓_ S✓_Y✓_S✓_T✓_E✓_M✓_ C✓_O✓_M✓_M✓_A✓_N✓_D✓_
- <✓_c✓_o✓_m✓_m✓_a✓_n✓_d✓_>✓_ C✓_o✓_m✓_m✓_a✓_n✓_d✓_ s✓_t✓_r✓_i✓_n✓_g✓_,✓_ i✓_f✓_ 0✓_ l✓_e✓_n✓_g✓_t✓_h✓_ t✓_h✓_e✓_n✓_ s✓_p✓_a✓_w✓_n✓_ O✓_S✓_ s✓_h✓_e✓_l✓_l✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ T✓_ i✓_f✓_ s✓_u✓_c✓_c✓_e✓_s✓_s✓_f✓_u✓_l✓_ (✓_n✓_o✓_t✓_e✓_ t✓_h✓_a✓_t✓_ M✓_S✓_/✓_D✓_O✓_S✓_ c✓_o✓_m✓_m✓_a✓_n✓_d✓_.✓_c✓_o✓_m✓_ a✓_l✓_w✓_a✓_y✓_s✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ s✓_u✓_c✓_c✓_e✓_s✓_s✓_)✓_
-
- (✓_e✓_x✓_i✓_t✓_)✓_ E✓_X✓_I✓_T✓_ X✓_L✓_I✓_S✓_P✓_
- r✓_e✓_t✓_u✓_r✓_n✓_s✓_ n✓_e✓_v✓_e✓_r✓_ r✓_e✓_t✓_u✓_r✓_n✓_s✓_
-
- The following graphic functions represent an extension by Tom Almy:
-
- (mode <ax> [<bx> <width> <height>) SET DISPLAY MODE
- <ax> Graphic mode (value passed in register AX)
- <bx> BX value for some extended graphic modes
- <width> width for extended graphic modes
- <height> height for extended graphic modes
- returns T
-
- (color <value>) SET DRAWING COLOR
- <value> Drawing color (not checked for validity)
- returns <value>
-
- (move <x1> <y1> [<x2> <y2> ...]) ABSOLUTE MOVE
- (moverel <x1> <y2> [<x2> <y2> ...]) RELATIVE MOVE
- For moverel, all coordinates are relative to the preceeding
- point.
- <x1> <y1> Moves to point x1,y1 in anticipation of draw.
- <x2> <y2> Draws to points specified in additional arguments.
- returns T if succeeds, else NIL
-
- (draw [<x1> <y1> ...]) ABSOLUTE DRAW
- (drawrel [<x1> <y1> ...]) RELATIVE DRAW
- For drawrel, all coordinates are relative to the preceeding
- point.
- <x1> <y1> Point(s) drawn to, in order.
- returns T if succeeds, else NIL
-
-
-
-
-
-
-
- XLISP 2.0 ADDITIONAL FUNCTIONS Page 69
-
-
-
- ADDITIONAL FUNCTIONS AND UTILITIES
-
- T✓_h✓_i✓_s✓_ s✓_e✓_c✓_t✓_i✓_o✓_n✓_ i✓_s✓_ c✓_o✓_m✓_p✓_l✓_e✓_t✓_e✓_l✓_y✓_ n✓_e✓_w✓_ (✓_a✓_d✓_d✓_e✓_d✓_ b✓_y✓_ T✓_o✓_m✓_ A✓_l✓_m✓_y✓_)✓_.✓_
-
- STEP.LSP
-
- This file contains a simple Lisp single-step debugger. It started as
- an implementation of the "hook" example in chapter 20 of Steele's
- "Common Lisp". This version was brought up on Xlisp 1.7 for the Amiga,
- and then on VAXLISP.
-
- To invoke: (step (whatever-form with args))
-
- For each list (interpreted function call), the stepper prints the
- environment and the list, then enters a read-eval-print loop. At this
- point the available commands are:
-
- (a list)<CR> evaluate the list in the current environment, print the
- result, and repeat.
- <CR> step into the called function
- anything_else<CR> step over the called function.
-
- If the stepper comes to a form that is not a list it prints the form
- and the value, and continues on without stopping.
-
- Note that stepper commands are executed in the current environment.
- Since this is the case, the stepper commands can change the current
- environment. For example, a SETF will change an environment variable
- and thus can alter the course of execution.
-
- Global variables - newline, *hooklevel*
-
- Functions/macros - while step eval-hool-function step-spaces step-
- flush
-
- Note an even more powerful stepper package is in stepper.lsp
- (documented in stepper.doc).
-
-
-
-
-
-
-
- XLISP 2.0 ADDITIONAL FUNCTIONS Page 70
-
-
- PP.LSP
-
- In addition to the pretty-printer itself, this file contains a few
- functions that illustrate some simple but useful applications.
-
- (pp <object> [<stream>]) PRETTY PRINT EXPRESSION
- (pp-def <funct> [<stream>]) PRETTY PRINT FUNCTION/MACRO
- (pp-file <file> [<stream>]) PRETTY PRINT FILE
- <object> The expression to print
- <funct> Function to print (as DEFUN or DEFMACRO)
- <file> File to print (specify either as string or quoted
- symbol)
- <stream> Output stream (default is *standard-output*)
- returns T
-
- Global variables: tabsize maxsize miser-size min-miser-car max-normal-
- car
-
- Functions/Macros: sym-function pp-file pp-def make-def pp pp1 moveto
- spaces pp-rest-across pp-rest printmacrop pp-binding-form pp-do-form
- pp-defining-form pp-pair-form
-
- See the source file for more information.
-
-
-
-
-
-
-
- XLISP 2.0 ADDITIONAL FUNCTIONS Page 71
-
-
- REPAIR.LSP
-
- This file contains a structure editor.
- Execute (repair 'symbol) to edit a symbol.
- or (repairf symbol) to edit the function binding of a symbol
- (allows changing the argument list or function type,
- lambda or macro).
-
- The editor alters the current selection by copying so that aborting
- all changes is generally posible; the exception is when editing a
- closure, if the closure is BACKed out of, the change is permanent.
-
- For all commands taking a numeric argument, the first element of the
- selection is the 0th (as in NTH function).
-
- Any array elements become lists when they are selected, and return to
- arrays upon RETURN or BACK commands.
-
- Do not create new closures, because the environment will be incorrect.
- Closures become LAMBDA or MACRO expressions as the selection. Only the
- closure body may be changed; the argument list cannot be successfully
- modified, nor can the environment.
-
- For class objects, only the methods and message names can be modified.
- For instance objects, instance variables can be examined (if the
- object under-stands the message :<ivar> for the particular ivar), and
- changed (if :SET-IVAR is defined for that class, as it is if
- CLASSES.LSP is used).
-
- (command list on next page)
-
-
-
-
-
-
-
- XLISP 2.0 ADDITIONAL FUNCTIONS Page 72
-
-
- COMMANDS (general):
- ? list available commands for the selection.
- RETURN exit, saving all changes.
- ABORT exit, without changes.
- BACK go back one level (as before CAR CDR or N commands).
- B n go back n levels.
- L display selection using pprint; if selection is symbol,
- give short description.
- MAP pprints each element of selection, or if selection is
- symbol then gives complete description of properties.
- PLEV x set *print-level* to x. (Initial default is *rep-print-
- level*)
- PLEN x set *print-length to x. (Initial default is *rep-print-
- length*)
- EVAL x evaluates x and prints result. The symbol @ is bound to
- the selection.
- REPLACE x replaces the current selection with evaluated x. The
- symbol @ is bound to the selection.
- COMMANDS (if selection is symbol):
- VALUE edit the value binding.
- FUNCTION edit the function binding (must be a closure).
- PROP x edit property x.
- COMMANDS (if selection is list):
- CAR select the CAR of the current selection.
- CDR select the CDR of the current selection.
- n where n is small non-negative integer, changes current
- selection to (NTH n list).
- SUBST x y all occurances of (quoted) y are replaced with (quoted)
- x. EQUAL is used for the comparison.
- RAISE n removes parenthesis surrounding nth element of
- selection.
- LOWER n m inserts parenthesis starting with the nth element, for
- m elements.
- ARRAY n m as in LOWER, but makes elements into an array.
- I n x inserts (quoted) x before nth element in selection.
- R n x replaces nth element in selection with (quoted) x.
- D n deletes nth element in selection.
-
- All function names and global variables start with the string "rep-"
- or "*rep-*".
-
-
-
-
-
-
-
- XLISP 2.0 EXAMPLES Page 73
-
-
-
- EXAMPLES: FILE I/O FUNCTIONS
-
-
- Input from a File
-
- To open a file for input, use the OPEN function with the keyword
- argument :DIRECTION set to :INPUT. To open a file for output, use the
- OPEN function with the keyword argument :DIRECTION set to :OUTPUT. The
- OPEN function takes a single required argument which is the name of
- the file to be opened. This name can be in the form of a string or a
- symbol. The OPEN function returns an object of type FILE-STREAM if it
- succeeds in opening the specified file. It returns the value NIL if it
- fails. In order to manipulate the file, it is necessary to save the
- value returned by the OPEN function. This is usually done by assigning
- it to a variable with the SETQ special form or by binding it using LET
- or LET*. Here is an example:
-
- (setq fp (open "init.lsp" :direction :input))
-
- Evaluating this expression will result in the file "init.lsp" being
- opened. The file object that will be returned by the OPEN function
- will be assigned to the variable "fp".
-
- It is now possible to use the file for input. To read an expression
- from the file, just supply the value of the "fp" variable as the
- optional "stream" argument to READ.
-
- (read fp)
-
- Evaluating this expression will result in reading the first expression
- from the file "init.lsp". The expression will be returned as the
- result of the READ function. More expressions can be read from the
- file using further calls to the READ function. When there are no more
- expressions to read, the READ function will return NIL (or whatever
- value was supplied as the second argument to READ).
-
- Once you are done reading from the file, you should close it. To close
- the file, use the following expression:
-
- (close fp)
-
- Evaluating this expression will cause the file to be closed.
-
-
-
-
-
-
-
- XLISP 2.0 EXAMPLES Page 74
-
-
-
- Output to a File
-
- Writing to a file is pretty much the same as reading from one. You
- need to open the file first. This time you should use the OPEN
- function to indicate that you will do output to the file. For example:
-
- (setq fp (open "test.dat" :direction :output))
-
- Evaluating this expression will open the file "test.dat" for output.
- If the file already exists, its current contents will be discarded. If
- it doesn't already exist, it will be created. In any case, a FILE-
- STREAM object will be returned by the OPEN function. This file object
- will be assigned to the "fp" variable.
-
- It is now possible to write to this file by supplying the value of the
- "fp" variable as the optional "stream" parameter in the PRINT
- function.
-
- (print "Hello there" fp)
-
- Evaluating this expression will result in the string "Hello there"
- being written to the file "test.dat". More data can be written to the
- file using the same technique.
-
- Once you are done writing to the file, you should close it. Closing an
- output file is just like closing an input file.
-
- (close fp)
-
- Evaluating this expression will close the output file and make it
- permanent.
-
-
-
- A Slightly More Complicated File Example
-
- This example shows how to open a file, read each Lisp expression from
- the file and print it. It demonstrates the use of files and the use of
- the optional "stream" argument to the READ
- function.
-
- (do* ((fp (open "test.dat" :direction :input))
- (ex (read fp) (read fp)))
- ((null ex) nil)
- (print ex))
-
-
-
-
-
-
-
- XLISP 2.0 INDEX Page 75
-
-
- INDEX
-
- :answer 18
- :class 17
- :constituent 12
- :iskindof 17
- :ismemberof 17
- :isnew 17, 18
- :mescape 12
- :messages 18
- :new 18
- :nmacro 12
- :prin1 17
- :respondsto 17
- :sescape 12
- :show 17
- :storeon 17, 18
- :superclass 17, 18
- :tmacro 12
- :white-space 12
- + 20, 37
- ++ 20
- +++ 20
- - 20, 37
- * 20, 37
- ** 20
- *** 20
- *applyhook* 9, 20
- *breakenable* 5, 20
- *debug-io* 20
- *dos-input* 3, 20
- *error-output* 20
- *evalhook* 9, 20
- *float-format* 20
- *gc-flag* 20
- *gc-hook* 20
- *integer-format* 20
- *obarray* 20
- *print-case* 20
- *print-length* 20
- *print-level* 20
- *readtable* 12, 20
- *standard-input* 20
- *standard-output* 20
- *trace-output* 20
- *tracelimit* 5, 20
- *tracelist* 20
- *tracenable* 5, 20
- *unbound* 20
- / 37
- /= 39 < 39
- <= 39
- = 39
- > 39
- >= 39
- &aux 14
- &key 14
- &optional 14
- &rest 14
- 1+ 37
- 1- 37
- abs 38
- acos 38
- address-of 68
- alloc 66
- and 52
- append 32
- apply 21
- applyhook 9, 65
- aref 23, 27
- arrayp 50
- asin 38
- assoc 33
- atan 38
- atom 49
- backquote 21
- baktrace 64
- block 56
- both-case-p 43
- boundp 50
- break 64
- car 23, 32
- case 53
- catch 53
- cdr 23, 32
- cerror 64
- char 43
- char-code 43
- char-downcase 43
- char-equalp 44
- char-greaterp 44
- char-int 43
- char-lessp 44
- char-not-equalp 44
- char-not-greaterp 44
- char-not-lessp 44
- char-upcase 43
- char/= 44
- char< 44
-
-
-
-
-
-
-
- XLISP 2.0 INDEX Page 76
-
-
- char<= 44
- char= 44
- char> 44
- char>= 44
- characterp 49
- class 20
- classp 50
- clean-up 4, 64
- clean-up, 5
- close 61
- code-char 43
- coerce 67
- color 68
- comma 21
- comma-at 21
- concatenate 28
- cond 52
- cons 32
- consp 49
- continue 4, 5, 64
- copy-alist 34
- copy-list 34
- copy-tree 34
- cos 38
- count-if 30
- cxxr 32
- cxxxr 32
- cxxxxr 32
- debug 65
- defclass 47
- definst 48
- defmacro 24
- defmethod 47
- defstruct 45
- defun 24
- delete 30
- delete-if 31
- delete-if-not 31
- digit-char 43
- digit-char-p 43
- do 55
- do* 55
- dolist 55
- dotimes 55
- draw 68
- drawrel 68
- dribble 66
- elt 23, 28
- endp 49
- eq 50
- eql 51 equal 51
- error 64
- errset 5, 64
- eval 21
- evalhook 9, 65
- evenp 50
- every 28
- exit 68
- exp 38
- expand 66
- expt 38
- fboundp 50
- file-length 61
- file-position 62
- find-if 30
- first 32
- flatc 59
- flatsize 59
- flet 53
- float 37
- floatp 49
- fmakunbound 25
- format 60
- fourth 32
- funcall 21
- function 21
- gc 66
- gcd 38
- generic 67
- gensym 24
- get 23, 26
- get-lambda-expression 22
- get-macro-character 58
- get-output-stream-list 63
- get-output-stream-string
- 63
- getkey 68
- go 56
- hash 24
- if 52
- int-char 43
- integerp 49
- intern 24
- labels 53
- lambda 21
- last 32
- lconc 35
- length 28
- let 53
- let* 53
- list 32
-
-
-
-
-
-
-
- XLISP 2.0 INDEX Page 77
-
-
- listp 49
- load 66
- logand 40
- logior 40
- lognot 40
- logxor 40
- loop 55
- lower-case-p 43
- macroexpand 22
- macroexpand-1 22
- macrolet 53
- make-array 27
- make-string-input-stream
- 63
- make-string-output-stream
- 63
- make-symbol 24
- make_tconc 34
- makunbound 25
- map 28
- mapc 33
- mapcan 33
- mapcar 33
- mapcon 33
- mapl 33
- maplist 33
- max 37
- member 32
- min 37
- minusp 50
- mode 68
- move 68
- moverel 68
- nconc 36
- nil 20
- nodebug 65
- not 49
- notany 28
- notevery 28
- nreverse 29
- nstring-downcase 41
- nstring-upcase 41
- nth 23, 33
- nthcdr 33
- null 49
- numberp 49
- object 20
- objectp 50
- oddp 50
- open 61
- or 52 pairlis 34
- peek 67
- peek-char 62
- plusp 50
- poke 67
- pop 24
- position-if 30
- pp 70
- pprint 58
- prin1 58
- princ 58
- print 58
- prog 56
- prog* 56
- prog1 57
- prog2 57
- progn 57
- progv 56
- psetq 23
- push 24
- putprop 26
- quote 21
- random 38
- read 58
- read-byte 62
- read-char 62
- read-line 62
- rem 37
- remove 29
- remove-head 35
- remove-if 29
- remove-if-not 30
- remprop 26
- repair 71
- rest 32
- restore 66
- return 56
- return-from 56
- reverse 29
- room 66
- rplaca 36
- rplacd 36
- save 66
- search 29
- second 32
- self 16, 20
- send 16, 23, 47
- send-super 16, 47
- set 23
- set-macro-character 58
- setf 23
-
-
-
-
-
-
-
- XLISP 2.0 INDEX Page 78
-
-
- setq 23
- sin 38
- some 28
- sort 36
- sqrt 38
- step 69
- strcat 42
- streamp 50
- string 41
- string-downcase 41
- string-equalp 42
- string-greaterp 42
- string-left-trim 41
- string-lessp 42
- string-not-equalp 42
- string-not-greaterp 42
- string-not-lessp 42
- string-right-trim 41
- string-trim 41
- string-upcase 41
- string/= 42
- string< 42
- string<= 42
- string= 42
- string> 42
- string>= 42
- stringp 49
- sublis 34
- subseq 29
- subst 34
- symbol-function 23, 24
- symbol-name 24
- symbol-plist 23, 24
- symbol-value 23, 24
- symbolp 49
- system 68
- t 20
- tagbody 56
- tan 38
- tconc 35
- terpri 58
- third 32
- throw 53
- time 66
- top-level 4, 64
- trace 64
- truncate 37
- type-of 67
- unless 52
- untrace 64
- unwind-protect 54 upper-case-p 43
- vector 27
- when 52
- write-byte 62
- write-char 62
- zerop 50
-