$9700 Format=*PGF(090) Fontindex=2 Margin=0.00 :7 97 97 97 99 9E 9F 96ööööööööööö¿ XLISP: An Experimental Object-oriented Language 99 9D 9E 96öööööööööööööööööö¿Version 1.7 99 9D 9E 96öööööööööööööööööö¿June 2, 1986 97 9C 9C 9C 96öööööööööööööööööööö by +F 99 9C 9D 96ööööööööööööööööö David Michael Betz +F 99 9C 9D 96ööööööööööööööööö 114 Davenport Ave. +F 99 9C 9D 96öööööööööööööööö¿Manchester, NH¿03103 99 9D 9E 96öööööööööööööööö¿(603) 625-4691 (home) 99 9D 9E 96öööööööööööööCopyright (c) 1986, by David Michael Betz +F 99 9C 9D 96öööööööööööööööööAll Rights Reserved +F 99 9C 9D 96ööööööööööPermission is granted for unrestricted non-commercial use ;7 97 97 97 95 9F 96öööööööö¿ XLISPöööööööö]TABLE OF CONTENTSöööö¿Page 2 99 9D 9E 96ööööööööööööööööö Table of Contents 97 9C 9C 9C 96ööööööööööö¿ TABLE OF CONTENTSöööööö¿2 99 9D 9E 96ööööööööööö¿ INTRODUCTIONööööööööö¿4 99 9D 9E 96ööööööööööö¿ A NOTE FROM THE AUTHORöööö¿5 99 9D 9E 96ööööööööööö¿ XLISP COMMAND LOOPöööööööö¿6 99 9D 9E 96ööööööööööö¿ BREAK COMMAND LOOPöööööööö7 99 9D 9E 96ööööööööööö¿ DATA TYPESöööööööööööó8 99 9D 9E 96ööööööööööö¿ THE EVALUATORööööööööööö¿]9 99 9D 9E 96ööööööööööö¿ LEXICAL CONVENTIONSööööööö¿10 99 9D 9E 96ööööööööööö¿ READTABLESöööööööööö¿11 99 9D 9E 96ööööööööööö¿ OBJECTSööööööööööööö12 99 9D 9E 96ööööööööööö¿ SYMBOLSöööööööööööö¿]15 99 9D 9E 96ööööööööööö¿ EVALUATION FUNCTIONSööö¿]16 99 9D 9E 96ööööööööööö¿ SYMBOL FUNCTIONSöööööö¿17 99 9D 9E 96ööööööööööö¿ PROPERTY LIST FUNCTIONSööööö¿19 99 9D 9E 96ööööööööööö¿ ARRAY FUNCTIONSööööööö 20 99 9D 9E 96ööööööööööö¿ LIST FUNCTIONSööööööööööö¿21 99 9D 9E 96ööööööööööö¿ DESTRUCTIVE LIST FUNCTIONS¿24 99 9D 9E 96ööööööööööö¿ PREDICATE FUNCTIONSööööööö¿ 25 99 9D 9E 96ööööööööööö¿ CONTROL CONSTRUCTSöööööööö27 99 9D 9E 96ööööööööööö¿ LOOPING CONSTRUCTSöööööööö 29 99 9D 9E 96ööööööööööö¿ THE PROGRAM FEATUREööööööö 30 99 9D 9E 96ööööööööööö¿ DEBUGGING AND ERROR HANDLINGö31 99 9D 9E 96ööööööööööö¿ ARITHMETIC FUNCTIONSöööö]32 99 9D 9E 96ööööööööööö¿ BITWISE LOGICAL FUNCTIONSö 34 99 9D 9E 96ööööööööööö¿ RELATIONAL FUNCTIONSöööö35 ;7 97 97 97 95 9F 96öööööööö¿ XLISPöööööööö]TABLE OF CONTENTSöööö¿Page 3 99 9D 9E 96ööööööööööö¿ STRING FUNCTIONSööööööö36 99 9D 9E 96ööööööööööö¿ INPUT/OUTPUT FUNCTIONSööö37 99 9D 9E 96ööööööööööö¿ FILE I/O FUNCTIONSöööööö¿]38 99 9D 9E 96ööööööööööö¿ SYSTEM FUNCTIONSöööööö¿39 99 9D 9E 96ööööööööööö¿ EXAMPLESöööööööööööö41 ;7 97 97 97 95 9F 96öööööööö¿ XLISPöööööööööÖINTRODUCTIONöööööööööóPage 4 99 9D 9E 96öööööööö¿ XLISP is an experimental programming language combining some of +F 99 9C 9D 96öööööööö¿ the features of LISP with an object-oriented extension +F 99 9C 9D 96öööööööö¿ capability.¿It was implemented to allow experimentation with +F 99 9C 9D 96öööööööö¿ object-oriented programming on small computers.¿There are +F 99 9C 9D 96öööööööö¿ currently implementations running on the the VAX under VAX/VMS, +F 99 9C 9D 96öööööööö¿ on the 8088/8086 under MS-DOS, on the 68000 under CP/M-68K, on +F 99 9C 9D 96öööööööö¿ the Macintosh, on the Atari 520ST and on the Amiga.¿It is +F 99 9C 9D 96öööööööö¿ completely written in the programming language 'C' and is easily +F 99 9C 9D 96öööööööö¿ extended with user written built-in functions and classes.¿It +F 99 9C 9D 96öööööööö¿ is available in source form free of charge to non-commercial +F 99 9C 9D 96öööööööö¿ users. 99 9D 9E 96öööööööö¿ Many traditional LISP functions are built into XLISP.¿In +F 99 9C 9D 96öööööööö¿ addition, XLISP defines the objects 'Object' and 'Class' as +F 99 9C 9D 96öööööööö¿ primitives.¿'Object' is the only class that has no superclass +F 99 9C 9D 96öööööööö¿ and hence is the root of the class heirarchy tree.¿'Class' is +F 99 9C 9D 96öööööööö¿ the class of which all classes are instances (it is the only +F 99 9C 9D 96öööööööö¿ object that is an instance of itself). 99 9D 9E 96öööööööö¿ This document is a brief description of XLISP.öö]It assumes some +F 99 9C 9D 96öööööööö¿ knowledge of LISP and some understanding of the concepts of +F 99 9C 9D 96öööööööö¿ object-oriented programming. 99 9D 9E 96öööööööö¿ A recommended text for learning LISP programming is the book +F 99 9C 9D 96öööööööö¿ "LISP" by Winston and Horn and published by Addison Wesley.¿The +F 99 9C 9D 96öööööööö¿ first edition of this book is based on MacLisp and the second +F 99 9C 9D 96öööööööö¿ edition is based on Common Lisp.¿Future versions of XLISP will +F 99 9C 9D 96öööööööö¿ continue to migrate towards compatibility with Common Lisp. ;7 97 97 97 95 9F 96öööööööö¿ XLISPööööööö¿A NOTE FROM THE AUTHORöööö¿Page 5 97 9C 9C 9C 96öööööööö¿ A NOTE FROM THE AUTHOR 99 9D 9E 96öööööööö¿ If you have any problems with XLISP, feel free to contact me for +F 99 9C 9D 96öööööööö¿ help or advice.¿Please remember that since XLISP is available +F 99 9C 9D 96öööööööö¿ in source form in a high level language, many users have been +F 99 9C 9D 96öööööööö¿ making versions available on a variety of machines.¿If you call +F 99 9C 9D 96öööööööö¿ to report a problem with a specific version, I may not be able +F 99 9C 9D 96öööööööö¿ to help you if that version runs on a machine to which I don't +F 99 9C 9D 96öööööööö¿ have access.¿Please have the version number of the version that +F 99 9C 9D 96öööööööö¿ you are running readily accessible before calling me. 99 9D 9E 96öööööööö¿ If you find a bug in XLISP, first try to fix the bug yourself +F 99 9C 9D 96öööööööö¿ using the source code provided.¿If you are successful in fixing +F 99 9C 9D 96öööööööö¿ the bug, send the bug report along with the fix to me.ö¿If you +F 99 9C 9D 96öööööööö¿ don't have access to a C compiler or are unable to fix a bug, +F 99 9C 9D 96öööööööö¿ please send the bug report to me and I'll try to fix it. 99 9D 9E 96öööööööö¿ Any suggestions for improvements will be welcomed.¿Feel free to +F 99 9C 9D 96öööööööö¿ extend the language in whatever way suits your needs.¿However, +F 99 9C 9D 96öööööööö¿ PLEASE DO NOT RELEASE ENHANCED VERSIONS WITHOUT CHECKING +F 99 9C 9D 96ööööö¿ WITH ME +F 99 9C 9D 96öööööööö¿ FIRST!!¿I would like to be the clearing house for new features +F 99 9C 9D 96öööööööö¿ added to XLISP.¿If you want to add features for your own +F 99 9C 9D 96öööööööö¿ personal use, go ahead.¿But, if you want to distribute your +F 99 9C 9D 96öööööööö¿ enhanced version, contact me first.¿Please remember that the +F 99 9C 9D 96öööööööö¿ goal of XLISP is to provide a language to learn and experiment +F 99 9C 9D 96öööööööö¿ with LISP and object-oriented programming on small computers.¿I +F 99 9C 9D 96öööööööö¿ don't want it to get so big that it requires megabytes of memory +F 99 9C 9D 96öööööööö¿ to run. ;7 97 97 97 95 9F 96öööööööö¿ XLISPööööööö¿ XLISP COMMAND LOOPööööPage 6 97 9C 9C 9C 96öööööööö¿ XLISP COMMAND LOOP 99 9D 9E 96öööööööö¿ When XLISP is started, it first tries to load "init.lsp" from +F 99 9C 9D 96öööööööö¿ the default directory.ööIt then loads any files named as +F 99 9C 9D 96öööööööö¿ parameters on the command line (after appending ".lsp" to their +F 99 9C 9D 96öööööööö¿ names).¿It then issues the following prompt: 99 9D 9E 96öööööööö¿ > 99 9D 9E 96öööööööö¿ This indicates that XLISP is waiting for an expression to be +F 99 9C 9D 96öööööööö¿ typed.When an incomplete expression has been typed (one where +F 99 9C 9D 96öööööööö¿ the left and right parens don't match) XLISP changes its prompt +F 99 9C 9D 96öööööööö¿ to: 99 9D 9E 96öööööööö¿ n> 99 9D 9E 96öööööööö¿ where n is an integer indicating how many levels of left parens +F 99 9C 9D 96öööööööö¿ remain unclosed. 99 9D 9E 96öööööööö¿ When a complete expression has been entered, XLISP attempts to +F 99 9C 9D 96öööööööö¿ evaluate that expression.¿If the expression evaluates +F 99 9C 9D 96öööööööö¿ successfully, XLISP prints the result of the evaluation and then +F 99 9C 9D 96öööööööö¿ returns to the initial prompt waiting for another expression to +F 99 9C 9D 96öööööööö¿ be typed. ;7 97 97 97 95 9F 96öööööööö¿ XLISPööööööö¿ BREAK COMMAND LOOPöööööö Page 7 97 9C 9C 9C 96öööööööö¿ BREAK COMMAND LOOP 99 9D 9E 96öööööööö¿ When XLISP encounters an error while evaluating an expression, +F 99 9C 9D 96öööööööö¿ it attempts to handle the error in the following way: 99 9D 9E 96öööööööö¿ If the symbol '*breakenable*' is true, the message corresponding +F 99 9C 9D 96öööööööö¿ to the error is printed.¿If the error is correctable, the +F 99 9C 9D 96öööööööö¿ correction message is printed.öIf the symbol '*tracenable*' is +F 99 9C 9D 96öööööööö¿ true, a trace back is printed.öÖThe number of entries printed +F 99 9C 9D 96öööööööö¿ depends on the value of the symbol '*tracelimit*'.¿If this +F 99 9C 9D 96öööööööö¿ symbol is set to something other than a number, the entire trace +F 99 9C 9D 96öööööööö¿ back stack is printed.ööXLISP then enters a read/eval/print loop +F 99 9C 9D 96öööööööö¿ to allow the user to examine the state of the interpreter in the +F 99 9C 9D 96öööööööö¿ context of the error.¿This loop differs from the normal top- +F 99 9C 9D 96öööööööö¿ level read/eval/print loop in that if the user invokes the +F 99 9C 9D 96öööööööö¿ function 'continue', XLISP will continue from a correctable +F 99 9C 9D 96öööööööö¿ error. If the user invokes the function 'clean-up', XLISP will +F 99 9C 9D 96öööööööö¿ abort the break loop and return to the top level or the next +F 99 9C 9D 96öööööööö¿ lower numbered break loop.¿When in a break loop, XLISP prefixes +F 99 9C 9D 96öööööööö¿ the break level to the normal prompt. 99 9D 9E 96öööööööö¿ If the symbol '*breakenable*' is nil, XLISP looks for a +F 99 9C 9D 96öööööööö¿ surrounding errset function.¿If one is found, XLISP examines +F 99 9C 9D 96öööööööö¿ the value of the print flag.¿If this flag is true, the error +F 99 9C 9D 96öööööööö¿ message is printed.¿In any case, XLISP causes the errset +F 99 9C 9D 96öööööööö¿ function call to return nil. 99 9D 9E 96öööööööö¿ If there is no surrounding errset function, XLISP prints the +F 99 9C 9D 96öööööööö¿ error message and returns to the top level. ;7 97 97 97 95 9F 96öööööööö¿ XLISPööööööööö¿]DATA TYPESööööööö¿Page 8 97 9C 9C 9C 96öööööööö¿ DATA TYPES 99 9D 9E 96öööööööö¿ There are several different data types available to XLISP +F 99 9C 9D 96öööööööö¿ programmers. 99 9D 9E 96öööööööööö o lists +F 99 9C 9D 96öööööööööö o symbols +F 99 9C 9D 96öööööööööö o strings +F 99 9C 9D 96öööööööööö o integers +F 99 9C 9D 96öööööööööö o floats +F 99 9C 9D 96öööööööööö o objects +F 99 9C 9D 96öööööööööö o arrays +F 99 9C 9D 96öööööööööö o file pointers +F 99 9C 9D 96öööööööööö o subrs (built-in functions) +F 99 9C 9D 96öööööööööö o fsubrs (special forms) 99 9D 9E 96öööööööö¿ Another data type is the stream.¿A stream is a list node whose +F 99 9C 9D 96öööööööö¿ car points to the head of a list of integers and whose cdr +F 99 9C 9D 96öööööööö¿ points to the last list node of the list.¿An empty stream is a +F 99 9C 9D 96öööööööö¿ list node whose car and cdr are nil.¿Each of the integers in +F 99 9C 9D 96öööööööö¿ the list represents a character in the stream.¿When a character +F 99 9C 9D 96öööööööö¿ is read from a stream, the first integer from the head of the +F 99 9C 9D 96öööööööö¿ list is removed and returned.¿When a character is written to a +F 99 9C 9D 96öööööööö¿ stream, the integer representing the character code of the +F 99 9C 9D 96öööööööö¿ character is appended to the end of the list.¿When a function +F 99 9C 9D 96öööööööö¿ indicates that it takes an input source as a parameter, this +F 99 9C 9D 96öööööööö¿ parameter can either be an input file pointer or a stream. +F 99 9C 9D 96öööööööö¿ Similarly, when a function indicates that it takes an output +F 99 9C 9D 96öööööööö¿ sink as a parameter, this parameter can either be an output file +F 99 9C 9D 96öööööööö¿ pointer or a stream. ;7 97 97 97 95 9F 96öööööööö¿ XLISPöööööööööTHE EVALUATORöööööööö¿ Page 9 97 9C 9C 9C 96öööööööö¿ THE EVALUATOR 99 9D 9E 96öööööööö¿ The process of evaluation in XLISP: 99 9D 9E 96öööööööö¿ Integers, floats, strings, file pointers, subrs, fsubrs, objects +F 99 9C 9D 96öööööööö¿ and arrays evaluate to themselves 99 9D 9E 96öööööööö¿ Symbols evaluate to the value associated with their current +F 99 9C 9D 96öööööööö¿ binding 99 9D 9E 96öööööööö¿ Lists are evaluated by evaluating the first element of the list +F 99 9C 9D 96öööööööö¿ and then taking one of the following actions: 99 9D 9E 96öööööööööö If it is a subr, the remaining list elements are evaluated +F 99 9C 9D 96öööööööööö and the subr is called with these evaluated expressions as +F 99 9C 9D 96öööööööööö arguments. 99 9D 9E 96öööööööööö If it is an fsubr, the fsubr is called using the remaining +F 99 9C 9D 96öööööööööö list elements as arguments (unevaluated) 99 9D 9E 96öööööööööö If it is a list: 99 9D 9E 96ööööööööööö¿ If the list is a function closure (a list whose car is a +F 99 9C 9D 96ööööööööööö¿ lambda expression and whose cdr is an environment list), +F 99 9C 9D 96ööööööööööö¿ the car of the list is used as the function to be +F 99 9C 9D 96ööööööööööö¿ applied and the cdr is used as the environment to be +F 99 9C 9D 96ööööööööööö¿ extended with the parameter bindings. 99 9D 9E 96ööööööööööö¿ If the list is a lambda expression, the current +F 99 9C 9D 96ööööööööööö¿ environment is used for the function application. 99 9D 9E 96ööööööööööööö In either of the above two cases, the remaining list +F 99 9C 9D 96ööööööööööööö elements are evaluated and the resulting expressions +F 99 9C 9D 96ööööööööööööö are bound to the formal arguments of the lambda +F 99 9C 9D 96ööööööööööööö expression.¿The body of the function is executed +F 99 9C 9D 96ööööööööööööö within this new binding environment. 99 9D 9E 96ööööööööööö¿ If it is a list and the car of the list is 'macro', the +F 99 9C 9D 96ööööööööööö¿ remaining list elements are bound to the formal +F 99 9C 9D 96ööööööööööö¿ arguments of the macro expression.¿The body of the +F 99 9C 9D 96ööööööööööö¿ function is executed within this new binding +F 99 9C 9D 96ööööööööööö¿ environment.¿The result of this evaluation is +F 99 9C 9D 96ööööööööööö¿ considered the macro expansion.¿This result is then +F 99 9C 9D 96ööööööööööö¿ evaluated in place of the original expression. 99 9D 9E 96ööööööööööö¿ If it is an object, the second list element is evaluated +F 99 9C 9D 96ööööööööööö¿ and used as a message selector.¿The message formed by +F 99 9C 9D 96ööööööööööö¿ combining the selector with the values of the remaining +F 99 9C 9D 96ööööööööööö¿ list elements is sent to the object. ;7 97 97 97 95 9F 96öööööööö¿ XLISPööööööö¿ LEXICAL CONVENTIONSööööööPage 10 97 9C 9C 9C 96öööööööö¿ LEXICAL CONVENTIONS 99 9D 9E 96öööööööö¿ The following conventions must be followed when entering XLISP +F 99 9C 9D 96öööööööö¿ programs: 99 9D 9E 96öööööööö¿ Comments in XLISP code begin with a semi-colon character and +F 99 9C 9D 96öööööööö¿ continue to the end of the line. 99 9D 9E 96öööööööö¿ Symbol names in XLISP can consist of any sequence of non-blank +F 99 9C 9D 96öööööööö¿ printable characters except the following: 99 9D 9E 96ööööööööööö¿ ( ) ' ` , " ; 99 9D 9E 96öööööööö¿ Uppercase and lowercase characters are not distinguished within +F 99 9C 9D 96öööööööö¿ symbol names.¿All lowercase characters are mapped to uppercase +F 99 9C 9D 96öööööööö¿ on input. 99 9D 9E 96öööööööö¿ Integer literals consist of a sequence of digits optionally +F 99 9C 9D 96öööööööö¿ beginning with a '+' or '-'.¿The range of values an integer can +F 99 9C 9D 96öööööööö¿ represent is limited by the size of a C 'long' on the machine on +F 99 9C 9D 96öööööööö¿ which XLISP is running. 99 9D 9E 96öööööööö¿ Floating point literals consist of a sequence of digits +F 99 9C 9D 96öööööööö¿ optionally beginning with a '+' or '-' and including an embedded +F 99 9C 9D 96öööööööö¿ decimal point.öö The range of values a floating point number can +F 99 9C 9D 96öööööööö¿ represent is limited by the size of a C 'float' ('double' on +F 99 9C 9D 96öööööööö¿ machines with 32 bit addresses) on the machine on which XLISP is +F 99 9C 9D 96öööööööö¿ running. 99 9D 9E 96öööööööö¿ Literal strings are sequences of characters surrounded by double +F 99 9C 9D 96öööööööö¿ quotes.¿Within quoted strings the '' character is used to allow +F 99 9C 9D 96öööööööö¿ non-printable characters to be included.¿The codes recognized +F 99 9C 9D 96öööööööö¿ are: 99 9D 9E 96ööööööööööö¿ \\ööömeans the character '\' +F 99 9C 9D 96ööööööööööö¿ \nööómeans newline +F 99 9C 9D 96ööööööööööö¿ \töö¿means tab +F 99 9C 9D 96ööööööööööö¿ \röö¿means return +F 99 9C 9D 96ööööööööööö¿ \föö¿means form feed +F 99 9C 9D 96ööööööööööö¿ \nnnö]means the character whose octal code is nnn 99 9D 9E 96öööööööö¿ XLISP defines several useful read macros: 99 9D 9E 96ööööööööööö¿ 'ö¿== (quote ) +F 99 9C 9D 96ööööööööööö¿ #'ö== (function ) +F 99 9C 9D 96ööööööööööö¿ #(...)öö¿== an array of the specified expressions +F 99 9C 9D 96ööööööööööö¿ #xöö¿== a hexadecimal number +F 99 9C 9D 96ööööööööööö¿ #\ == the ASCII code of the character +F 99 9C 9D 96ööööööööööö¿ `ö¿== (backquote ) +F 99 9C 9D 96ööööööööööö¿ ,ö¿== (comma ) +F 99 9C 9D 96ööööööööööö¿ ,@¿== (comma-at ) ;7 97 97 97 95 9F 96öööööööö¿ XLISPööööööööö¿]READTABLESöööööööPage 11 97 9C 9C 9C 96öööööööö¿ READTABLES 99 9D 9E 96öööööööö¿ The behaviour of the reader is controlled by a data structure +F 99 9C 9D 96öööööööö¿ called a "readtable".¿The reader uses the symbol *READTABLE* to +F 99 9C 9D 96öööööööö¿ locate the current readtable.¿This table controls the +F 99 9C 9D 96öööööööö¿ interpretation of input characters.¿It is an array with 128 +F 99 9C 9D 96öööööööö¿ entries, one for each of the ASCII character codes.¿Each entry +F 99 9C 9D 96öööööööö¿ contains one of the following things: 99 9D 9E 96ööööööööööö¿ NILööööIndicating an invalid character +F 99 9C 9D 96ööööööööööö¿ :CONSTITUENT¿Indicating a symbol constituent +F 99 9C 9D 96ööööööööööö¿ :WHITE-SPACEöIndicating a whitespace character +F 99 9C 9D 96ööööööööööö¿ (:TMACRO . fun) Terminating readmacro +F 99 9C 9D 96ööööööööööö¿ (:NMACRO . fun) Non-terminating readmacro 99 9D 9E 96öööööööö¿ In the case of the last two forms, the "fun" component is a +F 99 9C 9D 96öööööööö¿ function definition.¿This can either be a pointer to a built-in +F 99 9C 9D 96öööööööö¿ readmacro function or a lambda expression.¿The function should +F 99 9C 9D 96öööööööö¿ take two parameters.¿The first is the input stream and the +F 99 9C 9D 96öööööööö¿ second is the character that caused the invocation of the +F 99 9C 9D 96öööööööö¿ readmacro.¿The character is passed as an integer.¿The +F 99 9C 9D 96öööööööö¿ readmacro function should return NIL to indicate that the +F 99 9C 9D 96öööööööö¿ character should be treated as white space or a value consed +F 99 9C 9D 96öööööööö¿ with NIL to indicate that the readmacro should be treated as an +F 99 9C 9D 96öööööööö¿ occurance of the specified value.¿Of course, the readmacro code +F 99 9C 9D 96öööööööö¿ is free to read additional characters from the input stream. ;7 97 97 97 95 9F 96öööööööö¿ XLISPöööööööööö]OBJECTSöööööööööPage 12 97 9C 9C 9C 96öööööööö¿ OBJECTS 99 9D 9E 96öööööööö¿ Definitions: 99 9D 9E 96öööööööööö o selector - a symbol used to select an appropriate method +F 99 9C 9D 96öööööööööö o message - a selector and a list of actual arguments +F 99 9C 9D 96öööööööööö o method - the code that implements a message 99 9D 9E 96öööööööö¿ Since XLISP was created to provide a simple basis for +F 99 9C 9D 96öööööööö¿ experimenting with object-oriented programming, one of the +F 99 9C 9D 96öööööööö¿ primitive data types included is 'object'.¿In XLISP, an object +F 99 9C 9D 96öööööööö¿ consists of a data structure containing a pointer to the +F 99 9C 9D 96öööööööö¿ object's class as well as an array containing the values of the +F 99 9C 9D 96öööööööö¿ object's instance variables. 99 9D 9E 96öööööööö¿ Officially, there is no way to see inside an object (look at the +F 99 9C 9D 96öööööööö¿ values of its instance variables).¿The only way to communicate +F 99 9C 9D 96öööööööö¿ with an object is by sending it a message.¿When the XLISP +F 99 9C 9D 96öööööööö¿ evaluator evaluates a list the value of whose first element is +F 99 9C 9D 96öööööööö¿ an object, it interprets the value of the second element of the +F 99 9C 9D 96öööööööö¿ list (which must be a symbol) as the message selector.ö¿The +F 99 9C 9D 96öööööööö¿ evaluator determines the class of the receiving object and +F 99 9C 9D 96öööööööö¿ attempts to find a method corresponding to the message selector +F 99 9C 9D 96öööööööö¿ in the set of messages defined for that class.]If the message +F 99 9C 9D 96öööööööö¿ is not found in the object's class and the class has a super- +F 99 9C 9D 96öööööööö¿ class, the search continues by looking at the messages defined +F 99 9C 9D 96öööööööö¿ for the super-class.¿This process continues from one super- +F 99 9C 9D 96öööööööö¿ class to the next until a method for the message is found.¿If +F 99 9C 9D 96öööööööö¿ no method is found, an error occurs. 99 9D 9E 96öööööööö¿ When a method is found, the evaluator binds the receiving object +F 99 9C 9D 96öööööööö¿ to the symbol 'self', binds the class in which the method was +F 99 9C 9D 96öööööööö¿ found to the symbol 'msgclass', and evaluates the method using +F 99 9C 9D 96öööööööö¿ the remaining elements of the original list as arguments to the +F 99 9C 9D 96öööööööö¿ method.¿These arguments are always evaluated prior to being +F 99 9C 9D 96öööööööö¿ bound to their corresponding formal arguments.öóThe result of +F 99 9C 9D 96öööööööö¿ evaluating the method becomes the result of the expression. ;7 97 97 97 95 9F 96öööööööö¿ XLISPöööööööööö]OBJECTSöööööööööPage 13 97 9C 9C 9C 96öööööööö¿ THE 'Object' CLASS 99 9D 9E 96öööööööö¿ Classes: 99 9D 9E 96öööööööö¿ ObjectTHE TOP OF THE CLASS HEIRARCHY 99 9D 9E 96öööööööööö Messages: 99 9D 9E 96ööööööööööö¿ :show¿SHOW AN OBJECT'S INSTANCE VARIABLES +F 99 9C 9D 96ööööööööööööö returnsöthe object 99 9D 9E 96ööööööööööö¿ :classóRETURN THE CLASS OF AN OBJECT +F 99 9C 9D 96ööööööööööööö returnsöthe class of the object 99 9D 9E 96ööööööööööö¿ :isnewTHE DEFAULT OBJECT INITIALIZATION ROUTINE +F 99 9C 9D 96ööööööööööööö returnsöthe object 99 9D 9E 96ööööööööööö¿ :sendsuper  ݨ...¿SEND SUPERCLASS A MESSAGE +F 99 9C 9D 96ööööööööööööö ö the message selector +F 99 9C 9D 96ööööööööööööö ¿the message arguments +F 99 9C 9D 96ööööööööööööö returnsöthe result of sending the message ;7 97 97 97 95 9F 96öööööööö¿ XLISPöööööööööö]OBJECTSöööööööööPage 14 97 9C 9C 9C 96öööööööö¿ THE 'Class' CLASS 99 9D 9E 96öööööööö¿ ClassóTHE CLASS OF ALL OBJECT CLASSES (including itself) 99 9D 9E 96öööööööööö Messages: 99 9D 9E 96ööööööööööö¿ :new¿CREATE A NEW INSTANCE OF A CLASS +F 99 9C 9D 96ööööööööööööö returnsöthe new class object 99 9D 9E 96ööööööööööö¿ :isnew  Ýݨ¨¿INITIALIZE A NEW CLASS +F 99 9C 9D 96ööööööööööööö the list of instance variable symbols +F 99 9C 9D 96ööööööööööööö the list of class variable symbols +F 99 9C 9D 96ööööööööööööö the superclass (default is Object) +F 99 9C 9D 96ööööööööööööö returnsöthe new class object 99 9D 9E 96ööööööööööö¿ :answer  ¿ADD A MESSAGE TO A CLASS +F 99 9C 9D 96ööööööööööööö ¿the message symbol +F 99 9C 9D 96ööööööööööööö ]the formal argument list +F 99 9C 9D 96öööööööööööööööööö¿this list is of the form: +F 99 9C 9D 96ööööööööööööööööööö (ݨ... +F 99 9C 9D 96ööööööööööööööööööö¿Ý&optional ݨ...¨ +F 99 9C 9D 96ööööööööööööööööööö¿Ý&rest ¨ +F 99 9C 9D 96ööööööööööööööööööö¿Ý&aux ݨ...¨) +F 99 9C 9D 96öööööööööööööööööö¿where +F 99 9C 9D 96ööööööööööööööööööö öa formal argument +F 99 9C 9D 96ööööööööööööööööööö öan optional argument +F 99 9C 9D 96ööööööööööööööööööö öbound to rest of the arguments +F 99 9C 9D 96ööööööööööööööööööö ö a auxiliary variable +F 99 9C 9D 96ööööööööööööö ¿a list of executable expressions +F 99 9C 9D 96ööööööööööööö returnsöthe object 97 9C 9C 9C 96öööööööö¿ When a new instance of a class is created by sending the message +F 99 9C 9D 96öööööööö¿ ':new' to an existing class, the message ':isnew' followed by +F 99 9C 9D 96öööööööö¿ whatever parameters were passed to the ':new' message is sent to +F 99 9C 9D 96öööööööö¿ the newly created object. 99 9D 9E 96öööööööö¿ When a new class is created by sending the ':new' message to the +F 99 9C 9D 96öööööööö¿ object 'Class', an optional parameter may be specified +F 99 9C 9D 96öööööööö¿ indicating the superclass of the new class.¿If this parameter +F 99 9C 9D 96öööööööö¿ is omitted, the new class will be a subclass of 'Object'.¿A +F 99 9C 9D 96öööööööö¿ class inherits all instance variables, class variables, and +F 99 9C 9D 96öööööööö¿ methods from its super-class. ;7 97 97 97 95 9F 96öööööööö¿ XLISPöööööööööö]SYMBOLSöööööööö¿Page 15 97 9C 9C 9C 96öööööööö¿ SYMBOLS 99 9D 9E 96öööööööööö o self - the current object (within a message context) +F 99 9C 9D 96öööööööööö o msgclass - the class in which the current method was found +F 99 9C 9D 96öööööööööö o *obarray* - the object hash table +F 99 9C 9D 96öööööööööö o *standard-input* - the standard input file +F 99 9C 9D 96öööööööööö o *standard-output* - the standard output file +F 99 9C 9D 96öööööööööö o *breakenable* - flag controlling entering break loop on errors +F 99 9C 9D 96öööööööööö o *tracenable* - enable baktrace on errors +F 99 9C 9D 96öööööööööö o *tracelimit* - number of levels of trace back information +F 99 9C 9D 96öööööööööö o *evalhook* - user substitute for the evaluator function +F 99 9C 9D 96öööööööööö o *applyhook* - (not yet implemented) +F 99 9C 9D 96öööööööööö o *readtable* - the current readtable +F 99 9C 9D 96öööööööööö o *unbound* - indicator for unbound symbols +F 99 9C 9D 96öööööööööö o *gc-flag* - controls the printing of gc messages ;7 97 97 97 95 9F 96öööööööö¿ XLISPööööööö¿ EVALUATION FUNCTIONSöööööPage 16 97 9C 9C 9C 96öööööööö¿ EVALUATION FUNCTIONS 99 9D 9E 96öööööööö¿ (eval )¿EVALUATE AN XLISP EXPRESSION +F 99 9C 9D 96öööööööööö Öthe expression to be evaluated +F 99 9C 9D 96öööööööööö returnsöthe result of evaluating the expression 99 9D 9E 96öööööööö¿ (apply  )¿APPLY A FUNCTION TO A LIST OF ARGUMENTS +F 99 9C 9D 96öööööööööö öthe function to apply (or function symbol) +F 99 9C 9D 96öööööööööö ¿the argument list +F 99 9C 9D 96öööööööööö returnsöthe result of applying the function to the arguments 99 9D 9E 96öööööööö¿ (funcall  ݨ...)¿CALL A FUNCTION WITH ARGUMENTS +F 99 9C 9D 96öööööööööö öthe function to call (or function symbol) +F 99 9C 9D 96öööööööööö öarguments to pass to the function +F 99 9C 9D 96öööööööööö returnsöthe result of calling the function with the arguments 99 9D 9E 96öööööööö¿ (quote )ö]RETURN AN EXPRESSION UNEVALUATED +F 99 9C 9D 96öööööööööö Öthe expression to be quoted (quoted) +F 99 9C 9D 96öööööööööö returnsö unevaluated 99 9D 9E 96öööööööö¿ (function )¿QUOTE A FUNCTION +F 99 9C 9D 96öööööööööö Öthe function to be quoted (quoted) +F 99 9C 9D 96öööööööööö returnsöa function closure 99 9D 9E 96öööööööö¿ (backquote )¿FILL IN A TEMPLATE +F 99 9C 9D 96öööööööööö Öthe template +F 99 9C 9D 96öööööööööö returnsöa copy of the template with comma and comma-at +F 99 9C 9D 96öööööööööööööö¿ expressions expanded 99 9D 9E 96öööööööö¿ (lambda  ݨ...)¿MAKE A FUNCTION CLOSURE +F 99 9C 9D 96öööööööööö ¿the argument list (quoted) +F 99 9C 9D 96öööööööööö Öexpressions of the function body +F 99 9C 9D 96öööööööööö returnsöthe function closure ;7 97 97 97 95 9F 96öööööööö¿ XLISPöööööööö¿]SYMBOL FUNCTIONSööööPage 17 99 9D 9E 96öööööööö¿ (set  )¿SET THE VALUE OF A SYMBOL +F 99 9C 9D 96öööööööööö ¿the symbol being set +F 99 9C 9D 96öööööööööö Öthe new value +F 99 9C 9D 96öööööööööö returnsöthe new value 99 9D 9E 96öööööööö¿ (setq Ý ¨...)¿SET THE VALUE OF A SYMBOL +F 99 9C 9D 96öööööööööö ¿the symbol being set (quoted) +F 99 9C 9D 96öööööööööö Öthe new value +F 99 9C 9D 96öööööööööö returnsöthe new value 99 9D 9E 96öööööööö¿ (setf Ý ¨...)¿SET THE VALUE OF A FIELD +F 99 9C 9D 96öööööööööö ]the field specifier (quoted): +F 99 9C 9D 96öööööööööööööööö ööööset value of a symbol +F 99 9C 9D 96öööööööööööööööö (car )ö set car of a list node +F 99 9C 9D 96öööööööööööööööö (cdr )ö set cdr of a list node +F 99 9C 9D 96öööööööööööööööö (nth )ö set nth car of a list +F 99 9C 9D 96öööööööööööööööö (aref )öset nth element of an array +F 99 9C 9D 96öööööööööööööööö (get )öööset value of a property +F 99 9C 9D 96öööööööööööööööö (symbol-value ) set value of a symbol +F 99 9C 9D 96öööööööööööööööö (symbol-plist ) set property list of a symbol +F 99 9C 9D 96öööööööööö the new value +F 99 9C 9D 96öööööööööö returnsöthe new value 99 9D 9E 96öööööööö¿ (defun  ݨ...)¿DEFINE A FUNCTION +F 99 9C 9D 96öööööööö¿ (defmacro  ݨ...)¿DEFINE A MACRO +F 99 9C 9D 96öööööööööö ¿symbol being defined (quoted) +F 99 9C 9D 96öööööööööö ]list of formal arguments (quoted) +F 99 9C 9D 96ööööööööööööööö¿this list is of the form: +F 99 9C 9D 96öööööööööööööööö (ݨ... +F 99 9C 9D 96öööööööööööööööö¿Ý&optional ݨ...¨ +F 99 9C 9D 96öööööööööööööööö¿Ý&rest ¨ +F 99 9C 9D 96öööööööööööööööö¿Ý&aux ݨ...¨) +F 99 9C 9D 96ööööööööööööööö¿where +F 99 9C 9D 96öööööööööööööööö ¿is a formal argument +F 99 9C 9D 96öööööööööööööööö Öis an optional argument +F 99 9C 9D 96öööööööööööööööö ¿bound to the rest of the arguments +F 99 9C 9D 96öööööööööööööööö ¿]is an auxiliary variable +F 99 9C 9D 96öööööööööö Öexpressions constituting the body of the +F 99 9C 9D 96öööööööööööööö¿ function (quoted) +F 99 9C 9D 96öööööööööö returnsöthe function symbol 99 9D 9E 96öööööööö¿ (gensym ݨ)¿GENERATE A SYMBOL +F 99 9C 9D 96öööööööööö östring or number +F 99 9C 9D 96öööööööööö returnsöthe new symbol 99 9D 9E 96öööööööö¿ (intern )¿MAKE AN INTERNED SYMBOL +F 99 9C 9D 96öööööööööö ööóthe symbol's print name string +F 99 9C 9D 96öööööööööö returnsöthe new symbol 99 9D 9E 96öööööööö¿ (make-symbol )¿MAKE AN UNINTERNED SYMBOL +F 99 9C 9D 96öööööööööö ööóthe symbol's print name string +F 99 9C 9D 96öööööööööö returnsöthe new symbol ;7 97 97 97 95 9F 96öööööööö¿ XLISPöööööööö¿]SYMBOL FUNCTIONSööööPage 18 97 9C 9C 9C 96öööööööö¿ (symbol-name )¿GET THE PRINT NAME OF A SYMBOL +F 99 9C 9D 96öööööööööö ¿the symbol +F 99 9C 9D 96öööööööööö returnsöthe symbol's print name 99 9D 9E 96öööööööö¿ (symbol-value )¿GET THE VALUE OF A SYMBOL +F 99 9C 9D 96öööööööööö ¿the symbol +F 99 9C 9D 96öööööööööö returnsöthe symbol's value 99 9D 9E 96öööööööö¿ (symbol-plist )¿GET THE PROPERTY LIST OF A SYMBOL +F 99 9C 9D 96öööööööööö ¿the symbol +F 99 9C 9D 96öööööööööö returnsöthe symbol's property list 99 9D 9E 96öööööööö¿ (hash  )¿COMPUTE THE HASH INDEX FOR A SYMBOL +F 99 9C 9D 96öööööööööö ¿the symbol or string +F 99 9C 9D 96öööööööööö ööthe table size (integer) +F 99 9C 9D 96öööööööööö returnsöthe hash index (integer) ;7 97 97 97 95 9F 96öööööööö¿ XLISPööööööö]PROPERTY LIST FUNCTIONSöööö¿Page 19 97 9C 9C 9C 96öööööööö¿ PROPERTY LIST FUNCTIONS 99 9D 9E 96öööööööö¿ (get  )¿GET THE VALUE OF A PROPERTY +F 99 9C 9D 96öööööööööö ¿the symbol +F 99 9C 9D 96öööööööööö óthe property symbol +F 99 9C 9D 96öööööööööö returnsöthe property value or nil 99 9D 9E 96öööööööö¿ (putprop  )¿PUT A PROPERTY ONTO A PROPERTY LIST +F 99 9C 9D 96öööööööööö ¿the symbol +F 99 9C 9D 96öööööööööö öthe property value +F 99 9C 9D 96öööööööööö óthe property symbol +F 99 9C 9D 96öööööööööö returnsöthe property value 99 9D 9E 96öööööööö¿ (remprop  )ö¿REMOVE A PROPERTY +F 99 9C 9D 96öööööööööö ¿the symbol +F 99 9C 9D 96öööööööööö óthe property symbol +F 99 9C 9D 96öööööööööö returnsönil ;7 97 97 97 95 9F 96öööööööö¿ XLISPöööööööö¿]ARRAY FUNCTIONSöööö¿Page 20 97 9C 9C 9C 96öööööööö¿ ARRAY FUNCTIONS 99 9D 9E 96öööööööö¿ (aref  )¿GET THE NTH ELEMENT OF AN ARRAY +F 99 9C 9D 96öööööööööö the array +F 99 9C 9D 96öööööööööö ööthe array index (integer) +F 99 9C 9D 96öööööööööö returnsöthe value of the array element 99 9D 9E 96öööööööö¿ (make-array )¿MAKE A NEW ARRAY +F 99 9C 9D 96öööööööööö ¿ the size of the new array (integer) +F 99 9C 9D 96öööööööööö returns the new array ;7 97 97 97 95 9F 96ööööööööööö¿ XLISPöööööööööLIST FUNCTIONSööööö¿]Page 21 97 9C 9C 9C 96öööööööö¿ LIST FUNCTIONS 99 9D 9E 96öööööööö¿ (car )¿RETURN THE CAR OF A LIST NODE +F 99 9C 9D 96öööööööööö Öthe list node +F 99 9C 9D 96öööööööööö returnsöthe car of the list node 99 9D 9E 96öööööööö¿ (cdr )¿RETURN THE CDR OF A LIST NODE +F 99 9C 9D 96öööööööööö Öthe list node +F 99 9C 9D 96öööööööööö returnsöthe cdr of the list node 99 9D 9E 96öööööööö¿ (cxxr )¿ALL CxxR COMBINATIONS +F 99 9C 9D 96öööööööö¿ (cxxxr )ö]ALL CxxxR COMBINATIONS +F 99 9C 9D 96öööööööö¿ (cxxxxr )¿ALL CxxxxR COMBINATIONS 99 9D 9E 96öööööööö¿ (cons  )öö]CONSTRUCT A NEW LIST NODE +F 99 9C 9D 96öööööööööö öööthe car of the new list node +F 99 9C 9D 96öööööööööö öööthe cdr of the new list node +F 99 9C 9D 96öööööööööö returnsöthe new list node 99 9D 9E 96öööööööö¿ (list ݨ...)¿CREATE A LIST OF VALUES +F 99 9C 9D 96öööööööööö Öexpressions to be combined into a list +F 99 9C 9D 96öööööööööö returnsöthe new list 99 9D 9E 96öööööööö¿ (append ݨ...)¿APPEND LISTS +F 99 9C 9D 96öööööööööö Ölists whose elements are to be appended +F 99 9C 9D 96öööööööööö returnsöthe new list 99 9D 9E 96öööööööö¿ (reverse )¿REVERSE A LIST +F 99 9C 9D 96öööööööööö Öthe list to reverse +F 99 9C 9D 96öööööööööö returnsöa new list in the reverse order 99 9D 9E 96öööööööö¿ (last )¿RETURN THE LAST LIST NODE OF A LIST +F 99 9C 9D 96öööööööööö öthe list +F 99 9C 9D 96öööööööööö returnsöthe last list node in the list 99 9D 9E 96öööööööö¿ (member  Ý ¨)¿FIND AN EXPRESSION IN A LIST +F 99 9C 9D 96öööööööööö Öthe expression to find +F 99 9C 9D 96öööööööööö öthe list to search +F 99 9C 9D 96öööööööööö öthe keyword :test or :test-not +F 99 9C 9D 96öööööööööö ¿]the test function (defaults to eql) +F 99 9C 9D 96öööööööööö returnsöthe remainder of the list starting with the expression 99 9D 9E 96öööööööö¿ (assoc  Ý ¨)¿FIND AN EXPRESSION IN AN A- +F 99 9C 9D 96ööööö¿ LIST +F 99 9C 9D 96öööööööööö Öthe expression to find +F 99 9C 9D 96öööööööööö ¿the association list +F 99 9C 9D 96öööööööööö öthe keyword :test or :test-not +F 99 9C 9D 96öööööööööö ¿]the test function (defaults to eql) +F 99 9C 9D 96öööööööööö returnsöthe alist entry or nil ;7 97 97 97 95 9F 96öööööööö¿ XLISPöööööööööLIST FUNCTIONSööööö¿]Page 22 97 9C 9C 9C 96öööööööö¿ (remove  Ý ¨)¿REMOVE AN EXPRESSION +F 99 9C 9D 96öööööööööö Öthe expression to delete +F 99 9C 9D 96öööööööööö öthe list +F 99 9C 9D 96öööööööööö öthe keyword :test or :test-not +F 99 9C 9D 96öööööööööö ¿]the test function (defaults to eql) +F 99 9C 9D 96öööööööööö returnsöthe list with the matching expressions deleted 99 9D 9E 96öööööööö¿ (length )¿FIND THE LENGTH OF A LIST OR STRING +F 99 9C 9D 96öööööööööö Öthe list or string +F 99 9C 9D 96öööööööööö returnsöthe length of the list or string 99 9D 9E 96öööööööö¿ (nth  )¿RETURN THE NTH ELEMENT OF A LIST +F 99 9C 9D 96öööööööööö ööthe number of the element to return (zero origin) +F 99 9C 9D 96öööööööööö öthe list +F 99 9C 9D 96öööööööööö returnsöthe nth element or nil if the list isn't that long 99 9D 9E 96öööööööö¿ (nthcdr  )¿RETURN THE NTH CDR OF A LIST +F 99 9C 9D 96öööööööööö ööthe number of the element to return (zero origin) +F 99 9C 9D 96öööööööööö öthe list +F 99 9C 9D 96öööööööööö returnsöthe nth cdr or nil if the list isn't that long 99 9D 9E 96öööööööö¿ (mapc  ݨ...)¿APPLY FUNCTION TO SUCCESSIVE CARS +F 99 9C 9D 96öööööööööö öthe function or function name +F 99 9C 9D 96öööööööööö Öa list for each argument of the function +F 99 9C 9D 96öööööööööö returnsöthe first list of arguments 99 9D 9E 96öööööööö¿ (mapcar  ݨ...)¿APPLY FUNCTION TO SUCCESSIVE CARS +F 99 9C 9D 96öööööööööö öthe function or function name +F 99 9C 9D 96öööööööööö Öa list for each argument of the function +F 99 9C 9D 96öööööööööö returnsöa list of the values returned 99 9D 9E 96öööööööö¿ (mapl  ݨ...)¿APPLY FUNCTION TO SUCCESSIVE CDRS +F 99 9C 9D 96öööööööööö öthe function or function name +F 99 9C 9D 96öööööööööö Öa list for each argument of the function +F 99 9C 9D 96öööööööööö returnsöthe first list of arguments 99 9D 9E 96öööööööö¿ (maplist  ݨ...)¿APPLY FUNCTION TO SUCCESSIVE CDRS +F 99 9C 9D 96öööööööööö öthe function or function name +F 99 9C 9D 96öööööööööö Öa list for each argument of the function +F 99 9C 9D 96öööööööööö returnsöa list of the values returned ;7 97 97 97 95 9F 96öööööööö¿ XLISPöööööööööLIST FUNCTIONSööööö¿]Page 23 97 9C 9C 9C 96öööööööö¿ (subst  Ý ¨)¿SUBSTITUTE EXPRESSIONS +F 99 9C 9D 96öööööööööö ö¿the new expression +F 99 9C 9D 96öööööööööö the old expression +F 99 9C 9D 96öööööööööö Öthe expression in which to do the substitutions +F 99 9C 9D 96öööööööööö öthe keyword :test or :test-not +F 99 9C 9D 96öööööööööö ¿]the test function (defaults to eql) +F 99 9C 9D 96öööööööööö returnsöthe expression with substitutions 99 9D 9E 96öööööööö¿ (sublis  Ý ¨)SUBSTITUTE WITH AN A-LIST +F 99 9C 9D 96öööööööööö ¿the association list +F 99 9C 9D 96öööööööööö Öthe expression in which to do the substitutions +F 99 9C 9D 96öööööööööö öthe keyword :test or :test-not +F 99 9C 9D 96öööööööööö ¿]the test function (defaults to eql) +F 99 9C 9D 96öööööööööö returnsöthe expression with substitutions ;7 97 97 97 95 9F 96öööööööö¿ XLISPöööööö¿]DESTRUCTIVE LIST FUNCTIONSööööööPage 24 97 9C 9C 9C 96öööööööö¿ DESTRUCTIVE LIST FUNCTIONS 99 9D 9E 96öööööööö¿ (rplaca  )REPLACE THE CAR OF A LIST NODE +F 99 9C 9D 96öööööööööö öthe list node +F 99 9C 9D 96öööööööööö Öthe new value for the car of the list node +F 99 9C 9D 96öööööööööö returnsöthe list node after updating the car 99 9D 9E 96öööööööö¿ (rplacd  )REPLACE THE CDR OF A LIST NODE +F 99 9C 9D 96öööööööööö öthe list node +F 99 9C 9D 96öööööööööö Öthe new value for the cdr of the list node +F 99 9C 9D 96öööööööööö returnsöthe list node after updating the cdr 99 9D 9E 96öööööööö¿ (nconc ݨ...)¿DESTRUCTIVELY CONCATENATE LISTS +F 99 9C 9D 96öööööööööö ölists to concatenate +F 99 9C 9D 96öööööööööö returnsöthe result of concatenating the lists 99 9D 9E 96öööööööö¿ (delete  Ý ¨)¿DELETE AN EXPRESSION FROM A +F 99 9C 9D 96ööööö¿ LIST +F 99 9C 9D 96öööööööööö Öthe expression to delete +F 99 9C 9D 96öööööööööö öthe list +F 99 9C 9D 96öööööööööö öthe keyword :test or :test-not +F 99 9C 9D 96öööööööööö ¿]the test function (defaults to eql) +F 99 9C 9D 96öööööööööö returnsöthe list with the matching expressions deleted ;7 97 97 97 95 9F 96öööööööö¿ XLISPööööööö¿ PREDICATE FUNCTIONSöööööö]Page 25 97 9C 9C 9C 96öööööööö¿ PREDICATE FUNCTIONS 99 9D 9E 96öööööööö¿ (atom )¿IS THIS AN ATOM? +F 99 9C 9D 96öööööööööö Öthe expression to check +F 99 9C 9D 96öööööööööö returnsöt if the value is an atom, nil otherwise 99 9D 9E 96öööööööö¿ (symbolp )¿IS THIS A SYMBOL? +F 99 9C 9D 96öööööööööö Öthe expression to check +F 99 9C 9D 96öööööööööö returnsöt if the expression is a symbol, nil otherwise 99 9D 9E 96öööööööö¿ (numberp )¿IS THIS A NUMBER? +F 99 9C 9D 96öööööööööö Öthe expression to check +F 99 9C 9D 96öööööööööö returnsöt if the expression is a number, nil otherwise 99 9D 9E 96öööööööö¿ (null )¿IS THIS AN EMPTY LIST? +F 99 9C 9D 96öööööööööö Öthe list to check +F 99 9C 9D 96öööööööööö returnsöt if the list is empty, nil otherwise 99 9D 9E 96öööööööö¿ (not )¿IS THIS FALSE? +F 99 9C 9D 96öööööööööö Öthe expression to check +F 99 9C 9D 96öööööööööö returnö¿t if the expression is nil, nil otherwise 99 9D 9E 96öööööööö¿ (listp )ö¿IS THIS A LIST? +F 99 9C 9D 96öööööööööö Öthe expression to check +F 99 9C 9D 96öööööööööö returnsöt if the value is a list node or nil, nil otherwise 99 9D 9E 96öööööööö¿ (consp )ö]IS THIS A NON-EMPTY LIST? +F 99 9C 9D 96öööööööööö Öthe expression to check +F 99 9C 9D 96öööööööööö returnsöt if the value is a list node, nil otherwise 99 9D 9E 96öööööööö¿ (boundp )¿IS THIS A BOUND SYMBOL? +F 99 9C 9D 96öööööööööö ¿the symbol +F 99 9C 9D 96öööööööööö returnsöt if a value is bound to the symbol, nil otherwise ;7 97 97 97 95 9F 96öööööööö¿ XLISPööööööö¿ PREDICATE FUNCTIONSöööööö]Page 26 97 9C 9C 9C 96öööööööö¿ (minusp )¿IS THIS NUMBER NEGATIVE? +F 99 9C 9D 96öööööööööö Öthe number to test +F 99 9C 9D 96öööööööööö returnsöt if the number is negative, nil otherwise 99 9D 9E 96öööööööö¿ (zerop )ö IS THIS NUMBER ZERO? +F 99 9C 9D 96öööööööööö Öthe number to test +F 99 9C 9D 96öööööööööö returnsöt if the number is zero, nil otherwise 99 9D 9E 96öööööööö¿ (plusp )ö IS THIS NUMBER POSITIVE? +F 99 9C 9D 96öööööööööö Öthe number to test +F 99 9C 9D 96öööööööööö returnsöt if the number is positive, nil otherwise 99 9D 9E 96öööööööö¿ (evenp )öIS THIS NUMBER EVEN? +F 99 9C 9D 96öööööööööö Öthe number to test +F 99 9C 9D 96öööööööööö returnsöt if the number is even, nil otherwise 99 9D 9E 96öööööööö¿ (oddp )¿IS THIS NUMBER ODD? +F 99 9C 9D 96öööööööööö Öthe number to test +F 99 9C 9D 96öööööööööö returnsöt if the number is odd, nil otherwise 99 9D 9E 96öööööööö¿ (eq  )¿ARE THE EXPRESSIONS IDENTICAL? +F 99 9C 9D 96öööööööööö öööthe first expression +F 99 9C 9D 96öööööööööö öööthe second expression +F 99 9C 9D 96öööööööööö returnsöt if they are equal, nil otherwise 99 9D 9E 96öööööööö¿ (eql  )¿ARE THE EXPRESSIONS IDENTICAL? +F 99 9C 9D 96ööööööööööööööööö¿ (WORKS WITH NUMBERS AND STRINGS) +F 99 9C 9D 96öööööööööö öööthe first expression +F 99 9C 9D 96öööööööööö öööthe second expression +F 99 9C 9D 96öööööööööö returnsöt if they are equal, nil otherwise 99 9D 9E 96öööööööö¿ (equal  )¿ARE THE EXPRESSIONS EQUAL? +F 99 9C 9D 96öööööööööö öööthe first expression +F 99 9C 9D 96öööööööööö öööthe second expression +F 99 9C 9D 96öööööööööö returnsöt if they are equal, nil otherwise ;7 97 97 97 95 9F 96öööööööö¿ XLISPöööööööö]CONTROL CONSTRUCTSööööööPage 27 99 9D 9E 96öööööööö¿ (cond ݨ...)¿EVALUATE CONDITIONALLY +F 99 9C 9D 96öööööööööö ¿pair consisting of: +F 99 9C 9D 96öööööööööööööööö ( ݨ...) +F 99 9C 9D 96ööööööööööööööö¿where +F 99 9C 9D 96öööööööööööööööö Öis a predicate expression +F 99 9C 9D 96öööööööööööööööö Öevaluated if the predicate +F 99 9C 9D 96öööööööööööööööööööö¿ is not nil +F 99 9C 9D 96öööööööööö returnsöthe value of the first expression whose predicate +F 99 9C 9D 96öööööööööööööö¿ is not nil 99 9D 9E 96öööööööö¿ (and ݨ...)¿THE LOGICAL AND OF A LIST OF EXPRESSIONS +F 99 9C 9D 96öööööööööö Öthe expressions to be ANDed +F 99 9C 9D 96öööööööööö returnsönil if any expression evaluates to nil, +F 99 9C 9D 96öööööööööööööö¿ otherwise the value of the last expression +F 99 9C 9D 96öööööööööööööö¿ (evaluation of expressions stops after the first +F 99 9C 9D 96ööööööööööööööö expression that evaluates to nil) 99 9D 9E 96öööööööö¿ (or ݨ...)¿THE LOGICAL OR OF A LIST OF EXPRESSIONS +F 99 9C 9D 96öööööööööö Öthe expressions to be ORed +F 99 9C 9D 96öööööööööö returnsönil if all expressions evaluate to nil, +F 99 9C 9D 96öööööööööööööö¿ otherwise the value of the first non-nil expression +F 99 9C 9D 96öööööööööööööö¿ (evaluation of expressions stops after the first +F 99 9C 9D 96ööööööööööööööö expression that does not evaluate to nil) 99 9D 9E 96öööööööö¿ (if  ݨ)öEXECUTE EXPRESSIONS +F 99 9C 9D 96ööööö¿ CONDITIONALLY +F 99 9C 9D 96öööööööööö the test expression +F 99 9C 9D 96öööööööööö öööthe expression to be evaluated if texpr is non-nil +F 99 9C 9D 96öööööööööö öööthe expression to be evaluated if texpr is nil +F 99 9C 9D 96öööööööööö returnsöthe value of the selected expression 99 9D 9E 96öööööööö¿ (case  ݨ...)¿SELECT BY CASE +F 99 9C 9D 96öööööööööö Öthe selection expression +F 99 9C 9D 96öööööööööö ¿pair consisting of: +F 99 9C 9D 96öööööööööööööööö ( ݨ...) +F 99 9C 9D 96ööööööööööööööö¿where: +F 99 9C 9D 96öööööööööööööööö is a single expression or a list of +F 99 9C 9D 96öööööööööööööööööööö¿ expressions (unevaluated) +F 99 9C 9D 96öööööööööööööööö Öare expressions to execute if the +F 99 9C 9D 96öööööööööööööööööööö¿ case matches +F 99 9C 9D 96öööööööööö returnsöthe value of the last expression of the matching case 99 9D 9E 96öööööööö¿ (let (ݨ...) ݨ...)¿CREATE LOCAL BINDINGS +F 99 9C 9D 96öööööööö¿ (let* (ݨ...) ݨ...)¿LET WITH SEQUENTIAL BINDING +F 99 9C 9D 96öööööööööö ööthe variable bindings each of which is either: +F 99 9C 9D 96öööööööööööööö¿ 1)¿a symbol (which is initialized to nil) +F 99 9C 9D 96öööööööööööööö¿ 2)¿a list whose car is a symbol and whose cadr +F 99 9C 9D 96ööööööööööööööööö¿ is an initialization expression +F 99 9C 9D 96öööööööööö Öthe expressions to be evaluated +F 99 9C 9D 96öööööööööö returnsöthe value of the last expression ;7 97 97 97 95 9F 96öööööööö¿ XLISPöööööööö]CONTROL CONSTRUCTSööööööPage 28 99 9D 9E 96öööööööö¿ (catch  ݨ...)¿EVALUATE EXPRESSIONS AND CATCH THROWS +F 99 9C 9D 96öööööööööö ¿the catch tag 99 9D 9E 96öööööööööö Öexpressions to evaluate +F 99 9C 9D 96öööööööööö returnsöthe value of the last expression the throw exprssion 99 9D 9E 96öööööööö¿ (throw  ݨ)ööTHROW TO A CATCH +F 99 9C 9D 96öööööööööö ¿the catch tag +F 99 9C 9D 96öööööööööö Öthe value for the catch to return (defaults to nil) +F 99 9C 9D 96öööööööööö returnsönever returns ;7 97 97 97 95 9F 96öööööööö¿ XLISPöööööööö]LOOPING CONSTRUCTSööö Page 29 97 9C 9C 9C 96öööööööö¿ LOOPING CONSTRUCTS 99 9D 9E 96öööööööö¿ (do (ݨ...) ( ݨ...) ݨ...) +F 99 9C 9D 96öööööööö¿ (do* (ݨ...) ( ݨ...) ݨ...) +F 99 9C 9D 96öööööööööö ööthe variable bindings each of which is either: +F 99 9C 9D 96öööööööööööööö¿ 1)¿a symbol (which is initialized to nil) +F 99 9C 9D 96öööööööööööööö¿ 2)¿a list of the form: ( ݨ) +F 99 9C 9D 96öööööööööööööööö where: +F 99 9C 9D 96ööööööööööööööööö¿ ¿is the symbol to bind +F 99 9C 9D 96ööööööööööööööööö¿ is the initial value of the symbol +F 99 9C 9D 96ööööööööööööööööö¿ is a step expression +F 99 9C 9D 96öööööööööö the termination test expression +F 99 9C 9D 96öööööööööö result expressions (the default is nil) +F 99 9C 9D 96öööööööööö Öthe body of the loop (treated like an implicit prog) +F 99 9C 9D 96öööööööööö returnsöthe value of the last result expression 99 9D 9E 96öööööööö¿ (dolist ( ݨ) ݨ...)¿LOOP THROUGH A LIST +F 99 9C 9D 96öööööööööö ¿the symbol to bind to each list element +F 99 9C 9D 96öööööööööö Öthe list expression +F 99 9C 9D 96öööööööööö the result expression (the default is nil) +F 99 9C 9D 96öööööööööö Öthe body of the loop (treated like an implicit prog) 99 9D 9E 96öööööööö¿ (dotimes ( ݨ) ݨ...)ö¿LOOP FROM ZERO TO N-1 +F 99 9C 9D 96öööööööööö ¿the symbol to bind to each value from 0 to n-1 +F 99 9C 9D 96öööööööööö Öthe number of times to loop +F 99 9C 9D 96öööööööööö the result expression (the default is nil) +F 99 9C 9D 96öööööööööö Öthe body of the loop (treated like an implicit prog) ;7 97 97 97 95 9F 96öööööööö¿ XLISPööööööö¿ THE PROGRAM FEATUREööööö¿Page 30 97 9C 9C 9C 96öööööööö¿ THE PROGRAM FEATURE 99 9D 9E 96öööööööö¿ (prog (ݨ...) ݨ...)¿THE PROGRAM FEATURE +F 99 9C 9D 96öööööööö¿ (prog* (ݨ...) ݨ...)¿PROG WITH SEQUENTIAL BINDING +F 99 9C 9D 96öööööööööö ööthe variable bindings each of which is either: +F 99 9C 9D 96öööööööööööööö¿ 1)¿a symbol (which is initialized to nil) +F 99 9C 9D 96öööööööööööööö¿ 2)¿a list whose car is a symbol and whose cadr +F 99 9C 9D 96ööööööööööööööööö¿ is an initialization expression +F 99 9C 9D 96öööööööööö Öexpressions to evaluate or tags (symbols) +F 99 9C 9D 96öööööööööö returnsönil or the argument passed to the return function 99 9D 9E 96öööööööö¿ (go )¿GO TO A TAG WITHIN A PROG CONSTRUCT +F 99 9C 9D 96öööööööööö ¿the tag (quoted) +F 99 9C 9D 96öööööööööö returnsönever returns 99 9D 9E 96öööööööö¿ (return ݨ)¿CAUSE A PROG CONSTRUCT TO RETURN A VALUE +F 99 9C 9D 96öööööööööö Öthe value (defaults to nil) +F 99 9C 9D 96öööööööööö returnsönever returns 99 9D 9E 96öööööööö¿ (prog1  ݨ...)¿EXECUTE EXPRESSIONS SEQUENTIALLY +F 99 9C 9D 96öööööööööö öööthe first expression to evaluate +F 99 9C 9D 96öööööööööö Öthe remaining expressions to evaluate +F 99 9C 9D 96öööööööööö returnsöthe value of the first expression 99 9D 9E 96öööööööö¿ (prog2  ݨ...)¿EXECUTE EXPRESSIONS +F 99 9C 9D 96ööööö¿ SEQUENTIALLY +F 99 9C 9D 96öööööööööö öööthe first expression to evaluate +F 99 9C 9D 96öööööööööö öööthe second expression to evaluate +F 99 9C 9D 96öööööööööö Öthe remaining expressions to evaluate +F 99 9C 9D 96öööööööööö returnsöthe value of the second expression 99 9D 9E 96öööööööö¿ (progn ݨ...)¿EXECUTE EXPRESSIONS SEQUENTIALLY +F 99 9C 9D 96öööööööööö Öthe expressions to evaluate +F 99 9C 9D 96öööööööööö returnsöthe value of the last expression (or nil) ;7 97 97 97 95 9F 96öööööööö¿ XLISPööööööÖDEBUGGING AND ERROR HANDLINGööö¿]Page 31 97 9C 9C 9C 96öööööööö¿ DEBUGGING AND ERROR HANDLING 99 9D 9E 96öööööööö¿ (error  ݨ)öö¿SIGNAL A NON-CORRECTABLE ERROR +F 99 9C 9D 96öööööööööö the error message string +F 99 9C 9D 96öööööööööö öthe argument expression (printed after the message) +F 99 9C 9D 96öööööööööö returnsönever returns 99 9D 9E 96öööööööö¿ (cerror  ݨ)ÖSIGNAL A CORRECTABLE ERROR +F 99 9C 9D 96öööööööööö ]the continue message string +F 99 9C 9D 96öööööööööö the error message string +F 99 9C 9D 96öööööööööö öthe argument expression (printed after the message) +F 99 9C 9D 96öööööööööö returnsönil when continued from the break loop 99 9D 9E 96öööööööö¿ (break Ý Ý¨¨)¿ENTER A BREAK LOOP +F 99 9C 9D 96öööööööööö the break message string (defaults to "**BREAK**") +F 99 9C 9D 96öööööööööö öthe argument expression (printed after the message) +F 99 9C 9D 96öööööööööö returnsönil when continued from the break loop 99 9D 9E 96öööööööö¿ (clean-up)¿CLEAN-UP AFTER AN ERROR +F 99 9C 9D 96öööööööööö returnsönever returns 99 9D 9E 96öööööööö¿ (top-level)¿CLEAN-UP AFTER AN ERROR AND RETURN TO THE TOP LEVEL +F 99 9C 9D 96öööööööööö returnsönever returns 99 9D 9E 96öööööööö¿ (continue)¿CONTINUE FROM A CORRECTABLE ERROR +F 99 9C 9D 96öööööööööö returnsönever returns 99 9D 9E 96öööööööö¿ (errset  ݨ)¿TRAP ERRORS +F 99 9C 9D 96öööööööööö Öthe expression to execute +F 99 9C 9D 96öööööööööö ]flag to control printing of the error message +F 99 9C 9D 96öööööööööö returnsöthe value of the last expression consed with nil +F 99 9C 9D 96öööööööööööööö¿ or nil on error 99 9D 9E 96öööööööö¿ (baktrace ݨ)¿PRINT N LEVELS OF TRACE BACK INFORMATION +F 99 9C 9D 96öööööööööö ööthe number of levels (defaults to all levels) +F 99 9C 9D 96öööööööööö returnsönil 99 9D 9E 96öööööööö¿ (evalhook  ݨ)¿EVALUATE WITH HOOKS +F 99 9C 9D 96öööööööööö Öthe expression to evaluate +F 99 9C 9D 96öööööööööö öö¿ the value for *evalhook* +F 99 9C 9D 96öööööööööö öö¿]the value for *applyhook* +F 99 9C 9D 96öööööööööö öthe environment (default is nil) +F 99 9C 9D 96öööööööööö returnsöthe result of evaluating the expression ;7 97 97 97 95 9F 96öööööööö¿ XLISPööööööö¿ ARITHMETIC FUNCTIONSöööööÖPage 32 97 9C 9C 9C 96öööööööö¿ (truncate )¿TRUNCATES A FLOATING POINT NUMBER TO AN +F 99 9C 9D 96ööööö¿ INTEGER +F 99 9C 9D 96öööööööööö Öthe number +F 99 9C 9D 96öööööööööö returnsöthe result of truncating the number 99 9D 9E 96öööööööö¿ (float )ö¿CONVERTS AN INTEGER TO A FLOATING POINT NUMBER +F 99 9C 9D 96öööööööööö Öthe number +F 99 9C 9D 96öööööööööö returnsöthe result of floating the integer 99 9D 9E 96öööööööö¿ (+ ...)¿ADD A LIST OF NUMBERS +F 99 9C 9D 96öööööööööö Öthe numbers +F 99 9C 9D 96öööööööööö returnsöthe result of the addition 99 9D 9E 96öööööööö¿ (- ...)¿SUBTRACT A LIST OF NUMBERS OR NEGATE A SINGLE +F 99 9C 9D 96ööööö¿ NUMBER +F 99 9C 9D 96öööööööööö Öthe numbers +F 99 9C 9D 96öööööööööö returnsöthe result of the subtraction 99 9D 9E 96öööööööö¿ (* ...)¿MULTIPLY A LIST OF NUMBERS +F 99 9C 9D 96öööööööööö Öthe numbers +F 99 9C 9D 96öööööööööö returnsöthe result of the multiplication 99 9D 9E 96öööööööö¿ (/ ...)¿DIVIDE A LIST OF NUMBERS +F 99 9C 9D 96öööööööööö Öthe numbers +F 99 9C 9D 96öööööööööö returnsöthe result of the division 99 9D 9E 96öööööööö¿ (1+ )¿ADD ONE TO A NUMBER +F 99 9C 9D 96öööööööööö Öthe number +F 99 9C 9D 96öööööööööö returnsöthe number plus one 99 9D 9E 96öööööööö¿ (1- )¿SUBTRACT ONE FROM A NUMBER +F 99 9C 9D 96öööööööööö Öthe number +F 99 9C 9D 96öööööööööö returnsöthe number minus one 99 9D 9E 96öööööööö¿ (rem ...)¿REMAINDER OF A LIST OF NUMBERS +F 99 9C 9D 96öööööööööö Öthe numbers +F 99 9C 9D 96öööööööööö returnsöthe result of the remainder operation 99 9D 9E 96öööööööö¿ (min ...)¿THE SMALLEST OF A LIST OF NUMBERS +F 99 9C 9D 96öööööööööö Öthe expressions to be checked +F 99 9C 9D 96öööööööööö returnsöthe smallest number in the list 99 9D 9E 96öööööööö¿ (max ...)¿THE LARGEST OF A LIST OF NUMBERS +F 99 9C 9D 96öööööööööö Öthe expressions to be checked +F 99 9C 9D 96öööööööööö returnsöthe largest number in the list 99 9D 9E 96öööööööö¿ (abs )¿THE ABSOLUTE VALUE OF A NUMBER +F 99 9C 9D 96öööööööööö Öthe number +F 99 9C 9D 96öööööööööö returnsöthe absolute value of the number ;7 97 97 97 95 9F 96öööööööö¿ XLISPööööööö¿ ARITHMETIC FUNCTIONSöööööÖPage 33 99 9D 9E 96öööööööö¿ (random )¿COMPUTE A RANDOM NUMBER BETWEEN 1 and N-1 +F 99 9C 9D 96öööööööööö ööthe upper bound (integer) +F 99 9C 9D 96öööööööööö returnsöa random number 99 9D 9E 96öööööööö¿ (sin )¿COMPUTE THE SINE OF A NUMBER +F 99 9C 9D 96öööööööööö Öthe floating point number +F 99 9C 9D 96öööööööööö returnsöthe sine of the number 99 9D 9E 96öööööööö¿ (cos )¿COMPUTE THE COSINE OF A NUMBER +F 99 9C 9D 96öööööööööö Öthe floating point number +F 99 9C 9D 96öööööööööö returnsöthe cosine of the number 99 9D 9E 96öööööööö¿ (tan )¿COMPUTE THE TANGENT OF A NUMBER +F 99 9C 9D 96öööööööööö Öthe floating point number +F 99 9C 9D 96öööööööööö returnsöthe tangent of the number 99 9D 9E 96öööööööö¿ (expt  )¿COMPUTE X TO THE Y POWER +F 99 9C 9D 96öööööööööö öö¿the floating point number +F 99 9C 9D 96öööööööööö öö¿the floating point exponent +F 99 9C 9D 96öööööööööö returnsöx to the y power 99 9D 9E 96öööööööö¿ (exp )ö COMPUTE E TO THE X POWER +F 99 9C 9D 96öööööööööö öö¿the floating point number +F 99 9C 9D 96öööööööööö returnsöe to the x power 99 9D 9E 96öööööööö¿ (sqrt )¿COMPUTE THE SQUARE ROOT OF A NUMBER +F 99 9C 9D 96öööööööööö Öthe floating point number +F 99 9C 9D 96öööööööööö returnsöthe square root of the number ;7 97 97 97 95 9F 96öööööööö¿ XLISPöööööö¿]BITWISE LOGICAL FUNCTIONSööö¿Page 34 97 9C 9C 9C 96öööööööö¿ BITWISE LOGICAL FUNCTIONS 99 9D 9E 96öööööööö¿ (logand ...)¿THE BITWISE AND OF A LIST OF NUMBERS +F 99 9C 9D 96öööööööööö Öthe numbers +F 99 9C 9D 96öööööööööö returnsöthe result of the and operation 99 9D 9E 96öööööööö¿ (logior ...)¿THE BITWISE INCLUSIVE OR OF A LIST OF NUMBERS +F 99 9C 9D 96öööööööööö Öthe numbers +F 99 9C 9D 96öööööööööö returnsöthe result of the inclusive or operation 99 9D 9E 96öööööööö¿ (logxor ...)¿THE BITWISE EXCLUSIVE OR OF A LIST OF NUMBERS +F 99 9C 9D 96öööööööööö Öthe numbers +F 99 9C 9D 96öööööööööö returnsöthe result of the exclusive or operation 99 9D 9E 96öööööööö¿ (lognot )¿THE BITWISE NOT OF A NUMBER +F 99 9C 9D 96öööööööööö Öthe number +F 99 9C 9D 96öööööööööö returnsöthe bitwise inversion of number ;7 97 97 97 95 9F 96öööööööö¿ XLISPööööööö¿ RELATIONAL FUNCTIONSöööööóPage 35 97 9C 9C 9C 96öööööööö¿ RELATIONAL FUNCTIONS 99 9D 9E 96öööööööö¿ The relational functions can be used to compare integers, +F 99 9C 9D 96öööööööö¿ floating point numbers or strings. 99 9D 9E 96öööööööö¿ (<  )¿TEST FOR LESS THAN +F 99 9C 9D 96öööööööööö öÖthe left operand of the comparison +F 99 9C 9D 96öööööööööö öÖthe right operand of the comparison +F 99 9C 9D 96öööööööööö returnsöthe result of comparing  with 99 9D 9E 96öööööööö¿ (<=  )öö TEST FOR LESS THAN OR EQUAL TO +F 99 9C 9D 96öööööööööö öÖthe left operand of the comparison +F 99 9C 9D 96öööööööööö öÖthe right operand of the comparison +F 99 9C 9D 96öööööööööö returnsöthe result of comparing  with 99 9D 9E 96öööööööö¿ (=  )¿TEST FOR EQUAL TO +F 99 9C 9D 96öööööööööö öÖthe left operand of the comparison +F 99 9C 9D 96öööööööööö öÖthe right operand of the comparison +F 99 9C 9D 96öööööööööö returnsöthe result of comparing  with 99 9D 9E 96öööööööö¿ (/=  )TEST FOR NOT EQUAL TO +F 99 9C 9D 96öööööööööö öÖthe left operand of the comparison +F 99 9C 9D 96öööööööööö öÖthe right operand of the comparison +F 99 9C 9D 96öööööööööö returnsöthe result of comparing  with 99 9D 9E 96öööööööö¿ (>=  )öö TEST FOR GREATER THAN OR EQUAL TO +F 99 9C 9D 96öööööööööö öÖthe left operand of the comparison +F 99 9C 9D 96öööööööööö öÖthe right operand of the comparison +F 99 9C 9D 96öööööööööö returnsöthe result of comparing  with 99 9D 9E 96öööööööö¿ (>  )¿TEST FOR GREATER THAN +F 99 9C 9D 96öööööööööö öÖthe left operand of the comparison +F 99 9C 9D 96öööööööööö öÖthe right operand of the comparison +F 99 9C 9D 96öööööööööö returnsöthe result of comparing  with ;7 97 97 97 95 9F 96öööööööö¿ XLISPöööööööö¿]STRING FUNCTIONSööööóPage 36 97 9C 9C 9C 96öööööööö¿ STRING FUNCTIONS 99 9D 9E 96öööööööö¿ (char  )¿EXTRACT A CHARACTER FROM A STRING +F 99 9C 9D 96öööööööööö öö¿]the string +F 99 9C 9D 96öööööööööö the string index (zero relative) +F 99 9C 9D 96öööööööööö returnsöthe ascii code of the character 99 9D 9E 96öööööööö¿ (string )¿MAKE A STRING FROM AN INTEGER ASCII VALUE +F 99 9C 9D 96öööööööööö Öthe integer +F 99 9C 9D 96öööööööööö returnsöa one character string 99 9D 9E 96öööööööö¿ (strcat ݨ...)¿CONCATENATE STRINGS +F 99 9C 9D 96öööööööööö Öthe strings to concatenate +F 99 9C 9D 96öööööööööö returnsöthe result of concatenating the strings 99 9D 9E 96öööööööö¿ (substr  ݨ) EXTRACT A SUBSTRING +F 99 9C 9D 96öööööööööö Öthe string +F 99 9C 9D 96öööööööööö the starting position +F 99 9C 9D 96öööööööööö ]the length (default is rest of string) +F 99 9C 9D 96öööööööööö returnsösubstring starting at for ;7 97 97 97 95 9F 96öööööööö¿ XLISPööööööö¿INPUT/OUTPUT FUNCTIONSöööö¿Page 37 97 9C 9C 9C 96öööööööö¿ INPUT/OUTPUT FUNCTIONS 99 9D 9E 96öööööööö¿ (read Ý Ý Ý¨¨¨)¿READ AN XLISP EXPRESSION +F 99 9C 9D 96öööööööööö öö¿the input source (default is standard input) +F 99 9C 9D 96öööööööööö ö]the value to return on end of file (default is nil) +F 99 9C 9D 96öööööööööö recursive read flag (default is nil) +F 99 9C 9D 96öööööööööö returnsöthe expression read 99 9D 9E 96öööööööö¿ (print  ݨ)¿PRINT A LIST OF VALUES ON A NEW LINE +F 99 9C 9D 96öööööööööö Öthe expressions to be printed +F 99 9C 9D 96öööööööööö ¿the output sink (default is standard output) +F 99 9C 9D 96öööööööööö returnsöthe expression 99 9D 9E 96öööööööö¿ (prin1  ݨ)¿PRINT A LIST OF VALUES +F 99 9C 9D 96öööööööööö Öthe expressions to be printed +F 99 9C 9D 96öööööööööö ¿the output sink (default is standard output) +F 99 9C 9D 96öööööööööö returnsöthe expression 99 9D 9E 96öööööööö¿ (princ  ݨ)¿PRINT A LIST OF VALUES WITHOUT QUOTING +F 99 9C 9D 96öööööööööö Öthe expressions to be printed +F 99 9C 9D 96öööööööööö ¿the output sink (default is standard output) +F 99 9C 9D 96öööööööööö returnsöthe expression 99 9D 9E 96öööööööö¿ (terpri ݨ)¿TERMINATE THE CURRENT PRINT LINE +F 99 9C 9D 96öööööööööö ¿the output sink (default is standard output) +F 99 9C 9D 96öööööööööö returnsönil 99 9D 9E 96öööööööö¿ (flatsize )¿LENGTH OF PRINTED REPRESENTATION USING PRIN1 +F 99 9C 9D 96öööööööööö Öthe expression +F 99 9C 9D 96öööööööööö returnsöthe length 99 9D 9E 96öööööööö¿ (flatc )ö¿LENGTH OF PRINTED REPRESENTATION USING PRINC +F 99 9C 9D 96öööööööööö Öthe expression +F 99 9C 9D 96öööööööööö returnsöthe length ;7 97 97 97 95 9F 96öööööööö¿ XLISPöööööööö]FILE I/O FUNCTIONSöööö¿]Page 38 97 9C 9C 9C 96öööööööö¿ FILE I/O FUNCTIONS 99 9D 9E 96öööööööö¿ (openi )¿OPEN AN INPUT FILE +F 99 9C 9D 96öööööööööö öö¿the file name string or symbol +F 99 9C 9D 96öööööööööö returnsöa file pointer 99 9D 9E 96öööööööö¿ (openo )¿OPEN AN OUTPUT FILE +F 99 9C 9D 96öööööööööö öö¿the file name string or symbol +F 99 9C 9D 96öööööööööö returnsöa file pointer 99 9D 9E 96öööööööö¿ (close )¿CLOSE A FILE +F 99 9C 9D 96öööööööööö ö¿the file pointer +F 99 9C 9D 96öööööööööö returnsönil 99 9D 9E 96öööööööö¿ (read-char ݨ)¿]READ A CHARACTER FROM A FILE OR STREAM +F 99 9C 9D 96öööööööööö öö¿the input source (default is standard input) +F 99 9C 9D 96öööööööööö returnsöthe character (integer) 99 9D 9E 96öööööööö¿ (peek-char Ý Ý¨¨)¿PEEK AT THE NEXT CHARACTER +F 99 9C 9D 96öööööööööö ¿]flag for skipping white space (default is nil) +F 99 9C 9D 96öööööööööö öö¿the input source (default is standard input) +F 99 9C 9D 96öööööööööö returnsöthe character (integer) 99 9D 9E 96öööööööö¿ (write-char  ݨ)¿WRITE A CHARACTER TO A FILE OR STREAM +F 99 9C 9D 96öööööööööö öÖthe character to put (integer) +F 99 9C 9D 96öööööööööö ¿the output sink (default is standard output) +F 99 9C 9D 96öööööööööö returnsöthe character (integer) 99 9D 9E 96öööööööö¿ (read-line ݨ)öREAD A LINE FROM A FILE OR STREAM +F 99 9C 9D 96öööööööööö öö¿the input source (default is standard input) +F 99 9C 9D 96öööööööööö returnsöthe input string ;7 97 97 97 95 9F 96öööööööö¿ XLISPöööööööö¿]SYSTEM FUNCTIONSööööPage 39 97 9C 9C 9C 96öööööööö¿ SYSTEM FUNCTIONS 99 9D 9E 96öööööööö¿ (load  Ý Ý¨¨)¿LOAD AN XLISP SOURCE FILE +F 99 9C 9D 96öööööööööö öö¿the filename string or symbol +F 99 9C 9D 96öööööööööö the verbose flag (default is t) +F 99 9C 9D 96öööööööööö ]the print flag (default is nil) +F 99 9C 9D 96öööööööööö returnsöthe filename 99 9D 9E 96öööööööö¿ (transcript ݨ)¿CREATE A FILE WITH A TRANSCRIPT OF A SESSION +F 99 9C 9D 96öööööööööö öö¿file name string or symbol +F 99 9C 9D 96öööööööööööööö¿ (if missing, close current transcript) +F 99 9C 9D 96öööööööööö returnsöt if the transcript is opened, nil if it is closed 99 9D 9E 96öööööööö¿ (gc)¿FORCE GARBAGE COLLECTION +F 99 9C 9D 96öööööööööö returnsönil 99 9D 9E 96öööööööö¿ (expand )óEXPAND MEMORY BY ADDING SEGMENTS +F 99 9C 9D 96öööööööööö óthe number of segments to add +F 99 9C 9D 96öööööööööö returnsöthe number of segments added 99 9D 9E 96öööööööö¿ (alloc )¿CHANGE NUMBER OF NODES TO ALLOCATE IN EACH +F 99 9C 9D 96ööööö¿ SEGMENT +F 99 9C 9D 96öööööööööö óthe number of nodes to allocate +F 99 9C 9D 96öööööööööö returnsöthe old number of nodes to allocate 99 9D 9E 96öööööööö¿ (mem)¿SHOW MEMORY ALLOCATION STATISTICS +F 99 9C 9D 96öööööööööö returnsönil 99 9D 9E 96öööööööö¿ (type-of )¿RETURNS THE TYPE OF THE EXPRESSION +F 99 9C 9D 96öööööööööö Öthe expression to return the type of +F 99 9C 9D 96öööööööööö returnsönil if the value is nil otherwise one of the symbols: +F 99 9C 9D 96ööööööööööööööö¿:SYMBOL for symbols +F 99 9C 9D 96ööööööööööööööö¿:OBJECT for objects +F 99 9C 9D 96ööööööööööööööö¿:CONSöfor conses +F 99 9C 9D 96ööööööööööööööö¿:SUBRöfor built-ins with evaluated arguments +F 99 9C 9D 96ööööööööööööööö¿:FSUBR¿for built-ins with unevaluated arguments +F 99 9C 9D 96ööööööööööööööö¿:STRING for strings +F 99 9C 9D 96ööööööööööööööö¿:FIXNUM for integers +F 99 9C 9D 96ööööööööööööööö¿:FLONUM for floating point numbers +F 99 9C 9D 96ööööööööööööööö¿:FILEöfor file pointers +F 99 9C 9D 96ööööööööööööööö¿:ARRAY¿for arrays 99 9D 9E 96öööööööö¿ (peek )öPEEK AT A LOCATION IN MEMORY +F 99 9C 9D 96öööööööööö the address to peek at (integer) +F 99 9C 9D 96öööööööööö returnsöthe value at the specified address (integer) 99 9D 9E 96öööööööö¿ (poke  )öö POKE A VALUE INTO MEMORY +F 99 9C 9D 96öööööööööö the address to poke (integer) +F 99 9C 9D 96öööööööööö the value to poke into the address (integer) +F 99 9C 9D 96öööööööööö returnsöthe value ;7 97 97 97 95 9F 96öööööööö¿ XLISPöööööööö¿]SYSTEM FUNCTIONSööööPage 40 99 9D 9E 96öööööööö¿ (address-of )¿GET THE ADDRESS OF AN XLISP NODE +F 99 9C 9D 96öööööööööö Öthe node +F 99 9C 9D 96öööööööööö returnsöthe address of the node (integer) 99 9D 9E 96öööööööö¿ (exit)ÖEXIT XLISP +F 99 9C 9D 96öööööööööö returnsönever returns ;7 97 97 97 95 9F 96öööööööö¿ XLISPöööööööööö]EXAMPLESööööööööPage 41 97 9C 9C 9C 96öööööööö¿ FILE I/O FUNCTIONS 99 9D 9E 96öööööööö¿ Input from a File 99 9D 9E 96öööööööö¿ XLISP provides two functions for opening files.¿To open a file +F 99 9C 9D 96öööööööö¿ for input, use the OPENI function.¿To open a file for output, +F 99 9C 9D 96öööööööö¿ use the OPENO function.¿Both of these functions take a single +F 99 9C 9D 96öööööööö¿ argument which is the name of the file to be opened.¿This name +F 99 9C 9D 96öööööööö¿ can be in the form of a string or a symbol.¿Both open functions +F 99 9C 9D 96öööööööö¿ return an object of type :FILE as their result if they succeed +F 99 9C 9D 96öööööööö¿ in opening the specified file.ö¿]They return the value NIL if +F 99 9C 9D 96öööööööö¿ they are not successful.¿In order to manipulate the file, it is +F 99 9C 9D 96öööööööö¿ necessary to save the value returned by the open function.¿This +F 99 9C 9D 96öööööööö¿ is usually done by assigning it to a variable with the SETQ +F 99 9C 9D 96öööööööö¿ special form or by binding it using LET or LET*.¿Here is an +F 99 9C 9D 96öööööööö¿ example: 99 9D 9E 96öööööööööö (setq fp (openi "init.lsp")) 99 9D 9E 96öööööööö¿ Evaluating this expression will result in the file "init.lsp" +F 99 9C 9D 96öööööööö¿ being opened.¿The file object that will be returned by the +F 99 9C 9D 96öööööööö¿ OPENI function will be assigned to the variable "fp". 99 9D 9E 96öööööööö¿ It is now possible to use the file for input.¿To read an +F 99 9C 9D 96öööööööö¿ expression from the file, just supply the value of the "fp" +F 99 9C 9D 96öööööööö¿ variable as the optional "stream" argument to READ. 99 9D 9E 96öööööööööö (read fp) 99 9D 9E 96öööööööö¿ Evaluating this expression will result in reading the first +F 99 9C 9D 96öööööööö¿ expression from the file "init.lsp".¿The expression will be +F 99 9C 9D 96öööööööö¿ returned as the result of the READ function.¿More expressions +F 99 9C 9D 96öööööööö¿ can be read from the file using further calls to the READ +F 99 9C 9D 96öööööööö¿ function.¿When there are no more expressions to read, the READ +F 99 9C 9D 96öööööööö¿ function will return NIL (or whatever value was supplied as the +F 99 9C 9D 96öööööööö¿ second argument to READ). 99 9D 9E 96öööööööö¿ Once you are done reading from the file, you should close it. +F 99 9C 9D 96öööööööö¿ To close the file, use the following expression: 99 9D 9E 96öööööööööö (close fp) 99 9D 9E 96öööööööö¿ Evaluating this expression will cause the file to be closed. ;7 97 97 97 95 9F 96öööööööö¿ XLISPöööööööööö]EXAMPLESööööööööPage 42 97 9C 9C 9C 96öööööööö¿ Output to a File 99 9D 9E 96öööööööö¿ Writing to a file is pretty much the same as reading from one. +F 99 9C 9D 96öööööööö¿ You need to open the file first.¿This time you should use the +F 99 9C 9D 96öööööööö¿ OPENO function to indicate that you will do output to the file. +F 99 9C 9D 96öööööööö¿ For example: 99 9D 9E 96öööööööööö (setq fp (openo "test.dat")) 99 9D 9E 96öööööööö¿ Evaluating this expression will open the file "test.dat" for +F 99 9C 9D 96öööööööö¿ output.¿If the file already exists, its current contents will +F 99 9C 9D 96öööööööö¿ be discarded.¿If it doesn't already exist, it will be created. +F 99 9C 9D 96öööööööö¿ In any case, a :FILE object will be returned by the OPENO +F 99 9C 9D 96öööööööö¿ function.¿This file object will be assigned to the "fp" +F 99 9C 9D 96öööööööö¿ variable. 99 9D 9E 96öööööööö¿ It is now possible to write to this file by supplying the value +F 99 9C 9D 96öööööööö¿ of the "fp" variable as the optional "stream" parameter in the +F 99 9C 9D 96öööööööö¿ PRINT function. 99 9D 9E 96öööööööööö (print "Hello there" fp) 99 9D 9E 96öööööööö¿ Evaluating this expression will result in the string "Hello +F 99 9C 9D 96öööööööö¿ there" being written to the file "test.dat".¿More data can be +F 99 9C 9D 96öööööööö¿ written to the file using a similar technique. 99 9D 9E 96öööööööö¿ Once you are done writing to the file, you should close it. +F 99 9C 9D 96öööööööö¿ Closing an output file is just like closing an input file. 99 9D 9E 96öööööööööö (close fp) 99 9D 9E 96öööööööö¿ Evaluating this expression will close the output file and make +F 99 9C 9D 96öööööööö¿ it permanent. ;7 97 97 97 95 9F 96öööööööö¿ XLISPöööööööööö]EXAMPLESööööööööPage 43 97 9C 9C 9C 96öööööööö¿ A Slightly More Complicated File Example 99 9D 9E 96öööööööö¿ This example shows how to open a file, read each Lisp expression +F 99 9C 9D 96öööööööö¿ from the file and print it.¿It demonstrates the use of files +F 99 9C 9D 96öööööööö¿ and the use of the optional "stream" argument to the READ +F 99 9C 9D 96öööööööö¿ function. 99 9D 9E 96öööööööööö (do* ((fp (openi "test.dat")) +F 99 9C 9D 96öööööööööööö¿(ex (read fp) (read fp))) +F 99 9C 9D 96öööööööööööö ((null ex) nil) +F 99 9C 9D 96ööööööööööö(print ex))