https://github.com/ralph-schleicher/read-number.git
git clone 'https://github.com/ralph-schleicher/read-number.git'
(ql:quickload :read-number)
Reading numbers from an input stream without using the Lisp reader.
read-integer (&optional input-stream eof-error-p eof-value recursive-p &key unsigned-number plus-sign minus-sign radix)
Read an integer from an input stream.
read-float (&optional input-stream eof-error-p eof-value recursive-p &key unsigned-number plus-sign minus-sign decimal-point exponent-marker float-format)
Read a floating-point number from an input stream.
Optional arguments input-stream, eof-error-p, eof-value, and
recursive-p behave similar to read
.
Keyword argument unsigned-number controls the sign conventions; plus or minus sign, minus sign only (no explicit plus sign), or unsigned.
Keyword arguments plus-sign, minus-sign, decimal-point, and exponent-marker denote character sets.
Leading and trailing whitespace is not ignored.
Compatible with with-input-from-string
.
The read-integer
and read-float
functions are designed to read
external number representations. The read-number
function (to be
defined) is reserved for reading any Lisp number representation.
The functions provided by read-number are different to parse-number and parse-float because they read characters sequentially from a stream instead of parsing a string directly.