ToC DocOverview CGDoc RelNotes Index PermutedIndex
Allegro CL
Home Previous Up Next Table of Contents Index
  ANSI Common Lisp   23 Reader   23.2 Dictionary of Reader

23.2.13 *read-base* Variable

Value Type:
a radix.

Initial Value:
10.

Description:
Controls the interpretation of tokens by read as being integers or ratios.

The value of *read-base*, called the current input base, is the radix in which integers and ratios are to be read by the Lisp reader. The parsing of other numeric types (e.g., floats) is not affected by this option.

The effect of *read-base* on the reading of any particular rational number can be locally overridden by explicit use of the #O, #X, #B, or #nR syntax or by a trailing decimal point.

Examples:
 (dotimes (i 6)
   (let ((*read-base* (+ 10. i)))
     (let ((object (read-from-string "(\\DAD DAD |BEE| BEE 123. 123)")))
       (print (list *read-base* object)))))
(10 (DAD DAD BEE BEE 123 123))
(11 (DAD DAD BEE BEE 123 146))
(12 (DAD DAD BEE BEE 123 171))
(13 (DAD DAD BEE BEE 123 198))
(14 (DAD 2701 BEE BEE 123 227))
(15 (DAD 3088 BEE 2699 123 258))
  NIL

Notes:
Altering the input radix can be useful when reading data files in special formats.

Allegro CL Implementation Details:
None.

Home Previous Up Next Table of Contents Index
© Franz Inc. All Rights Reserved - File last updated 2022-07-25