The read-number Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The read-number Reference Manual

This is the read-number Reference Manual, version 20160821.629, generated automatically by Declt version 2.3 "Robert April" on Wed Mar 14 04:31:19 2018 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

read-number

Reading numbers from an input stream without using the Lisp reader.

Functions

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.

Features

Commentary

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.


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 read-number

Author

Ralph Schleicher <rs@ralph-schleicher.de>

License

Modified BSD License

Description

Definitions for reading numbers from an input stream.

Version

20160821.629

Dependencies
Source

read-number.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 read-number.asd

Location

read-number.asd

Systems

read-number (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.2 read-number/package.lisp

Parent

read-number (system)

Location

package.lisp

Packages

read-number


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.3 read-number/common.lisp

Dependency

package.lisp (file)

Parent

read-number (system)

Location

common.lisp

Internal Definitions

Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.4 read-number/read-integer.lisp

Dependency

common.lisp (file)

Parent

read-number (system)

Location

read-integer.lisp

Exported Definitions

read-integer (function)


Previous: , Up: Lisp files   [Contents][Index]

3.1.5 read-number/read-float.lisp

Dependency

read-integer.lisp (file)

Parent

read-number (system)

Location

read-float.lisp

Exported Definitions

read-float (function)


Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 read-number

Definitions for reading numbers from an input stream.

Source

package.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Functions

Function: 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 first argument INPUT-STREAM is an input stream designator. The default is standard input.
Optional second argument EOF-ERROR-P is a generalized boolean.
If an end of file error occurs and EOF-ERROR-P is false, EOF-VALUE is returned. Otherwise, signal an ‘end-of-file’ error. The default is true.
Optional third argument EOF-VALUE is an object. See above for more details. The default is nil.
Optional fourth argument RECURSIVE-P is a generalized boolean. True means that this call is expected to be embedded in a higher-level call to ‘read’ or a similar function used by the Lisp reader. The default is false.
Keyword argument UNSIGNED-NUMBER is a generalized boolean. True means to read an unsigned positive number. If UNSIGNED-NUMBER is ‘:plus’, an explicit plus sign character signals a ‘parse-error’ but negative numbers are permitted. The default is false.
Keyword argument PLUS-SIGN is a sequence of valid plus sign characters. The plus sign is used to denote a positive number. The default is ‘+’.
Keyword argument MINUS-SIGN is a sequence of valid minus sign characters. The minus sign is used to denote a negative number. The default is ‘-’.
Keyword argument DECIMAL-POINT is a sequence of valid decimal point characters. The decimal point is used to separate the integer part of a decimal number from its fractional part. The default is ‘.’. Keyword argument EXPONENT-MARKER is a sequence of valid exponent marker characters. The exponent marker is used to separate the mantissa from the exponent. It does not specify the data type of the return value. The default is ‘E’, ‘e’, ‘D’, and ‘d’.
Keyword argument FLOAT-FORMAT specifies the data type of the return value. The default is ‘*read-default-float-format*’.

Return value is a floating-point number of type FLOAT-FORMAT iff a decimal point or exponent part is present. Otherwise, value is an integer.

The ‘read-float’ function expects an optional sign followed by a non-empty sequence of decimal digits. It does recognize a decimal point and an exponent part. Leading or trailing whitespace is not ignored.

If the file ends in the middle of a floating-point number representation, ‘read-float’ signals an ‘end-of-file’ error regardsless of the value of the EOF-ERROR-P argument.

Converting a floating-point number to the specified FLOAT-FORMAT type may signal an ‘arithmetic-error’ condition, for example, a ‘floating-point-overflow’ or ‘floating-point-underflow’ error.

The result if undefined if the sequences of valid plus and minus sign characters intersect.

Package

read-number

Source

read-float.lisp (file)

Function: 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.

Optional first argument INPUT-STREAM is an input stream designator. The default is standard input.
Optional second argument EOF-ERROR-P is a generalized boolean.
If an end of file error occurs and EOF-ERROR-P is false, EOF-VALUE is returned. Otherwise, signal an ‘end-of-file’ error. The default is true.
Optional third argument EOF-VALUE is an object. See above for more details. The default is nil.
Optional fourth argument RECURSIVE-P is a generalized boolean. True means that this call is expected to be embedded in a higher-level call to ‘read’ or a similar function used by the Lisp reader. The default is false.
Keyword argument UNSIGNED-NUMBER is a generalized boolean. True means to read an unsigned positive number. If UNSIGNED-NUMBER is ‘:plus’, an explicit plus sign character signals a ‘parse-error’ but negative numbers are permitted. The default is false.
Keyword argument PLUS-SIGN is a sequence of valid plus sign characters. The plus sign is used to denote a positive number. The default is ‘+’.
Keyword argument MINUS-SIGN is a sequence of valid minus sign characters. The minus sign is used to denote a negative number. The default is ‘-’.
Keyword argument RADIX is a radix. Value has to be an integer between 2 and 36, inclusive. The default is 10. Case is not significant for the digit characters ‘A’ to ‘Z’ when parsing numbers with a radix greater than 10.

Return value is an integer.

The ‘read-integer’ function expects an optional sign followed by a non-empty sequence of digits in the specified radix. It does not recognize a decimal point or exponent marker. Leading or trailing whitespace is not ignored.

If the file ends in the middle of an integer representation, ‘read-integer’ signals an ‘end-of-file’ error regardsless of
the value of the EOF-ERROR-P argument.

The result if undefined if the sequences of valid plus and minus sign characters intersect.

Package

read-number

Source

read-integer.lisp (file)


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Special variables

Special Variable: *default-decimal-point*

Sequence of valid decimal point characters.

Package

read-number

Source

common.lisp (file)

Special Variable: *default-exponent-marker*

Sequence of valid exponent marker characters.

Package

read-number

Source

common.lisp (file)

Special Variable: *default-minus-sign*

Sequence of valid minus sign characters.

Package

read-number

Source

common.lisp (file)

Special Variable: *default-plus-sign*

Sequence of valid plus sign characters.

Package

read-number

Source

common.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Macros

Macro: with-input-from (INPUT-STREAM EOF-ERROR-P EOF-VALUE RECURSIVE-P) (BINDINGS RESULT) &body BODY

Framework for reading numbers.

Package

read-number

Source

common.lisp (file)


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.3 Functions

Function: sequence-of-characters-p OBJECT

Return true if OBJECT is a sequence of characters. If OBJECT is an empty sequence, value is true, too.

Package

read-number

Source

common.lisp (file)

Function: standard-digit-char-p CHAR &optional RADIX

Return true if CHAR is a standard digit character.

First argument CHAR has to be a character object.
Optional second argument RADIX is an integer between 2 and 36, inclusive. Default is 10.

Return value is the weight of CHAR as an integer, or nil.

Package

read-number

Source

common.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.4 Types

Type: sequence-of-characters ()

Type specifier for a sequence of characters.

Package

read-number

Source

common.lisp (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   F   L   R  
Index Entry  Section

F
File, Lisp, read-number.asd: The read-number<dot>asd file
File, Lisp, read-number/common.lisp: The read-number/common<dot>lisp file
File, Lisp, read-number/package.lisp: The read-number/package<dot>lisp file
File, Lisp, read-number/read-float.lisp: The read-number/read-float<dot>lisp file
File, Lisp, read-number/read-integer.lisp: The read-number/read-integer<dot>lisp file

L
Lisp File, read-number.asd: The read-number<dot>asd file
Lisp File, read-number/common.lisp: The read-number/common<dot>lisp file
Lisp File, read-number/package.lisp: The read-number/package<dot>lisp file
Lisp File, read-number/read-float.lisp: The read-number/read-float<dot>lisp file
Lisp File, read-number/read-integer.lisp: The read-number/read-integer<dot>lisp file

R
read-number.asd: The read-number<dot>asd file
read-number/common.lisp: The read-number/common<dot>lisp file
read-number/package.lisp: The read-number/package<dot>lisp file
read-number/read-float.lisp: The read-number/read-float<dot>lisp file
read-number/read-integer.lisp: The read-number/read-integer<dot>lisp file

Jump to:   F   L   R  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   F   M   R   S   W  
Index Entry  Section

F
Function, read-float: Exported functions
Function, read-integer: Exported functions
Function, sequence-of-characters-p: Internal functions
Function, standard-digit-char-p: Internal functions

M
Macro, with-input-from: Internal macros

R
read-float: Exported functions
read-integer: Exported functions

S
sequence-of-characters-p: Internal functions
standard-digit-char-p: Internal functions

W
with-input-from: Internal macros

Jump to:   F   M   R   S   W  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *  
S  
Index Entry  Section

*
*default-decimal-point*: Internal special variables
*default-exponent-marker*: Internal special variables
*default-minus-sign*: Internal special variables
*default-plus-sign*: Internal special variables

S
Special Variable, *default-decimal-point*: Internal special variables
Special Variable, *default-exponent-marker*: Internal special variables
Special Variable, *default-minus-sign*: Internal special variables
Special Variable, *default-plus-sign*: Internal special variables

Jump to:   *  
S  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   P   R   S   T  
Index Entry  Section

P
Package, read-number: The read-number package

R
read-number: The read-number system
read-number: The read-number package

S
sequence-of-characters: Internal types
System, read-number: The read-number system

T
Type, sequence-of-characters: Internal types

Jump to:   P   R   S   T