next up previous
Contents Next: rest (FUNCTION) Up: Appendix: Selected Lisp Previous: or (FUNCTION)


Format: (read <instream> <eof-error> <eof-value> <recursive> )

Required arguments: none

Optional arguments: 4

<instream> : an expression which returns an input stream <eof-error> : any Lisp expression <eof-value> : any Lisp expression <recursive> : any Lisp expression

Called with no arguments, read waits for input from the standard input (usually the keyboard) and returns a Lisp object. If <instream> is specified, input is taken from the stream rather than standard input. If <eof-error> is specified it controls what happens if an end of file is encountered in the middle of a ``read.'' If <eof-error> is nil, no error results, and the result of <eof-value> is returned by ``read.'' If <eof-error> is not NIL, then encountering the end of a file during a read will cause an error to occur. <recursive> controls the kind of error that is signalled when an end of file is encountered. If <recursive> is specified and is not NIL, then the end of file is reported to have occurred in the middle of reading in an object. If it is NIL, the the end of file is reported as occurring between objects.

Examples: See chapter 5.

© Colin Allen & Maneesh Dhagat
March 2007