Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference

# Table of Contents

1. Manuals

- XLISP 2.0 Manual - by David Betz
- XLISP Object System - by David Betz
- XLISP Profiling - by Roger B. Dannenberg

2. Reference

- Symbols
- Functions

- Evaluation
- Symbol Functions
- Arrays
- Lists
- Predicates
- Control Constructs
- Debugging and Error Handling
- Numbers
- Strings
- Characters
- Input/Output
- File I/O
- String Streams
- System

## XLISP 2.0 Manual

- XLISP 2.0 Manual

1. Introduction
2. A Note From The Author
3. Command Loop
4. Break Loop
5. Data Types
6. The Evaluator
7. Lexical Conventions
8. Readtable

- Read Table Entries

- :constituent - indicating a symbol constituent
- :white-space - indicating a whitespace character
- :tmacro - terminating readmacro
- :nmacro - terminating non-readmacro
- :sescape - single escape character '\'
- :mescape - multiple escape character '|'

- Read Macros

- ' - read macro for quote
- #' - read macro for function
- #() - read macro for arrays
- #x - read macro for hexadecimal numbers
- #o - read macro for octal numbers
- #b - read macro for binary numbers
- #\ - read macro for character values
- #|...|# - read macro for comments
- #: - read macro for uninterned symbols
- ` - read macro for backquote
- , - read macro for comma
- ,@ - read macro for comma-at

- Characters Names

- #\Tab - a 'horizontal tab' character
- #\Newline - a 'newline' character
- #\Space - a 'space' character

9. Lambda Lists

- Arguments

- Required Arguments
- Optional Arguments
- Rest Arguments
- Keyword Arguments
- Auxiliary Variables

- Lambda List Syntax

Back to top

## XLISP Object System

- XLISP Object System

- Definitions

- selector - a symbol used to select an appropriate method
- message - a selector and a list of actual arguments
- method - the code that implements a message
- object - the top of the class hierarchy
- class - the class of all object classes

- The 'send' Function
- The 'self' Symbol
- The 'send-super' Function
- The 'Object' Class

- object - the top of the class hierarchy

- :show - show an object's instance variables
- :class - return the class of an object
- :isnew - the default object initialization routine
- send-super - send superclass a message

- The 'Class' Class

- class - class of all object classes

- :new - create a new instance of a class
- :isnew - initialize a new class
- :answer - add a message to a class

Back to top

## Symbols

- self - the current object within a method context
- *obarray* - the object hash table
- *standard-input* - the standard input stream
- *standard-output* - the standard output stream
- *error-output* - the error output stream
- *trace-output* - the trace output stream
- *debug-io* - the debug i/o stream
- *breakenable* - flag controlling entering break loop on errors
- *tracelist* - list of names of functions to trace
- *tracenable* - enable trace back printout on errors
- *tracelimit* - number of levels of trace back information
- *evalhook* - user substitute for the evaluator function
- *applyhook* - [not yet implemented]
- *readtable* - the current readtable
- *unbound* - indicator for unbound symbols
- *gc-flag* - controls the printing of 'gc' messages
- *gc-hook* - function to call after garbage collection
- *integer-format* - format for printing integers
- *float-format* - format for printing floats
- *print-case* - symbol output case
- *file-separator* - the operating system's file sparator character

- + - the most recent input expression
- ++ - the next to the last input expression
- +++ - the second to the last input expression
- * - the result of the previously evaluated expression
- ** - the result of the next to the last evaluated expression
- *** - the result of the second to the last evaluated expression
- - - the expression currently being evaluated

Back to top

## Evaluation Functions

- eval - evaluate an XLISP expression
- apply - apply a function to a list of arguments
- funcall - call a function with arguments
- quote - return an expression unevaluated
- function - get the functional interpretation
- backquote - fill in a template
- lambda - make a function closure
- get-lambda-expression - get the lambda expression
- macroexpand - recursively expand macro calls
- macroexpand-1 - expand a macro call

Back to top

## Symbol Functions

- Constructors

- defun - define a function
- defmacro - define a macro
- gensym - generate a symbol
- intern - make an interned symbol
- make-symbol - make an uninterned symbol

- Accessors

- symbol-name - get the print name of a symbol
- symbol-value - get the value of a symbol
- symbol-function - get the functional value of a symbol
- symbol-plist - get the property list of a symbol

- Assignment

- set - set the value of a symbol
- setq - set the [quoted] value of a symbol
- psetq - parallel version of setq
- setf - set the value of a field

- Utilities

- incf - increment a variable
- decf - decrement a variable

Back to top

## Array Functions

- Constructors

- make-array - make a new array
- vector - make an initialized vector

- Acessors

- aref - get the nth element of an array

- Predicate

- arrayp - is this an array?

- Utilities

- length - find the length of a list, vector or string
- hash - compute the hash index for a symbol

Back to top

## List Functions

- Constructors

- cons - construct a new list node
- list - create a list of values

- Accessors

- car - return the car of a list node
- caar, cadr -
- caaar...caddr -
- caaaar...cadddr -
- cdr - return the cdr of a list node
- cdar, cddr -
- cdaar...cdddr -
- cdaaar...cddddr -
- first - get the first element of a list
- second - get the second element of a list
- third - get the third element of a list
- fourth - get the fourth element of a list
- rest - get the rest of the list except the first element
- last - return the last list node of a list
- nth - return the nth element of a list
- nthcdr - return the nth cdr of a list

- Predicates

- consp - is this a non-empty list?
- listp - is this an empty or non-empty list?
- null - is this an empty list?

- List Functions

- append - append lists
- reverse - reverse a list
- member - find an expression in a list
- length - find the length of a list, vector or string
- subst - substitute expressions

- Association Lists

- assoc - find an expression in an a-list
- sublis - substitute with an a-list

- Property Lists

- get - get the value of a property
- putprop - put a property onto a property list
- remprop - remove a property from a property list

- Mapping

- mapc - apply function to successive cars
- mapcar - apply function to successive cars
- mapl - apply function to successive cdrs
- maplist - apply function to successive cdrs

- Lists as Stack

- push - push a value to the front of a list
- pop - pop a value from the front of a list

- Lists as Sets

- union - compute the union of two lists
- intersection - compute the intersection of two lists
- set-difference - compute the set-difference of two lists
- subsetp - test if a list is a subset of another list

- Non-destructive List Functions

- remove - remove elements from a list
- remove-if - remove elements that pass test
- remove-if-not - remove elements that fail test

- Destructive List Functions

- rplaca - replace the car of a list node
- rplacd - replace the cdr of a list node
- nconc - destructively concatenate lists
- delete - delete elements from a list
- delete-if - delete elements that pass test
- delete-if-not - delete elements that fail test
- sort - sort a list

Back to top

## Predicate Functions

- Predicates

- atom - is this an atom?
- symbolp - is this a symbol?

- boundp - is a variable value bound to this symbol?
- fboundp - is a function value bound to this symbol?

- keywordp - is this a keyword?
- numberp - is this a number?

- plusp - is this number positive?
- minusp - is this number negative?
- zerop - is this number zero?
- integerp - is this number an integer?

- evenp - is this integer even?
- oddp - is this integer odd?

- floatp - is this number a float?

- null - is this an empty list?
- consp - is this a non-empty list?
- listp - is this a list?

- endp - is this the end of a list?

- stringp - is this a string?
- characterp - is this a character?

- upper-case-p - is this an upper case character?
- lower-case-p - is this a lower case character?
- both-case-p - is this an alphabetic [either case] character?
- digit-char-p - is this a digit character?
- alphanumericp - is this an alphabetic or a digit character?

- arrayp - is this an array?
- streamp - is this a stream?
- filep - is this a file?
- objectp - is this an object?
- soundp - is this a Nyquist sound?
- bigendianp - is this a bigendian machine?

- Comparison

- eq - are the expressions identical?
- eql - are the expressions identical?
- equal - are the expressions equal?

- Boolean

- not - is this false?

Back to top

## Control Constructs

- Logical

- and - the logical AND of a list of expressions
- or - the logical OR of a list of expressions

- Conditional

- if - evaluate expressions conditionally
- when - evaluate only when a condition is true
- unless - evaluate only when a condition is false
- cond - evaluate conditionally
- case - select by case

- Binding

- let - create local bindings
- let* - let with sequential binding
- flet - create local functions
- labels - flet with recursive functions
- macrolet - create local macros

- Non-local Exits

- catch, throw - evaluate expressions and catch throws
- unwind-protect - protect evaluation of an expression

- Looping Constructs

- loop - basic looping form
- do - loop while the termination test is NIL
- do* - 'do' loop with sequential binding
- dolist - loop through a list
- dotimes - loop from zero to n-1
- while - standard 'while' loop

- The Program Feature

- prog - the program feature
- prog* - 'prog' with sequential binding
- block - named block
- return - cause a prog construct to return a value
- return-from - return from a named block
- tagbody - block with labels
- go - go to a tag within a tagbody or prog
- progv - dynamically bind symbols
- prog1 - return the value of the first expression
- prog2 - return the value of the second expression
- progn - return the value of the last expression

Back to top

## Debugging and Error Handling

- trace - add a function to the trace list
- untrace - remove a function from the trace list
- error - signal a non-correctable error
- cerror - signal a correctable error
- break - enter a break loop
- clean-up - clean-up after an error
- top-level - clean-up after an error and return to the top level
- continue - continue from a correctable error
- errset - trap errors
- baktrace - print n levels of trace back information
- evalhook - evaluate with hooks
- profile - turn profiling on or off

Back to top

## Arithmetic Functions

- Integer and Floating Point - error if not a number

- truncate - truncates a floating point number to an integer
- float - converts an integer to a floating point number
- + - add one or several numbers
- − - negate a single number or subtract one or several numbers
- * - multiply one or several numbers
- / - get the reciprocal of a single number or divide several numbers
- 1+ - increment a number by one
- 1− - decrement a number by one
- min - the smallest of one or several numbers
- max - the largest of one or several numbers
- abs - the absolute value of a number
- asin - compute the arcsine of a number
- acos - compute the arccosine of a number
- atan - compute the arctangent of a number
- power - compute 'x' to the 'y' power
- interpolate - compute the 'y' coordinate corresponding to 'x'

- Comparison - error if not a number

- < - test for less than
- <= - test for less than or equal to
- = - test for equal to
- /= - test for not equal to
- >= - test for greater than or equal to
- > - test for greater than

- Floating Point - error if not a floating point number

- sin - compute the sine of a floating-point number
- cos - compute the cosine of a floating-point number
- tan - compute the tangent of a floating-point number
- expt - compute x to the y power
- exp - compute e to the x power
- exp - compute the natural logarithm of a floating-point number
- sqrt - compute the square root of a floating-point number

- Integer - error if not an integer number

- gcd - compute the greatest common divisor
- logand - compute the bitwise 'and' of one or several numbers
- logior - compute the bitwise 'inclusive or' of one or several numbers
- logxor - compute the bitwise 'exclusive or' of one or several numbers
- lognot - compute the bitwise 'not' of an number
- rem - remainder of one or several integer numbers

- Random Numbers

- random - compute an integer random number between 0 and n-1 inclusive
- rrandom - compute a floating point random number between 0 and 1 inclusive
- real-random - compute a floating point random number in an arbitrary range

Back to top

## String Functions

- String Functions

- string - make a string from a character or an integer ASCII value
- strcat - concatenate strings
- subseq - extract a substring
- length - find the length of a list, vector or string
- string-search - search for a pattern in a string

- Trimming

- string-trim - trim both ends of a string
- string-left-trim - trim the left end of a string
- string-right-trim - trim the right end of a string

- Case Conversion

- string-upcase - convert a string to uppercase
- string-downcase - convert a string to lowercase
- nstring-upcase - convert a part of a string to uppercase
- nstring-downcase - convert a part of a string to lowercase

- Case-sensitive Comparison

- string< - test for less than in ASCII ordering
- string<= - test for less than or equal to in ASCII ordering
- string= - test for equal to in ASCII ordering
- string/= - test for not equal to in ASCII ordering
- string>= - test for greater than or equal to in ASCII ordering
- string> - test for greater than in ASCII ordering

- Case-insensitive Comparison

- string-lessp - is this less than in ASCII ordering?
- string-not-greaterp - is this not greater than in ASCII ordering?
- string-equal - is this equal in ASCII ordering?
- string-not-equal - is this not equal in ASCII ordering?
- string-not-lessp - is this not less than in ASCII ordering?
- string-greaterp - is this greater than in ASCII ordering?

Back to top

## Character Functions

- Character Functions

- char - extract a character from a string
- char-code - get the ASCII code of a character
- code-char - get the character with a specified ASCII code
- digit-char - convert a digit weight to a digit
- char-int - convert a character to an integer
- int-char - convert an integer to a character

- General Predicate - all data types

- characterp - is this a character?

- Character Predicates - error if not a character

- upper-case-p - is this an upper case character?
- lower-case-p - is this a lower case character?
- both-case-p - is this an alphabetic [either case] character?
- digit-char-p - is this a digit character?
- alphanumericp - is this an alphabetic or a digit character?

- Case Conversion

- char-upcase - convert a character to upper case
- char-downcase - convert a character to lower case

- Case-sensitive Comparison

- char< - test for less than in ASCII ordering
- char<= - test for less than or equal to in ASCII ordering
- char= - test for equal to in ASCII ordering
- char/= - test for not equal to in ASCII ordering
- char>= - test for greater than or equal to in ASCII ordering
- char> - test for greater than in ASCII ordering

- Case-insensitive Comparison

- char-lessp - is this less than in ASCII ordering?
- char-not-greaterp - is this not greater than in ASCII ordering?
- char-equal - is this equal in ASCII ordering?
- char-not-equal - is this not equal in ASCII ordering?
- char-not-lessp - is this not less than in ASCII ordering?
- char-greaterp - is this greater than in ASCII ordering?

Back to top

## Input/Output Functions

- get-key - get a single key stroke from the keyboard
- read - read an expression
- print - print an expression on a new line
- prin1 - print an expression
- princ - print an expression without quoting
- pprint - pretty print an expression
- terpri - terminate the current print line
- flatsize - length of printed representation using prin1
- flatc - length of printed representation using princ
- format - do formated output

Back to top

## File I/O Functions

- Character I/O

- open - open a character file stream
- peek-char - peek at the next character
- read-char - read a character from a stream
- read-line - read a line from a stream
- write-char - write a character to a stream

- Binary I/O

- bigendianp - is this a bigendian machine?
- open-binary - open a binary file stream
- Bytes

- read-byte - read a byte from a stream
- write-byte - write a byte to a stream

- Integer Numbers

- read-int - read a binary integer number from a stream
- write-int - write a binary integer number to a stream

- Floating Point Numbers

- read-float - read a binary floating point number from a stream
- write-float - write a binary floating point number to a stream

- Character and Bibary I/O

- close - close a file stream

- Operating System

- setdir - set the current directory
- listdir - get a directory listing
- get-temp-path - get a path where a temporary file can be created
- get-user - get the current user name
- find-in-xlisp-path - search the XLISP path for a filename

Back to top

## String Stream Functions

- make-string-input-stream - create an unnamed stream from a string expression
- make-string-output-stream - create and return an unnamed output stream
- get-output-stream-string - empty a stream and return the data as a string
- get-output-stream-list - empty a stream and return the data as a list

Back to top

## System Functions

- load - load a source file
- save - save workspace to a file
- restore - restore workspace from a file
- dribble - create a file with a transcript of a session
- gc - force garbage collection
- expand - expand memory by adding segments
- alloc - change number of nodes to allocate in each segment
- info - show information about memory usage
- room - show memory allocation statistics
- type-of - returns the type of the expression
- peek - peek at a location in memory
- poke - poke a value into memory
- bigendianp - is this a big-endian machine?
- address-of - get the address of an xlisp node
- get-env - get the value of an environment variable
- system - execute a command of the operating system
- quit - exit XLISP
- exit - exit XLISP
- setup-console - set default console attributes
- echoenabled - turn console input echo on or off

Back to top

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference