This section describes the Lisp functions and variables that pertain to reading.
In the functions below, stream stands for an input stream (see
the previous section). If stream is nil
or omitted, it
defaults to the value of standard-input
.
An end-of-file
error is signaled if reading encounters an
unterminated list, vector, or string.
If start is supplied, then reading begins at index start in the string (where the first character is at index 0). If you specify end, then reading is forced to stop just before that index, as if the rest of the string were not there.
For example:
(read-from-string "(setq x 55) (setq y 5)") => ((setq x 55) . 11) (read-from-string "\"A short string\"") => ("A short string" . 16) ;; Read starting at the first character. (read-from-string "(list 112)" 0) => ((list 112) . 10) ;; Read starting at the second character. (read-from-string "(list 112)" 1) => (list . 5) ;; Read starting at the seventh character, ;; and stopping at the ninth. (read-from-string "(list 112)" 6 8) => (11 . 8)
read
uses when the stream argument is nil
.
Go to the first, previous, next, last section, table of contents.