251 lines
No EOL
5.3 KiB
HTML
251 lines
No EOL
5.3 KiB
HTML
<!DOCTYPE HTML>
|
|
<HTML LANG="en-us"
|
|
><HEAD
|
|
><TITLE
|
|
>*read-base* | Common Lisp Nova Spec</TITLE
|
|
><META CHARSET="US-ASCII"
|
|
><LINK REL="canonical" HREF="v_read-base.html"
|
|
><LINK REL="next" HREF="v_read-default-float-format.html" TYPE="text/html" TITLE="*read-default-float-format*"
|
|
><LINK REL="prev" HREF="f_with-standard-io-syntax.html" TYPE="text/html" TITLE="with-standard-io-syntax"
|
|
><LINK REL="up" HREF="23_2_Reader_Dictionary.html" TYPE="text/html" TITLE="23.2 Reader Dictionary"
|
|
><LINK REL="start" HREF="index.html" TYPE="text/html" TITLE="Common Lisp Nova Spec"
|
|
><META NAME="VIEWPORT" CONTENT="width=device-width, initial-scale=1.0"
|
|
><LINK REL="STYLESHEET" HREF="dpans.css%3F3909942064.css"
|
|
><SCRIPT SRC="dpans.js%3F3909942064"
|
|
></SCRIPT
|
|
><SCRIPT SRC="apropos.js%3F3909942064"
|
|
></SCRIPT
|
|
></HEAD
|
|
><BODY
|
|
><DIV
|
|
><DIV CLASS="topnav"
|
|
><DIV CLASS="breadcrumb"
|
|
><SPAN CLASS="breadcrumb-item"
|
|
><A HREF="index.html"
|
|
>Common Lisp Nova Spec</A
|
|
></SPAN
|
|
> <SPAN CLASS="breadcrumb-item"
|
|
>→ <A HREF="23_Reader.html"
|
|
>23. Reader</A
|
|
></SPAN
|
|
> <SPAN CLASS="breadcrumb-item"
|
|
>→ <A HREF="23_2_Reader_Dictionary.html"
|
|
>23.2 Reader Dictionary</A
|
|
></SPAN
|
|
> <SPAN CLASS="breadcrumb-item"
|
|
>→ <A HREF="v_read-base.html"
|
|
>*read-base*</A
|
|
></SPAN
|
|
></DIV
|
|
><DIV CLASS="apropos"
|
|
><DIV CLASS="apropos-io"
|
|
><A HREF="f_with-standard-io-syntax.html" CLASS="prev"
|
|
>←</A
|
|
><SPAN ID="apropos-label"
|
|
>Apropos </SPAN
|
|
><INPUT ID="apropos" AUTOFOCUS="AUTOFOCUS" PLACEHOLDER="Type here to search" ONINPUT="aproposInput(this);" ONKEYUP="aproposKeyup(event);" ONCHANGE="aproposChange(this);" ONFOCUS="aproposFocus(this);" ONFOCUSOUT="aproposFocusout(this);"
|
|
><A HREF="v_read-default-float-format.html" CLASS="next"
|
|
>→</A
|
|
></DIV
|
|
><DIV ID="apropos-res"
|
|
></DIV
|
|
></DIV
|
|
></DIV
|
|
><DIV CLASS="matter"
|
|
><DIV CLASS="com"
|
|
><DIV CLASS="begincom"
|
|
><HR
|
|
><TABLE WIDTH="100%" CELLSPACING="0" CELLPADDING="0"
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" WIDTH="100%" CLASS="name"
|
|
><SPAN CLASS="idx" DATA-KIND="idxref" DATA-TERM="*read-base*"
|
|
></SPAN
|
|
><SPAN CLASS="cmsy"
|
|
>*</SPAN
|
|
><B
|
|
>read-base</B
|
|
><SPAN CLASS="cmsy"
|
|
>*</SPAN
|
|
></TD
|
|
><TD ALIGN="RIGHT" VALIGN="BASELINE" WIDTH="0" NOWRAP="NOWRAP" CLASS="ftype"
|
|
><I
|
|
>Variable</I
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><HR
|
|
></DIV
|
|
><UL CLASS="subtoc"
|
|
></UL
|
|
><DL
|
|
><DT
|
|
><B
|
|
>Value Type</B
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
>a <A HREF="26_1_Glossary.html#radix"
|
|
><EM CLASS="term"
|
|
>radix</EM
|
|
></A
|
|
>.</P
|
|
></DD
|
|
><DT
|
|
><B
|
|
>Initial Value</B
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
><CODE CLASS="f"
|
|
>10</CODE
|
|
>.</P
|
|
></DD
|
|
><DT
|
|
><B
|
|
>Description</B
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
>Controls the interpretation of tokens by <A HREF="f_read.html" CLASS="funref"
|
|
><B
|
|
>read</B
|
|
></A
|
|
> as being <A HREF="26_1_Glossary.html#integer"
|
|
><EM CLASS="term"
|
|
>integers</EM
|
|
></A
|
|
> or <A HREF="26_1_Glossary.html#ratio"
|
|
><EM CLASS="term"
|
|
>ratios</EM
|
|
></A
|
|
>. </P
|
|
><P CLASS="j"
|
|
>The <A HREF="26_1_Glossary.html#value"
|
|
><EM CLASS="term"
|
|
>value</EM
|
|
></A
|
|
> of <A HREF="v_read-base.html" CLASS="misc"
|
|
><B
|
|
>*read-base*</B
|
|
></A
|
|
>, called the <DFN CLASS="newterm"
|
|
><SPAN CLASS="cmbxsl"
|
|
>current</SPAN
|
|
> <SPAN CLASS="cmbxsl"
|
|
>input</SPAN
|
|
> <SPAN CLASS="cmbxsl"
|
|
>base</SPAN
|
|
></DFN
|
|
><SPAN CLASS="idx" DATA-KIND="idxterm" DATA-TERM="current input base"
|
|
></SPAN
|
|
>, is the radix in which <A HREF="26_1_Glossary.html#integer"
|
|
><EM CLASS="term"
|
|
>integers</EM
|
|
></A
|
|
> and <A HREF="26_1_Glossary.html#ratio"
|
|
><EM CLASS="term"
|
|
>ratios</EM
|
|
></A
|
|
> are to be read by the <A HREF="26_1_Glossary.html#Lisp_reader"
|
|
><EM CLASS="term"
|
|
>Lisp reader</EM
|
|
></A
|
|
>. The parsing of other numeric <A HREF="26_1_Glossary.html#type"
|
|
><EM CLASS="term"
|
|
>types</EM
|
|
></A
|
|
> (<I CLASS="i"
|
|
><I
|
|
>e.g.</I
|
|
></I
|
|
>, <A HREF="26_1_Glossary.html#float"
|
|
><EM CLASS="term"
|
|
>floats</EM
|
|
></A
|
|
>) is not affected by this option. </P
|
|
><P CLASS="j"
|
|
>The effect of <A HREF="v_read-base.html" CLASS="varref"
|
|
><B
|
|
>*read-base*</B
|
|
></A
|
|
> on the reading of any particular <A HREF="26_1_Glossary.html#rational"
|
|
><EM CLASS="term"
|
|
>rational</EM
|
|
></A
|
|
> number can be locally overridden by explicit use of the <CODE CLASS="f"
|
|
>#O</CODE
|
|
>, <CODE CLASS="f"
|
|
>#X</CODE
|
|
>, <CODE CLASS="f"
|
|
>#B</CODE
|
|
>, or <SPAN CLASS="cmtt"
|
|
>#</SPAN
|
|
><I CLASS="i"
|
|
><I
|
|
>n</I
|
|
></I
|
|
><SPAN CLASS="cmtt"
|
|
>R</SPAN
|
|
> syntax or by a trailing decimal point.</P
|
|
></DD
|
|
><DT
|
|
><B
|
|
>Examples</B
|
|
></DT
|
|
><DD
|
|
><PRE CLASS="screen"
|
|
> (dotimes (i 6)
|
|
(let ((*read-base* (+ 10. i)))
|
|
(let ((object (read-from-string "(\\DAD DAD |BEE| BEE 123. 123)")))
|
|
(print (list *read-base* object)))))
|
|
<SPAN CLASS="cmr"
|
|
>⊳</SPAN
|
|
> (10 (DAD DAD BEE BEE 123 123))
|
|
<SPAN CLASS="cmr"
|
|
>⊳</SPAN
|
|
> (11 (DAD DAD BEE BEE 123 146))
|
|
<SPAN CLASS="cmr"
|
|
>⊳</SPAN
|
|
> (12 (DAD DAD BEE BEE 123 171))
|
|
<SPAN CLASS="cmr"
|
|
>⊳</SPAN
|
|
> (13 (DAD DAD BEE BEE 123 198))
|
|
<SPAN CLASS="cmr"
|
|
>⊳</SPAN
|
|
> (14 (DAD 2701 BEE BEE 123 227))
|
|
<SPAN CLASS="cmr"
|
|
>⊳</SPAN
|
|
> (15 (DAD 3088 BEE 2699 123 258))
|
|
<SPAN CLASS="cmsy"
|
|
><SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
></SPAN
|
|
> NIL</PRE
|
|
></DD
|
|
><DT
|
|
><B
|
|
>Notes</B
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
>Altering the input radix can be useful when reading data files in special formats.</P
|
|
></DD
|
|
></DL
|
|
></DIV
|
|
></DIV
|
|
><DIV CLASS="footer"
|
|
><DIV CLASS="btmnav"
|
|
><A HREF="f_with-standard-io-syntax.html" CLASS="prev"
|
|
>←</A
|
|
><A HREF="v_read-default-float-format.html" CLASS="next"
|
|
>→</A
|
|
></DIV
|
|
><DIV CLASS="trail"
|
|
>Conversion to HTML copyright 2023 by Gilbert Baumann</DIV
|
|
></DIV
|
|
></DIV
|
|
><SCRIPT
|
|
>domReady();</SCRIPT
|
|
></BODY
|
|
></HTML
|
|
> |