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