klisp

an open source interpreter for the Kernel Programming Language.
git clone http://git.hanabi.in/repos/klisp.git
Log | Files | Refs | README

commit ff20abb7979b296f637475caae5b187109c50cc1
parent 4b21b2d7ab8effb2c75e9a6eb920c2edaddaa239
Author: Andres Navarro <canavarro82@gmail.com>
Date:   Fri, 10 Jun 2011 20:17:52 -0300

Completed module numbers in the manual.

Diffstat:
Mmanual/html/Characters.html | 42+++++++++++++++++++++---------------------
Mmanual/html/Index.html | 177+++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------
Mmanual/html/Numbers.html | 473+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mmanual/html/Ports.html | 50+++++++++++++++++++++++++-------------------------
Mmanual/html/Strings.html | 48++++++++++++++++++++++++------------------------
Mmanual/klisp.info | 457++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
Mmanual/src/numbers.texi | 458+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7 files changed, 1572 insertions(+), 133 deletions(-)

diff --git a/manual/html/Characters.html b/manual/html/Characters.html @@ -34,7 +34,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a> <!-- node-name, next, previous, up --> <h2 class="chapter">15 Characters</h2> -<p><a name="index-characters-175"></a> +<p><a name="index-characters-236"></a> A character is an object that represents an ASCII character (for now, only ASCII is supported in klisp, in the future, full UNICODE will be supported). The external representation of characters @@ -47,50 +47,50 @@ encapsulated. features defined here were taken mostly from r5rs scheme. <div class="defun"> -&mdash; Applicative: <b>char?</b> (<var>char? . objects</var>)<var><a name="index-char_003f-176"></a></var><br> +&mdash; Applicative: <b>char?</b> (<var>char? . objects</var>)<var><a name="index-char_003f-237"></a></var><br> <blockquote><p> The primitive type predicate for type character. <code>char?</code> returns true iff all the objects in <code>objects</code> are of type character. </p></blockquote></div> <div class="defun"> -&mdash; Applicative: <b>char=?</b> (<var>char=? . chars</var>)<var><a name="index-char_003d_003f-177"></a></var><br> -&mdash; Applicative: <b>char&lt;?</b> (<var>char&lt;? . chars</var>)<var><a name="index-char_003c_003f-178"></a></var><br> -&mdash; Applicative: <b>char&lt;=?</b> (<var>char&lt;=? . chars</var>)<var><a name="index-char_003c_003d_003f-179"></a></var><br> -&mdash; Applicative: <b>char&gt;?</b> (<var>char&gt;? . chars</var>)<var><a name="index-char_003e_003f-180"></a></var><br> -&mdash; Applicative: <b>char&gt;=?</b> (<var>char&gt;=? . chars</var>)<var><a name="index-char_003e_003d_003f-181"></a></var><br> +&mdash; Applicative: <b>char=?</b> (<var>char=? . chars</var>)<var><a name="index-char_003d_003f-238"></a></var><br> +&mdash; Applicative: <b>char&lt;?</b> (<var>char&lt;? . chars</var>)<var><a name="index-char_003c_003f-239"></a></var><br> +&mdash; Applicative: <b>char&lt;=?</b> (<var>char&lt;=? . chars</var>)<var><a name="index-char_003c_003d_003f-240"></a></var><br> +&mdash; Applicative: <b>char&gt;?</b> (<var>char&gt;? . chars</var>)<var><a name="index-char_003e_003f-241"></a></var><br> +&mdash; Applicative: <b>char&gt;=?</b> (<var>char&gt;=? . chars</var>)<var><a name="index-char_003e_003d_003f-242"></a></var><br> <blockquote><p> These predicates compare any number of characters using their ASCII value for the comparison. </p></blockquote></div> <div class="defun"> -&mdash; Applicative: <b>char-ci=?</b> (<var>char-ci=? . chars</var>)<var><a name="index-char_002dci_003d_003f-182"></a></var><br> -&mdash; Applicative: <b>char-ci&lt;?</b> (<var>char-ci&lt;? . chars</var>)<var><a name="index-char_002dci_003c_003f-183"></a></var><br> -&mdash; Applicative: <b>char-ci&lt;=?</b> (<var>char-ci&lt;=? . chars</var>)<var><a name="index-char_002dci_003c_003d_003f-184"></a></var><br> -&mdash; Applicative: <b>char-ci&gt;?</b> (<var>char-ci&gt;? . chars</var>)<var><a name="index-char_002dci_003e_003f-185"></a></var><br> -&mdash; Applicative: <b>char-ci&gt;=?</b> (<var>char-ci&gt;=? . chars</var>)<var><a name="index-char_002dci_003e_003d_003f-186"></a></var><br> +&mdash; Applicative: <b>char-ci=?</b> (<var>char-ci=? . chars</var>)<var><a name="index-char_002dci_003d_003f-243"></a></var><br> +&mdash; Applicative: <b>char-ci&lt;?</b> (<var>char-ci&lt;? . chars</var>)<var><a name="index-char_002dci_003c_003f-244"></a></var><br> +&mdash; Applicative: <b>char-ci&lt;=?</b> (<var>char-ci&lt;=? . chars</var>)<var><a name="index-char_002dci_003c_003d_003f-245"></a></var><br> +&mdash; Applicative: <b>char-ci&gt;?</b> (<var>char-ci&gt;? . chars</var>)<var><a name="index-char_002dci_003e_003f-246"></a></var><br> +&mdash; Applicative: <b>char-ci&gt;=?</b> (<var>char-ci&gt;=? . chars</var>)<var><a name="index-char_002dci_003e_003d_003f-247"></a></var><br> <blockquote><p> These predicates convert the chars to lowercase and then compare their ASCII values. </p></blockquote></div> <div class="defun"> -&mdash; Applicative: <b>char-alphabetic?</b> (<var>char-alphabetic? . chars</var>)<var><a name="index-char_002dalphabetic_003f-187"></a></var><br> -&mdash; Applicative: <b>char-numeric?</b> (<var>char-numeric? . chars</var>)<var><a name="index-char_002dnumeric_003f-188"></a></var><br> -&mdash; Applicative: <b>char-whitespace?</b> (<var>char-whitespace? . chars</var>)<var><a name="index-char_002dwhitespace_003f-189"></a></var><br> +&mdash; Applicative: <b>char-alphabetic?</b> (<var>char-alphabetic? . chars</var>)<var><a name="index-char_002dalphabetic_003f-248"></a></var><br> +&mdash; Applicative: <b>char-numeric?</b> (<var>char-numeric? . chars</var>)<var><a name="index-char_002dnumeric_003f-249"></a></var><br> +&mdash; Applicative: <b>char-whitespace?</b> (<var>char-whitespace? . chars</var>)<var><a name="index-char_002dwhitespace_003f-250"></a></var><br> <blockquote><p> These predicates return true iff all of their arguments are respectively &ldquo;alphabetic&rdquo;, &ldquo;numeric&rdquo;, or &ldquo;whitespace&rdquo;. </p></blockquote></div> <div class="defun"> -&mdash; Applicative: <b>char-upper-case?</b> (<var>char-upper-case? . chars</var>)<var><a name="index-char_002dupper_002dcase_003f-190"></a></var><br> -&mdash; Applicative: <b>char-lower-case?</b> (<var>char-lower-case? . chars</var>)<var><a name="index-char_002dlower_002dcase_003f-191"></a></var><br> +&mdash; Applicative: <b>char-upper-case?</b> (<var>char-upper-case? . chars</var>)<var><a name="index-char_002dupper_002dcase_003f-251"></a></var><br> +&mdash; Applicative: <b>char-lower-case?</b> (<var>char-lower-case? . chars</var>)<var><a name="index-char_002dlower_002dcase_003f-252"></a></var><br> <blockquote><p> These predicates return true iff all of their arguments are respectively &ldquo;upper case, or &ldquo;lower case&rdquo;. </p></blockquote></div> <div class="defun"> -&mdash; Applicative: <b>char-upcase</b> (<var>char-upcase char</var>)<var><a name="index-char_002dupcase-192"></a></var><br> -&mdash; Applicative: <b>char-downcase</b> (<var>char-downcase char</var>)<var><a name="index-char_002ddowncase-193"></a></var><br> +&mdash; Applicative: <b>char-upcase</b> (<var>char-upcase char</var>)<var><a name="index-char_002dupcase-253"></a></var><br> +&mdash; Applicative: <b>char-downcase</b> (<var>char-downcase char</var>)<var><a name="index-char_002ddowncase-254"></a></var><br> <blockquote><p> These applicatives return a character <code>char2</code> so that: <pre class="example"> (char-ci=? char char2) &rArr; #t </pre> @@ -102,8 +102,8 @@ respectively &ldquo;upper case, or &ldquo;lower case&rdquo;. </blockquote></div> <div class="defun"> -&mdash; Applicative: <b>char-&gt;integer</b> (<var>char-&gt;integer char</var>)<var><a name="index-char_002d_003einteger-194"></a></var><br> -&mdash; Applicative: <b>integer-&gt;char</b> (<var>integer-&gt;char k</var>)<var><a name="index-integer_002d_003echar-195"></a></var><br> +&mdash; Applicative: <b>char-&gt;integer</b> (<var>char-&gt;integer char</var>)<var><a name="index-char_002d_003einteger-255"></a></var><br> +&mdash; Applicative: <b>integer-&gt;char</b> (<var>integer-&gt;char k</var>)<var><a name="index-integer_002d_003echar-256"></a></var><br> <blockquote><p> These applicatives convert between ASCII values (as exact integers between 0 and 127) and characters. If an integer that is out of range for ASCII characters is passed to <code>integer-&gt;char</code>, an error is diff --git a/manual/html/Index.html b/manual/html/Index.html @@ -55,9 +55,20 @@ Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a> <li><a href="Control.html#index-g_t_0024sequence-30"><code>$sequence</code></a>: <a href="Control.html#Control">Control</a></li> <li><a href="Environments.html#index-g_t_0024set_0021-111"><code>$set!</code></a>: <a href="Environments.html#Environments">Environments</a></li> <li><a href="Combiners.html#index-g_t_0024vau-119"><code>$vau</code></a>: <a href="Combiners.html#Combiners">Combiners</a></li> -<li><a href="Ports.html#index-g_t_0028-200"><code>(</code></a>: <a href="Ports.html#Ports">Ports</a></li> +<li><a href="Ports.html#index-g_t_0028-261"><code>(</code></a>: <a href="Ports.html#Ports">Ports</a></li> +<li><a href="Numbers.html#index-g_t_0028-179"><code>(</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> <li><a href="Continuations.html#index-g_t_0028-135"><code>(</code></a>: <a href="Continuations.html#Continuations">Continuations</a></li> <li><a href="Environments.html#index-g_t_0028-110"><code>(</code></a>: <a href="Environments.html#Environments">Environments</a></li> +<li><a href="Numbers.html#index-g_t_002a-166"><code>*</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-g_t_002b-165"><code>+</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-g_t_002d-167"><code>-</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-g_t_002f-193"><code>/</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-g_t_003c_003d_003f-162"><code>&lt;=?</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-g_t_003c_003f-161"><code>&lt;?</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-g_t_003d_003f-160"><code>=?</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-g_t_003e_003d_003f-164"><code>&gt;=?</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-g_t_003e_003f-163"><code>&gt;?</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-acos-208"><code>acos</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> <li><a href="Booleans.html#index-and_003f-15"><code>and?</code></a>: <a href="Booleans.html#Booleans">Booleans</a></li> <li><a href="Pairs-and-lists.html#index-append-81"><code>append</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> <li><a href="Pairs-and-lists.html#index-append_0021-89"><code>append!</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> @@ -66,8 +77,10 @@ Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a> <li><a href="Combiners.html#index-applicatives-115">applicatives</a>: <a href="Combiners.html#Combiners">Combiners</a></li> <li><a href="Combiners.html#index-apply-123"><code>apply</code></a>: <a href="Combiners.html#Combiners">Combiners</a></li> <li><a href="Continuations.html#index-apply_002dcontinuation-134"><code>apply-continuation</code></a>: <a href="Continuations.html#Continuations">Continuations</a></li> +<li><a href="Numbers.html#index-asin-207"><code>asin</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> <li><a href="Pairs-and-lists.html#index-assoc-84"><code>assoc</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> <li><a href="Pairs-and-lists.html#index-assq-91"><code>assq</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> +<li><a href="Numbers.html#index-atan-209"><code>atan</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> <li><a href="Booleans.html#index-boolean_003f-13"><code>boolean?</code></a>: <a href="Booleans.html#Booleans">Booleans</a></li> <li><a href="Booleans.html#index-booleans-12">booleans</a>: <a href="Booleans.html#Booleans">Booleans</a></li> <li><a href="Pairs-and-lists.html#index-caaaar-59"><code>caaaar</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> @@ -84,8 +97,8 @@ Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a> <li><a href="Pairs-and-lists.html#index-cadddr-66"><code>cadddr</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> <li><a href="Pairs-and-lists.html#index-caddr-54"><code>caddr</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> <li><a href="Pairs-and-lists.html#index-cadr-48"><code>cadr</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> -<li><a href="Ports.html#index-call_002dwith_002dinput_002dfile-210"><code>call-with-input-file</code></a>: <a href="Ports.html#Ports">Ports</a></li> -<li><a href="Ports.html#index-call_002dwith_002doutput_002dfile-211"><code>call-with-output-file</code></a>: <a href="Ports.html#Ports">Ports</a></li> +<li><a href="Ports.html#index-call_002dwith_002dinput_002dfile-271"><code>call-with-input-file</code></a>: <a href="Ports.html#Ports">Ports</a></li> +<li><a href="Ports.html#index-call_002dwith_002doutput_002dfile-272"><code>call-with-output-file</code></a>: <a href="Ports.html#Ports">Ports</a></li> <li><a href="Continuations.html#index-call_002fcc-128"><code>call/cc</code></a>: <a href="Continuations.html#Continuations">Continuations</a></li> <li><a href="Pairs-and-lists.html#index-car-45"><code>car</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> <li><a href="Pairs-and-lists.html#index-cdaaar-67"><code>cdaaar</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> @@ -103,26 +116,27 @@ Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a> <li><a href="Pairs-and-lists.html#index-cdddr-58"><code>cdddr</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> <li><a href="Pairs-and-lists.html#index-cddr-50"><code>cddr</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> <li><a href="Pairs-and-lists.html#index-cdr-46"><code>cdr</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> -<li><a href="Characters.html#index-char_002d_003einteger-194"><code>char-&gt;integer</code></a>: <a href="Characters.html#Characters">Characters</a></li> -<li><a href="Characters.html#index-char_002dalphabetic_003f-187"><code>char-alphabetic?</code></a>: <a href="Characters.html#Characters">Characters</a></li> -<li><a href="Characters.html#index-char_002dci_003c_003d_003f-184"><code>char-ci&lt;=?</code></a>: <a href="Characters.html#Characters">Characters</a></li> -<li><a href="Characters.html#index-char_002dci_003c_003f-183"><code>char-ci&lt;?</code></a>: <a href="Characters.html#Characters">Characters</a></li> -<li><a href="Characters.html#index-char_002dci_003d_003f-182"><code>char-ci=?</code></a>: <a href="Characters.html#Characters">Characters</a></li> -<li><a href="Characters.html#index-char_002dci_003e_003d_003f-186"><code>char-ci&gt;=?</code></a>: <a href="Characters.html#Characters">Characters</a></li> -<li><a href="Characters.html#index-char_002dci_003e_003f-185"><code>char-ci&gt;?</code></a>: <a href="Characters.html#Characters">Characters</a></li> -<li><a href="Characters.html#index-char_002ddowncase-193"><code>char-downcase</code></a>: <a href="Characters.html#Characters">Characters</a></li> -<li><a href="Characters.html#index-char_002dlower_002dcase_003f-191"><code>char-lower-case?</code></a>: <a href="Characters.html#Characters">Characters</a></li> -<li><a href="Characters.html#index-char_002dnumeric_003f-188"><code>char-numeric?</code></a>: <a href="Characters.html#Characters">Characters</a></li> -<li><a href="Characters.html#index-char_002dupcase-192"><code>char-upcase</code></a>: <a href="Characters.html#Characters">Characters</a></li> -<li><a href="Characters.html#index-char_002dupper_002dcase_003f-190"><code>char-upper-case?</code></a>: <a href="Characters.html#Characters">Characters</a></li> -<li><a href="Characters.html#index-char_002dwhitespace_003f-189"><code>char-whitespace?</code></a>: <a href="Characters.html#Characters">Characters</a></li> -<li><a href="Characters.html#index-char_003c_003d_003f-179"><code>char&lt;=?</code></a>: <a href="Characters.html#Characters">Characters</a></li> -<li><a href="Characters.html#index-char_003c_003f-178"><code>char&lt;?</code></a>: <a href="Characters.html#Characters">Characters</a></li> -<li><a href="Characters.html#index-char_003d_003f-177"><code>char=?</code></a>: <a href="Characters.html#Characters">Characters</a></li> -<li><a href="Characters.html#index-char_003e_003d_003f-181"><code>char&gt;=?</code></a>: <a href="Characters.html#Characters">Characters</a></li> -<li><a href="Characters.html#index-char_003e_003f-180"><code>char&gt;?</code></a>: <a href="Characters.html#Characters">Characters</a></li> -<li><a href="Characters.html#index-char_003f-176"><code>char?</code></a>: <a href="Characters.html#Characters">Characters</a></li> -<li><a href="Characters.html#index-characters-175">characters</a>: <a href="Characters.html#Characters">Characters</a></li> +<li><a href="Numbers.html#index-ceiling-197"><code>ceiling</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Characters.html#index-char_002d_003einteger-255"><code>char-&gt;integer</code></a>: <a href="Characters.html#Characters">Characters</a></li> +<li><a href="Characters.html#index-char_002dalphabetic_003f-248"><code>char-alphabetic?</code></a>: <a href="Characters.html#Characters">Characters</a></li> +<li><a href="Characters.html#index-char_002dci_003c_003d_003f-245"><code>char-ci&lt;=?</code></a>: <a href="Characters.html#Characters">Characters</a></li> +<li><a href="Characters.html#index-char_002dci_003c_003f-244"><code>char-ci&lt;?</code></a>: <a href="Characters.html#Characters">Characters</a></li> +<li><a href="Characters.html#index-char_002dci_003d_003f-243"><code>char-ci=?</code></a>: <a href="Characters.html#Characters">Characters</a></li> +<li><a href="Characters.html#index-char_002dci_003e_003d_003f-247"><code>char-ci&gt;=?</code></a>: <a href="Characters.html#Characters">Characters</a></li> +<li><a href="Characters.html#index-char_002dci_003e_003f-246"><code>char-ci&gt;?</code></a>: <a href="Characters.html#Characters">Characters</a></li> +<li><a href="Characters.html#index-char_002ddowncase-254"><code>char-downcase</code></a>: <a href="Characters.html#Characters">Characters</a></li> +<li><a href="Characters.html#index-char_002dlower_002dcase_003f-252"><code>char-lower-case?</code></a>: <a href="Characters.html#Characters">Characters</a></li> +<li><a href="Characters.html#index-char_002dnumeric_003f-249"><code>char-numeric?</code></a>: <a href="Characters.html#Characters">Characters</a></li> +<li><a href="Characters.html#index-char_002dupcase-253"><code>char-upcase</code></a>: <a href="Characters.html#Characters">Characters</a></li> +<li><a href="Characters.html#index-char_002dupper_002dcase_003f-251"><code>char-upper-case?</code></a>: <a href="Characters.html#Characters">Characters</a></li> +<li><a href="Characters.html#index-char_002dwhitespace_003f-250"><code>char-whitespace?</code></a>: <a href="Characters.html#Characters">Characters</a></li> +<li><a href="Characters.html#index-char_003c_003d_003f-240"><code>char&lt;=?</code></a>: <a href="Characters.html#Characters">Characters</a></li> +<li><a href="Characters.html#index-char_003c_003f-239"><code>char&lt;?</code></a>: <a href="Characters.html#Characters">Characters</a></li> +<li><a href="Characters.html#index-char_003d_003f-238"><code>char=?</code></a>: <a href="Characters.html#Characters">Characters</a></li> +<li><a href="Characters.html#index-char_003e_003d_003f-242"><code>char&gt;=?</code></a>: <a href="Characters.html#Characters">Characters</a></li> +<li><a href="Characters.html#index-char_003e_003f-241"><code>char&gt;?</code></a>: <a href="Characters.html#Characters">Characters</a></li> +<li><a href="Characters.html#index-char_003f-237"><code>char?</code></a>: <a href="Characters.html#Characters">Characters</a></li> +<li><a href="Characters.html#index-characters-236">characters</a>: <a href="Characters.html#Characters">Characters</a></li> <li><a href="Combiners.html#index-combiner_003f-125"><code>combiner?</code></a>: <a href="Combiners.html#Combiners">Combiners</a></li> <li><a href="Combiners.html#index-combiners-114">combiners</a>: <a href="Combiners.html#Combiners">Combiners</a></li> <li><a href="Pairs-and-lists.html#index-cons-39"><code>cons</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> @@ -132,15 +146,21 @@ Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a> <li><a href="Control.html#index-control-26">control</a>: <a href="Control.html#Control">Control</a></li> <li><a href="Pairs-and-lists.html#index-copy_002des-90"><code>copy-es</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> <li><a href="Pairs-and-lists.html#index-copy_002des_002dimmutable_0021-42"><code>copy-es-immutable!</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> +<li><a href="Numbers.html#index-cos-205"><code>cos</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> <li><a href="Pairs-and-lists.html#index-countable_002dlist_003f-87"><code>countable-list?</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> +<li><a href="Numbers.html#index-denominator-195"><code>denominator</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> <li><a href="Format-of-Descriptions.html#index-description-format-7">description format</a>: <a href="Format-of-Descriptions.html#Format-of-Descriptions">Format of Descriptions</a></li> +<li><a href="Numbers.html#index-div-169"><code>div</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-div_002dand_002dmod-171"><code>div-and-mod</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-div0-172"><code>div0</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-div0_002dand_002dmod0-174"><code>div0-and-mod0</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> <li><a href="Evaluation-Notation.html#index-documentation-notation-4">documentation notation</a>: <a href="Evaluation-Notation.html#Evaluation-Notation">Evaluation Notation</a></li> <li><a href="Pairs-and-lists.html#index-empty-list-35">empty list</a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> <li><a href="Encapsulations.html#index-encapsulations-138">encapsulations</a>: <a href="Encapsulations.html#Encapsulations">Encapsulations</a></li> <li><a href="Pairs-and-lists.html#index-encycle_0021-77"><code>encycle!</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> <li><a href="Environments.html#index-environment_003f-95"><code>environment?</code></a>: <a href="Environments.html#Environments">Environments</a></li> <li><a href="Environments.html#index-environments-93">environments</a>: <a href="Environments.html#Environments">Environments</a></li> -<li><a href="Ports.html#index-eof_002dobject_003f-214"><code>eof-object?</code></a>: <a href="Ports.html#Ports">Ports</a></li> +<li><a href="Ports.html#index-eof_002dobject_003f-275"><code>eof-object?</code></a>: <a href="Ports.html#Ports">Ports</a></li> <li><a href="Equivalence.html#index-eq_003f-20"><code>eq?</code></a>: <a href="Equivalence.html#Equivalence">Equivalence</a></li> <li><a href="Equivalence.html#index-equal_003f-21"><code>equal?</code></a>: <a href="Equivalence.html#Equivalence">Equivalence</a></li> <li><a href="Equivalence.html#index-equivalence-19">equivalence</a>: <a href="Equivalence.html#Equivalence">Equivalence</a></li> @@ -148,101 +168,142 @@ Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a> <li><a href="Continuations.html#index-error_002dcontinuation-133"><code>error-continuation</code></a>: <a href="Continuations.html#Continuations">Continuations</a></li> <li><a href="Environments.html#index-eval-97"><code>eval</code></a>: <a href="Environments.html#Environments">Environments</a></li> <li><a href="Evaluation-Notation.html#index-evaluation-notation-3">evaluation notation</a>: <a href="Evaluation-Notation.html#Evaluation-Notation">Evaluation Notation</a></li> +<li><a href="Numbers.html#index-even_003f-178"><code>even?</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-exact_003f-156"><code>exact?</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> <li><a href="Continuations.html#index-exit-137"><code>exit</code></a>: <a href="Continuations.html#Continuations">Continuations</a></li> +<li><a href="Numbers.html#index-exp-202"><code>exp</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-expt-211"><code>expt</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> <li><a href="Continuations.html#index-extend_002dcontinuation-129"><code>extend-continuation</code></a>: <a href="Continuations.html#Continuations">Continuations</a></li> <li><a href="Pairs-and-lists.html#index-filter-83"><code>filter</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> <li><a href="Pairs-and-lists.html#index-finite_002dlist_003f-86"><code>finite-list?</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> +<li><a href="Numbers.html#index-finite_003f-155"><code>finite?</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-floor-196"><code>floor</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> <li><a href="Some-Terms.html#index-fonts-2">fonts</a>: <a href="Some-Terms.html#Some-Terms">Some Terms</a></li> <li><a href="A-Sample-Applicative-Description.html#index-foo-11"><code>foo</code></a>: <a href="A-Sample-Applicative-Description.html#A-Sample-Applicative-Description">A Sample Applicative Description</a></li> <li><a href="Control.html#index-for_002deach-32"><code>for-each</code></a>: <a href="Control.html#Control">Control</a></li> <li><a href="Promises.html#index-force-142"><code>force</code></a>: <a href="Promises.html#Promises">Promises</a></li> +<li><a href="Numbers.html#index-gcd-183"><code>gcd</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> <li><a href="Environments.html#index-get_002dcurrent_002denvironment-102"><code>get-current-environment</code></a>: <a href="Environments.html#Environments">Environments</a></li> <li><a href="Pairs-and-lists.html#index-get_002dlist_002dmetrics-75"><code>get-list-metrics</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> -<li><a href="Ports.html#index-get_002dmodule-213"><code>get-module</code></a>: <a href="Ports.html#Ports">Ports</a></li> +<li><a href="Ports.html#index-get_002dmodule-274"><code>get-module</code></a>: <a href="Ports.html#Ports">Ports</a></li> +<li><a href="Numbers.html#index-get_002dreal_002dexact_002dbounds-185"><code>get-real-exact-bounds</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-get_002dreal_002dexact_002dprimary-187"><code>get-real-exact-primary</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-get_002dreal_002dinternal_002dbounds-184"><code>get-real-internal-bounds</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-get_002dreal_002dinternal_002dprimary-186"><code>get-real-internal-primary</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-get_002dstring_002darithmetic-192"><code>get-string-arithmetic</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> <li><a href="Continuations.html#index-guard_002dcontinuation-130"><code>guard-continuation</code></a>: <a href="Continuations.html#Continuations">Continuations</a></li> <li><a href="Continuations.html#index-guard_002ddynamic_002dextent-136"><code>guard-dynamic-extent</code></a>: <a href="Continuations.html#Continuations">Continuations</a></li> <li><a href="Environments.html#index-ignore-94">ignore</a>: <a href="Environments.html#Environments">Environments</a></li> <li><a href="Environments.html#index-ignore_003f-96"><code>ignore?</code></a>: <a href="Environments.html#Environments">Environments</a></li> <li><a href="Control.html#index-inert-27">inert</a>: <a href="Control.html#Control">Control</a></li> <li><a href="Control.html#index-inert_003f-28"><code>inert?</code></a>: <a href="Control.html#Control">Control</a></li> -<li><a href="Ports.html#index-input_002dport_003f-198"><code>input-port?</code></a>: <a href="Ports.html#Ports">Ports</a></li> -<li><a href="Characters.html#index-integer_002d_003echar-195"><code>integer-&gt;char</code></a>: <a href="Characters.html#Characters">Characters</a></li> +<li><a href="Numbers.html#index-inexact_003f-157"><code>inexact?</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Ports.html#index-input_002dport_003f-259"><code>input-port?</code></a>: <a href="Ports.html#Ports">Ports</a></li> +<li><a href="Characters.html#index-integer_002d_003echar-256"><code>integer-&gt;char</code></a>: <a href="Characters.html#Characters">Characters</a></li> +<li><a href="Numbers.html#index-integer_003f-152"><code>integer?</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> <li><a href="Kernel-History.html#index-Kernel-history-1">Kernel history</a>: <a href="Kernel-History.html#Kernel-History">Kernel History</a></li> <li><a href="Keyed-Variables.html#index-keyed-dynamic-variables-146">keyed dynamic variables</a>: <a href="Keyed-Variables.html#Keyed-Variables">Keyed Variables</a></li> <li><a href="Keyed-Variables.html#index-keyed-static-variables-148">keyed static variables</a>: <a href="Keyed-Variables.html#Keyed-Variables">Keyed Variables</a></li> <li><a href="Keyed-Variables.html#index-keyed-variables-145">keyed variables</a>: <a href="Keyed-Variables.html#Keyed-Variables">Keyed Variables</a></li> +<li><a href="Numbers.html#index-lcm-182"><code>lcm</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> <li><a href="Pairs-and-lists.html#index-length-79"><code>length</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> <li><a href="Pairs-and-lists.html#index-list-43"><code>list</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> <li><a href="Pairs-and-lists.html#index-list_002a-44"><code>list*</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> -<li><a href="Strings.html#index-list_002d_003estring-174"><code>list-&gt;string</code></a>: <a href="Strings.html#Strings">Strings</a></li> +<li><a href="Strings.html#index-list_002d_003estring-235"><code>list-&gt;string</code></a>: <a href="Strings.html#Strings">Strings</a></li> <li><a href="Pairs-and-lists.html#index-list_002dneighbors-82"><code>list-neighbors</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> <li><a href="Pairs-and-lists.html#index-list_002dref-80"><code>list-ref</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> <li><a href="Pairs-and-lists.html#index-list_002dtail-76"><code>list-tail</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> <li><a href="Pairs-and-lists.html#index-lists-36">lists</a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> -<li><a href="Ports.html#index-load-212"><code>load</code></a>: <a href="Ports.html#Ports">Ports</a></li> +<li><a href="Ports.html#index-load-273"><code>load</code></a>: <a href="Ports.html#Ports">Ports</a></li> +<li><a href="Numbers.html#index-log-203"><code>log</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> <li><a href="Encapsulations.html#index-make_002dencapsulation_002dtype-139"><code>make-encapsulation-type</code></a>: <a href="Encapsulations.html#Encapsulations">Encapsulations</a></li> <li><a href="Environments.html#index-make_002denvironment-98"><code>make-environment</code></a>: <a href="Environments.html#Environments">Environments</a></li> +<li><a href="Numbers.html#index-make_002dinexact-188"><code>make-inexact</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> <li><a href="Environments.html#index-make_002dkernel_002dstandard_002denvironment-103"><code>make-kernel-standard-environment</code></a>: <a href="Environments.html#Environments">Environments</a></li> <li><a href="Keyed-Variables.html#index-make_002dkeyed_002ddynamic_002dvariable-147"><code>make-keyed-dynamic-variable</code></a>: <a href="Keyed-Variables.html#Keyed-Variables">Keyed Variables</a></li> <li><a href="Keyed-Variables.html#index-make_002dkeyed_002dstatic_002dvariable-149"><code>make-keyed-static-variable</code></a>: <a href="Keyed-Variables.html#Keyed-Variables">Keyed Variables</a></li> -<li><a href="Strings.html#index-make_002dstring-163"><code>make-string</code></a>: <a href="Strings.html#Strings">Strings</a></li> +<li><a href="Strings.html#index-make_002dstring-224"><code>make-string</code></a>: <a href="Strings.html#Strings">Strings</a></li> <li><a href="Combiners.html#index-map-124"><code>map</code></a>: <a href="Combiners.html#Combiners">Combiners</a></li> <li><a href="Pairs-and-lists.html#index-map-78"><code>map</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> +<li><a href="Numbers.html#index-max-180"><code>max</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> <li><a href="Pairs-and-lists.html#index-member_003f-85"><code>member?</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> <li><a href="Promises.html#index-memoize-144"><code>memoize</code></a>: <a href="Promises.html#Promises">Promises</a></li> <li><a href="Pairs-and-lists.html#index-memq_003f-92"><code>memq?</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> +<li><a href="Numbers.html#index-min-181"><code>min</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-mod-170"><code>mod</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-mod0-173"><code>mod0</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-negative_003f-176"><code>negative?</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> <li><a href="Pairs-and-lists.html#index-nil-34">nil</a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> <li><a href="Booleans.html#index-not_003f-14"><code>not?</code></a>: <a href="Booleans.html#Booleans">Booleans</a></li> <li><a href="Pairs-and-lists.html#index-null_003f-38"><code>null?</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> +<li><a href="Numbers.html#index-number_003f-151"><code>number?</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> <li><a href="Numbers.html#index-numbers-150">numbers</a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-numerator-194"><code>numerator</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> <li><a href="A-Sample-Applicative-Description.html#index-object-descriptions-10">object descriptions</a>: <a href="A-Sample-Applicative-Description.html#A-Sample-Applicative-Description">A Sample Applicative Description</a></li> -<li><a href="Ports.html#index-open_002dinput_002dfile-204"><code>open-input-file</code></a>: <a href="Ports.html#Ports">Ports</a></li> -<li><a href="Ports.html#index-open_002doutput_002dfile-205"><code>open-output-file</code></a>: <a href="Ports.html#Ports">Ports</a></li> +<li><a href="Numbers.html#index-odd_003f-177"><code>odd?</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Ports.html#index-open_002dinput_002dfile-265"><code>open-input-file</code></a>: <a href="Ports.html#Ports">Ports</a></li> +<li><a href="Ports.html#index-open_002doutput_002dfile-266"><code>open-output-file</code></a>: <a href="Ports.html#Ports">Ports</a></li> <li><a href="A-Sample-Applicative-Description.html#index-operative-descriptions-9">operative descriptions</a>: <a href="A-Sample-Applicative-Description.html#A-Sample-Applicative-Description">A Sample Applicative Description</a></li> <li><a href="Combiners.html#index-operative_003f-117"><code>operative?</code></a>: <a href="Combiners.html#Combiners">Combiners</a></li> <li><a href="Combiners.html#index-operatives-116">operatives</a>: <a href="Combiners.html#Combiners">Combiners</a></li> <li><a href="Booleans.html#index-or_003f-16"><code>or?</code></a>: <a href="Booleans.html#Booleans">Booleans</a></li> -<li><a href="Ports.html#index-output_002dport_003f-199"><code>output-port?</code></a>: <a href="Ports.html#Ports">Ports</a></li> +<li><a href="Ports.html#index-output_002dport_003f-260"><code>output-port?</code></a>: <a href="Ports.html#Ports">Ports</a></li> <li><a href="Pairs-and-lists.html#index-pair_003f-37"><code>pair?</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> <li><a href="Pairs-and-lists.html#index-pairs-33">pairs</a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> -<li><a href="Ports.html#index-port_003f-197"><code>port?</code></a>: <a href="Ports.html#Ports">Ports</a></li> -<li><a href="Ports.html#index-ports-196">ports</a>: <a href="Ports.html#Ports">Ports</a></li> +<li><a href="Ports.html#index-port_003f-258"><code>port?</code></a>: <a href="Ports.html#Ports">Ports</a></li> +<li><a href="Ports.html#index-ports-257">ports</a>: <a href="Ports.html#Ports">Ports</a></li> +<li><a href="Numbers.html#index-positive_003f-175"><code>positive?</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> <li><a href="Printing-Notation.html#index-printing-notation-5">printing notation</a>: <a href="Printing-Notation.html#Printing-Notation">Printing Notation</a></li> <li><a href="Promises.html#index-promise_003f-141"><code>promise?</code></a>: <a href="Promises.html#Promises">Promises</a></li> <li><a href="Promises.html#index-promises-140">promises</a>: <a href="Promises.html#Promises">Promises</a></li> -<li><a href="Ports.html#index-read-208"><code>read</code></a>: <a href="Ports.html#Ports">Ports</a></li> +<li><a href="Numbers.html#index-rational_003f-153"><code>rational?</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-rationalize-200"><code>rationalize</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Ports.html#index-read-269"><code>read</code></a>: <a href="Ports.html#Ports">Ports</a></li> +<li><a href="Numbers.html#index-real_002d_003eexact-190"><code>real-&gt;exact</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-real_002d_003einexact-189"><code>real-&gt;inexact</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-real_003f-154"><code>real?</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> <li><a href="Pairs-and-lists.html#index-reduce-88"><code>reduce</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> +<li><a href="Numbers.html#index-robust_003f-158"><code>robust?</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> <li><a href="Continuations.html#index-root_002dcontinuation-132"><code>root-continuation</code></a>: <a href="Continuations.html#Continuations">Continuations</a></li> +<li><a href="Numbers.html#index-round-199"><code>round</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> <li><a href="Pairs-and-lists.html#index-set_002dcar_0021-40"><code>set-car!</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> <li><a href="Pairs-and-lists.html#index-set_002dcdr_0021-41"><code>set-cdr!</code></a>: <a href="Pairs-and-lists.html#Pairs-and-lists">Pairs and lists</a></li> -<li><a href="Strings.html#index-string-164"><code>string</code></a>: <a href="Strings.html#Strings">Strings</a></li> -<li><a href="Strings.html#index-string_002d_003eimmutable_002dstring-172"><code>string-&gt;immutable-string</code></a>: <a href="Strings.html#Strings">Strings</a></li> -<li><a href="Strings.html#index-string_002d_003elist-173"><code>string-&gt;list</code></a>: <a href="Strings.html#Strings">Strings</a></li> +<li><a href="Numbers.html#index-simplest_002drational-201"><code>simplest-rational</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-sin-204"><code>sin</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-sqrt-210"><code>sqrt</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Strings.html#index-string-225"><code>string</code></a>: <a href="Strings.html#Strings">Strings</a></li> +<li><a href="Strings.html#index-string_002d_003eimmutable_002dstring-233"><code>string-&gt;immutable-string</code></a>: <a href="Strings.html#Strings">Strings</a></li> +<li><a href="Strings.html#index-string_002d_003elist-234"><code>string-&gt;list</code></a>: <a href="Strings.html#Strings">Strings</a></li> <li><a href="Symbols.html#index-string_002d_003esymbol-25"><code>string-&gt;symbol</code></a>: <a href="Symbols.html#Symbols">Symbols</a></li> -<li><a href="Strings.html#index-string_002dappend-170"><code>string-append</code></a>: <a href="Strings.html#Strings">Strings</a></li> -<li><a href="Strings.html#index-string_002dci_003c_003d_003f-160"><code>string-ci&lt;=?</code></a>: <a href="Strings.html#Strings">Strings</a></li> -<li><a href="Strings.html#index-string_002dci_003c_003f-159"><code>string-ci&lt;?</code></a>: <a href="Strings.html#Strings">Strings</a></li> -<li><a href="Strings.html#index-string_002dci_003d_003f-158"><code>string-ci=?</code></a>: <a href="Strings.html#Strings">Strings</a></li> -<li><a href="Strings.html#index-string_002dci_003e_003d_003f-162"><code>string-ci&gt;=?</code></a>: <a href="Strings.html#Strings">Strings</a></li> -<li><a href="Strings.html#index-string_002dci_003e_003f-161"><code>string-ci&gt;?</code></a>: <a href="Strings.html#Strings">Strings</a></li> -<li><a href="Strings.html#index-string_002dcopy-171"><code>string-copy</code></a>: <a href="Strings.html#Strings">Strings</a></li> -<li><a href="Strings.html#index-string_002dfill_0021-168"><code>string-fill!</code></a>: <a href="Strings.html#Strings">Strings</a></li> -<li><a href="Strings.html#index-string_002dlength-165"><code>string-length</code></a>: <a href="Strings.html#Strings">Strings</a></li> -<li><a href="Strings.html#index-string_002dref-166"><code>string-ref</code></a>: <a href="Strings.html#Strings">Strings</a></li> -<li><a href="Strings.html#index-string_002dset_0021-167"><code>string-set!</code></a>: <a href="Strings.html#Strings">Strings</a></li> -<li><a href="Strings.html#index-string_003c_003d_003f-155"><code>string&lt;=?</code></a>: <a href="Strings.html#Strings">Strings</a></li> -<li><a href="Strings.html#index-string_003c_003f-154"><code>string&lt;?</code></a>: <a href="Strings.html#Strings">Strings</a></li> -<li><a href="Strings.html#index-string_003d_003f-153"><code>string=?</code></a>: <a href="Strings.html#Strings">Strings</a></li> -<li><a href="Strings.html#index-string_003e_003d_003f-157"><code>string&gt;=?</code></a>: <a href="Strings.html#Strings">Strings</a></li> -<li><a href="Strings.html#index-string_003e_003f-156"><code>string&gt;?</code></a>: <a href="Strings.html#Strings">Strings</a></li> -<li><a href="Strings.html#index-string_003f-152"><code>string?</code></a>: <a href="Strings.html#Strings">Strings</a></li> -<li><a href="Strings.html#index-strings-151">strings</a>: <a href="Strings.html#Strings">Strings</a></li> -<li><a href="Strings.html#index-substring-169"><code>substring</code></a>: <a href="Strings.html#Strings">Strings</a></li> +<li><a href="Strings.html#index-string_002dappend-231"><code>string-append</code></a>: <a href="Strings.html#Strings">Strings</a></li> +<li><a href="Strings.html#index-string_002dci_003c_003d_003f-221"><code>string-ci&lt;=?</code></a>: <a href="Strings.html#Strings">Strings</a></li> +<li><a href="Strings.html#index-string_002dci_003c_003f-220"><code>string-ci&lt;?</code></a>: <a href="Strings.html#Strings">Strings</a></li> +<li><a href="Strings.html#index-string_002dci_003d_003f-219"><code>string-ci=?</code></a>: <a href="Strings.html#Strings">Strings</a></li> +<li><a href="Strings.html#index-string_002dci_003e_003d_003f-223"><code>string-ci&gt;=?</code></a>: <a href="Strings.html#Strings">Strings</a></li> +<li><a href="Strings.html#index-string_002dci_003e_003f-222"><code>string-ci&gt;?</code></a>: <a href="Strings.html#Strings">Strings</a></li> +<li><a href="Strings.html#index-string_002dcopy-232"><code>string-copy</code></a>: <a href="Strings.html#Strings">Strings</a></li> +<li><a href="Strings.html#index-string_002dfill_0021-229"><code>string-fill!</code></a>: <a href="Strings.html#Strings">Strings</a></li> +<li><a href="Strings.html#index-string_002dlength-226"><code>string-length</code></a>: <a href="Strings.html#Strings">Strings</a></li> +<li><a href="Strings.html#index-string_002dref-227"><code>string-ref</code></a>: <a href="Strings.html#Strings">Strings</a></li> +<li><a href="Strings.html#index-string_002dset_0021-228"><code>string-set!</code></a>: <a href="Strings.html#Strings">Strings</a></li> +<li><a href="Strings.html#index-string_003c_003d_003f-216"><code>string&lt;=?</code></a>: <a href="Strings.html#Strings">Strings</a></li> +<li><a href="Strings.html#index-string_003c_003f-215"><code>string&lt;?</code></a>: <a href="Strings.html#Strings">Strings</a></li> +<li><a href="Strings.html#index-string_003d_003f-214"><code>string=?</code></a>: <a href="Strings.html#Strings">Strings</a></li> +<li><a href="Strings.html#index-string_003e_003d_003f-218"><code>string&gt;=?</code></a>: <a href="Strings.html#Strings">Strings</a></li> +<li><a href="Strings.html#index-string_003e_003f-217"><code>string&gt;?</code></a>: <a href="Strings.html#Strings">Strings</a></li> +<li><a href="Strings.html#index-string_003f-213"><code>string?</code></a>: <a href="Strings.html#Strings">Strings</a></li> +<li><a href="Strings.html#index-strings-212">strings</a>: <a href="Strings.html#Strings">Strings</a></li> +<li><a href="Strings.html#index-substring-230"><code>substring</code></a>: <a href="Strings.html#Strings">Strings</a></li> <li><a href="Symbols.html#index-symbol_002d_003estring-24"><code>symbol-&gt;string</code></a>: <a href="Symbols.html#Symbols">Symbols</a></li> <li><a href="Symbols.html#index-symbol_003f-23"><code>symbol?</code></a>: <a href="Symbols.html#Symbols">Symbols</a></li> <li><a href="Symbols.html#index-symbols-22">symbols</a>: <a href="Symbols.html#Symbols">Symbols</a></li> +<li><a href="Numbers.html#index-tan-206"><code>tan</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-truncate-198"><code>truncate</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> +<li><a href="Numbers.html#index-undefined_003f-159"><code>undefined?</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> <li><a href="Combiners.html#index-unwrap-121"><code>unwrap</code></a>: <a href="Combiners.html#Combiners">Combiners</a></li> +<li><a href="Numbers.html#index-with_002dstrict_002darithmetic-191"><code>with-strict-arithmetic</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> <li><a href="Combiners.html#index-wrap-120"><code>wrap</code></a>: <a href="Combiners.html#Combiners">Combiners</a></li> +<li><a href="Numbers.html#index-zero_003f-168"><code>zero?</code></a>: <a href="Numbers.html#Numbers">Numbers</a></li> </ul><!-- Print the tables of contents --> <div class="shortcontents"> diff --git a/manual/html/Numbers.html b/manual/html/Numbers.html @@ -35,6 +35,479 @@ Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a> <h2 class="chapter">13 Numbers</h2> <p><a name="index-numbers-150"></a> +All numbers are immutable, and <code>equal?</code> iff <code>eq?</code>. The +number type is encapsulated. + +<!-- TODO add more content on numbers --> + <p>The external representation of an undefined number is +<code>#undefined</code>. The external representation of a real with no +primary value is <code>#real</code> (but this may change in the future, the +report is missing the output representation for reals with no primary +values). All other rules for externally representing numbers pertain +only to defined numbers with primary values. + + <p>An external representation of a real number consists of optional +radix and/or exactness prefixes, optional sign (<code>+</code> or <code>-</code>), +and magnitude. The radix prefixes are <code>#b</code> (binary), <code>#o</code> +(octal), <code>#d</code> (decimal), and <code>#x</code> (hexadecimal); the default +is decimal. The exactness prefixes are <code>#e</code> (exact) and +<code>#i</code> (inexact); by default, the number is inexact iff the +magnitude representation uses floating point. If both kinds of +prefixes are used, they may occur in either order. The magnitude is +either <code>infinity</code>; an unsigned integer (nonempty sequence of +digits); a ratio of unsigned integers (two unsigned integers with a +<code>/</code> between, of which the second is non-zero); or a floating +point representation. If the magnitude is <code>infinity</code>, there must +be an exactness prefix and a sign, and no radix prefix. Floating +point representation can only be used with decimal radix; it consists +of nonempty integer part, point (<code>.</code>), nonempty fraction part, +and optional exponent part. The optional exponent part consists of an +exponent letter, and an (optionally signed) integer indicating a power +of ten by which to multiply the magnitude. The choice of exponent +letter makes no difference in what mathematical number is indicated by +the external representation, but does indicate internal representation +precision. Exponent letters <code>s</code>, <code>f</code>, <code>d</code>, <code>f</code> +indicate preference for successively higher internal precision - +short, float, double, long. When reading an inexact real number, +exponent letter <code>e</code> accepts the default internal precision, which +must be at least double. When writeing an inexact real number, +exponent letter <code>e</code> may be used for the default internal +precision, and must be used for any internal number format not +indicated by any of the other exponent letters. Float and double must +provide, respectively, at least as much precision as IEEE 32-bit and +64-bit floating point standards [IE85]. For example, <code>#i#xa/c</code> +represents an inexact number using hexadecimal notation, with signed +magnitude positive five sixths (ten over twelve). <code>-3.5l-2</code> +represents an inexact number using decimal notation, with signed +magnitude negative thirty five thousandths, and requested long +precision (which must be at least IEEE 64-bit floating point). When +reading an external representation of an inexact real, the bounds on +the resulting inexact number are chosen in accordance with the +<!-- TODO add xref --> +narrow-arithmetic keyed dynamic variable. + + <p>NOTE: in klisp, all inexact numbers are stored as IEEE 64-bit floating +point. No bounding or robustness info is kept. + +<div class="defun"> +&mdash; Applicative: <b>number?</b> (<var>number? . objects</var>)<var><a name="index-number_003f-151"></a></var><br> +<blockquote><p> The primitive type predicate for type number. <code>number?</code> +returns true iff all the objects in <code>objects</code> are of type number. +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>integer?</b> (<var>integer? . objects</var>)<var><a name="index-integer_003f-152"></a></var><br> +<blockquote><p> The primitive type predicate for number subtype integer. +<code>integer?</code> returns true iff all the objects in <code>objects</code> +are of type integer. +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>rational?</b> (<var>rational? . objects</var>)<var><a name="index-rational_003f-153"></a></var><br> +<blockquote><p> The primitive type predicate for number subtype rational. +<code>rational?</code> returns true iff all the objects in <code>objects</code> +are of type rational. +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>real?</b> (<var>real? . objects</var>)<var><a name="index-real_003f-154"></a></var><br> +<blockquote><p> The primitive type predicate for number subtype real. +<code>real?</code> returns true iff all the objects in <code>objects</code> +are of type real. +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>finite?</b> (<var>finite? . numbers</var>)<var><a name="index-finite_003f-155"></a></var><br> +<blockquote><p> Predicate <code>finite?</code> returns true iff all the numbers in +<code>numbers</code> are finite. +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>exact?</b> (<var>exact? . numbers</var>)<var><a name="index-exact_003f-156"></a></var><br> +<blockquote><p> Predicate <code>exact?</code> returns true iff all the numbers in +<code>numbers</code> are exact. +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>inexact?</b> (<var>inexact? . numbers</var>)<var><a name="index-inexact_003f-157"></a></var><br> +<blockquote><p> Predicate <code>inexact?</code> returns true iff all the numbers in +<code>numbers</code> are inexact. +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>robust?</b> (<var>robust? . numbers</var>)<var><a name="index-robust_003f-158"></a></var><br> +<blockquote><p> Predicate <code>robust?</code> returns true iff all the numbers in +<code>numbers</code> are robust. +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>undefined?</b> (<var>undefined? . numbers</var>)<var><a name="index-undefined_003f-159"></a></var><br> +<blockquote><p> Predicate <code>undefined?</code> returns true iff all the numbers in +<code>numbers</code> are undefined. +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>=?</b> (<var>=? . numbers</var>)<var><a name="index-g_t_003d_003f-160"></a></var><br> +<blockquote><p> Applicative <code>=?</code> is a predicate that returns true iff all its +arguments are numerically equal to each other. If any of its +arguments has no primary value, an error is signaled. +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>&lt;?</b> (<var>&lt;? . reals</var>)<var><a name="index-g_t_003c_003f-161"></a></var><br> +&mdash; Applicative: <b>&lt;=?</b> (<var>&lt;=? . reals</var>)<var><a name="index-g_t_003c_003d_003f-162"></a></var><br> +&mdash; Applicative: <b>&gt;?</b> (<var>&gt;? . reals</var>)<var><a name="index-g_t_003e_003f-163"></a></var><br> +&mdash; Applicative: <b>&gt;=?</b> (<var>&gt;=? . reals</var>)<var><a name="index-g_t_003e_003d_003f-164"></a></var><br> +<blockquote><p> Each of these applicatives is a predicate that returns true iff +every two consecutive elements of <code>reals</code> have primary values in +the order indicated by the name of the applicative. If any element of +<code>reals</code> has no primary value, an error is signaled. +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>+</b> (<var>+ . numbers</var>)<var><a name="index-g_t_002b-165"></a></var><br> +<blockquote><p> Applicative <code>+</code> returns the sum of the elements of numbers. If +numbers is empty, the sum of its elements is exact zero. If a +positive infinity is added to a negative infinity, the result has no +primary value. If all the elements of a cycle are zero, the sum of +the cycle is zero. If the acyclic sum of the elements of a cycle +(i.e., the sum of an acyclic list containing just those elements) is +non-zero, the sum of the cycle is positive infinity times the acyclic +sum of the elements. If the acyclic sum of the elements of a cycle is +zero, but some of the elements of the cycle are non-zero, the sum of +the cycle has no primary value. +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>*</b> (<var>* . numbers</var>)<var><a name="index-g_t_002a-166"></a></var><br> +<blockquote><p> Applicative <code>*</code> returns the product of the elements of numbers. +If numbers is empty, the product of its elements is exact one. If an +infinity is multiplied by zero, the result has no primary value. If +the acyclic product of the elements of a cycle is real greater than +one, the product of the cycle is positive infinity. If all the +elements of a cycle are positive one, the product of the cycle is +positive one. If the acyclic product of the elements of a cycle is +positive one, but some of the elements of the cycle are not positive +one, the product of the cycle has no primary value. If the acyclic +product of the elements of a cycle has magnitude less than one, the +product of the cycle is zero. If the acyclic product of the elements +of a cycle has magnitude greater than or equal to one, and is not +positive real, the product of the cycle has no primary value. +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>-</b> (<var>- number . numbers</var>)<var><a name="index-g_t_002d-167"></a></var><br> +<blockquote><p> <code>numbers</code> should be a nonempty list of numbers. + + <p>Applicative <code>-</code> returns the sum of <code>number</code> with the +negation of the sum of <code>numbers</code>. +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>zero?</b> (<var>zero? . numbers</var>)<var><a name="index-zero_003f-168"></a></var><br> +<blockquote><p> Applicative <code>zero?</code> is a predicate that returns true iff every +element of <code>numbers</code> is zero. For this purpose, a real number is +zero if its primary value is zero. If any element of numbers has no +primary value an error is signaled. +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>div</b> (<var>div real1 real2</var>)<var><a name="index-div-169"></a></var><br> +&mdash; Applicative: <b>mod</b> (<var>mod real1 real2</var>)<var><a name="index-mod-170"></a></var><br> +&mdash; Applicative: <b>div-and-mod</b> (<var>div-and-mod real1 real2</var>)<var><a name="index-div_002dand_002dmod-171"></a></var><br> +<blockquote><p> For all three applicatives, if <code>real1</code> is infinite or +<code>real2</code> is zero, an error is signaled. + + <p>Let <code>n</code> be the greatest integer such that <code>real2 * n &lt;= +real1</code>. Applicative <code>div</code> returns <code>n</code>. Applicative +<code>mod</code> returns <code>real1 - (real2 * n)</code>. Applicative +<code>div-and-mod</code> returns a freshly allocated list of length two, +whose first element is <code>n</code> and whose second element is +<code>real1 - (real2 * n)</code>. + + <p>NOTE: I'm not really sure about this description... +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>div0</b> (<var>div0 real1 real2</var>)<var><a name="index-div0-172"></a></var><br> +&mdash; Applicative: <b>mod0</b> (<var>mod0 real1 real2</var>)<var><a name="index-mod0-173"></a></var><br> +&mdash; Applicative: <b>div0-and-mod0</b> (<var>div0-and-mod0 real1 real2</var>)<var><a name="index-div0_002dand_002dmod0-174"></a></var><br> +<blockquote><p> For all three applicatives, if <code>real1</code> is infinite or +<code>real2</code> is zero, an error is signaled. + + <p>Let <code>n</code> be the greatest integer such that <code>real2 * n &lt;= +real1 + |real2/2|</code>. Applicative <code>div0</code> returns <code>n</code>. +Applicative <code>mod0</code> returns <code>real1 - (real2 * n)</code>. +Applicative <code>div0-and-mod0</code> returns a freshly allocated list of +length two, whose first element is <code>n</code> and whose second element +is <code>real1 - (real2 * n)</code>. + + <p>NOTE: I'm not really sure about this description... +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>positive?</b> (<var>positive? . reals</var>)<var><a name="index-positive_003f-175"></a></var><br> +&mdash; Applicative: <b>negative?</b> (<var>negative? . reals</var>)<var><a name="index-negative_003f-176"></a></var><br> +<blockquote><p> Applicative <code>positive?</code> is a predicate that returns true iff +every element of <code>reals</code> is greater than zero. Applicative +<code>negative?</code> is a predicate that returns true iff every element of +<code>reals</code> is less than zero. If any argument to either applicative +has no primary value an error is signaled. +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>odd?</b> (<var>odd? . integers</var>)<var><a name="index-odd_003f-177"></a></var><br> +&mdash; Applicative: <b>even?</b> (<var>even? . integers</var>)<var><a name="index-even_003f-178"></a></var><br> +<blockquote><p> Applicative <code>odd?</code> is a predicate that returns true iff every +element of <code>integers</code> is odd. Applicative <code>even?</code> is a +predicate that returns true iff every element of <code>integers</code> is +even. If any argument to either applicative has no primary value an +error is signaled. +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>(</b><var>abs real</var>)<var><a name="index-g_t_0028-179"></a></var><br> +<blockquote><p> Applicative <code>abs</code> returns the nonnegative real number with the +same magnitude as <code>real</code>; that is, if <code>real</code> is nonnegative +it returns <code>real</code>, otherwise it returns the negation of +<code>real</code>. +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>max</b> (<var>max . reals</var>)<var><a name="index-max-180"></a></var><br> +&mdash; Applicative: <b>min</b> (<var>min . reals</var>)<var><a name="index-min-181"></a></var><br> +<blockquote><p> If <code>reals</code> is nil, applicative <code>max</code> returns exact +negative infinity, and applicative <code>min</code> returns exact positive +infinity. If <code>reals</code> is non-nil, applicative <code>max</code> returns +the largest number in <code>reals</code>, and applicative <code>min</code> returns +the smallest number in <code>reals</code>. +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>lcm</b> (<var>lcm . impints</var>)<var><a name="index-lcm-182"></a></var><br> +&mdash; Applicative: <b>gcd</b> (<var>gcd . impints</var>)<var><a name="index-gcd-183"></a></var><br> +<blockquote><p> <code>impints</code> should be a list of improper integers, that is, real +numbers each of which is either an integer or an infinity. + + <p>Applicative <code>lcm</code> returns the smallest positive improper +integer that is an improper0integer multiple of every element of +<code>impints</code> (that is, smallest <code>n &gt;= 1</code> such that for every +argument <code>nk</code> there exists <code>n'k</code> with <code>nk * n'k = n</code>). +If any of the arguments is zero, the result of <code>lcm</code> has no +primary value. According to these rules, <code>lcm</code> with nil argument +list returns <code>1</code>, and <code>lcm</code> with any infinite argument +returns positive infinity. + + <p>Applicative <code>gcd</code> returns the largest positive improper integer +such that every element of <code>impints</code> is an improper-integer +multiple of it (that is, largest <code>n &gt;= 1</code> such that for every +argument <code>nk</code> there exists <code>n'k</code> with <code>n * n'k = nk</code>). +<code>gcd</code> with nil argument list returns exact positive infinity. If +<code>gcd</code> is called with one or more arguments, and at least one of +the arguments is zero, but none of the arguments is a non-zero finite +integer, its result has no primary value. According to these rules, +if <code>gcd</code> is called with at least one finite non-zero argument, +its result is the same as if all zero and infinite arguments were +deleted. +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>get-real-internal-bounds</b> (<var>get-real-internal-bounds real</var>)<var><a name="index-get_002dreal_002dinternal_002dbounds-184"></a></var><br> +&mdash; Applicative: <b>get-real-exact-bounds</b> (<var>get-real-exact-bounds real</var>)<var><a name="index-get_002dreal_002dexact_002dbounds-185"></a></var><br> +<blockquote><p> Applicative <code>get-real-internal-bounds</code> returns a freshly +allocated list of reals <code>(x1 x2)</code>, where the primary value of +<code>x1</code> is the lower bound of <code>real</code>, using the same internal +representation as the primary value of <code>real</code>, and the primary +value of <code>x2</code> is the upper bound of <code>real</code>, using the same +internal representation as the primary value of <code>real</code>. The +<code>xk</code> are inexact iff real is inexact. The <code>xk</code> are robust +(i.e., tagged if the implementation supports such), and the bounds of +each <code>xk</code> are only required to contain its primary value (i.e., +the implementation is allowed to make the bounds equal to the primary +value). + + <p>Applicative <code>get-real-exact-bounds</code> returns a freshly allocated +list of exact reals <code>(x1 x2)</code>, where <code>x1</code> is not greater +than the lower bound of <code>real</code>, and <code>x2</code> is not less than +the upper bound of <code>real</code>. +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>get-real-internal-primary</b> (<var>get-real-internal-primary real</var>)<var><a name="index-get_002dreal_002dinternal_002dprimary-186"></a></var><br> +&mdash; Applicative: <b>get-real-exact-primary</b> (<var>get-real-exact-primary real</var>)<var><a name="index-get_002dreal_002dexact_002dprimary-187"></a></var><br> +<blockquote><p> If <code>real</code> is exact, both applicatives return <code>real</code>. If +<code>real</code> has no primary value, both applicatives signal an error. + + <p>If <code>real</code> is inexact with a primary value, applicative +<code>get-real-internal-primary</code> returns a real number <code>x0</code> whose +primary value is the same as, and has the same internal format as, the +primary value of <code>real</code>. <code>x0</code> is robust, and its bounds are +only required to contain its primary value. + + <!-- TODO add xref to get-real-exact-bounds --> + <p>If <code>real</code> is inexact with a primary value, applicative +<code>get-real-exact-primary</code> returns an exact real number <code>x0</code> +within the exact bounds that would be returned for <code>real</code> by +applicative <code>get-real-exact-bounds</code>. Preferably, <code>x0</code> +should be as close to the primary value of <code>real</code> as the +implementation can reasonably arrange. If the implementation does not +support any exact <code>real</code> that reasonably approximates +<code>real</code>, an error may be signaled. +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>make-inexact</b> (<var>make-inexact real1 real2 real3</var>)<var><a name="index-make_002dinexact-188"></a></var><br> +<blockquote><p> Applicative <code>make-inexact</code> returns an inexact real number, as +follows. If <code>real2</code> is inexact, the result has the same primary +value as <code>real2</code>; and if <code>real2</code> has no primary value, the +result has no primary value. The result has the same robustness as +<code>real2</code>. If possible, the result uses the same internal +representation as <code>real2</code>. If <code>real2</code> is exact, the primary +value of the result is as close to <code>real2</code> as the implementation +can reasonably arrange; overflow and underflow are handled as +<!-- TODO add xref to overflow --> +described in .... The lower bound of the result is no greater than +the lower bound of <code>real1</code>, the primary value of <code>real2</code>, +and the primary value of the result. The upper bound of the result is +no less than the upper bound of <code>real3</code>, the primary value of +<code>real2</code>, and the primary value of the result. +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>real-&gt;inexact</b> (<var>real-&gt;inexact real</var>)<var><a name="index-real_002d_003einexact-189"></a></var><br> +&mdash; Applicative: <b>real-&gt;exact</b> (<var>real-&gt;exact real</var>)<var><a name="index-real_002d_003eexact-190"></a></var><br> +<blockquote><!-- TODO add xref to get-real-exact-primary --> + <p>Applicative <code>real-&gt;exact</code> behaves just as +<code>get-real-exact-primary</code>. + + <p>If <code>real</code> is inexact, applicative <code>real-&gt;inexact</code> returns +<code>real</code>. If <code>real</code> is exact, applicative +<code>real-&gt;inexact</code> returns an inexact real <code>x0</code> such that +<code>real</code> would be a permissible result of passing <code>x0</code> to +<code>real-&gt;exact</code>. If the implementation does not support any such +<code>x0</code>, an error may be signaled. Otherwise, <code>x0</code> is robust, +and its bounds are only required to contain its primary value and +<code>real</code>. +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>with-strict-arithmetic</b> (<var>with-strict-arithmetic boolean combiner</var>)<var><a name="index-with_002dstrict_002darithmetic-191"></a></var><br> +&mdash; Applicative: <b>get-string-arithmetic</b> (<var>get-strict-arithmetic?</var>)<var><a name="index-get_002dstring_002darithmetic-192"></a></var><br> +<blockquote><!-- TODO add xref to dynamic keys and under/over flow, no prim value --> + <p>These applicatives are the binder and accessor of the +<code>strict-arithmetic</code> keyed dynamic variable. When this keyed +variable is true, various survivable but dubious arithmetic events +signal an error - notably, operation results with no primary value, +and over- and underflows. +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>/</b> (<var>/ number . numbers</var>)<var><a name="index-g_t_002f-193"></a></var><br> +<blockquote><p> <code>numbers</code> should be a nonempty list of numbers. + + <p>Applicative <code>/</code> returns <code>number</code> divided by the product of +<code>numbers</code>. If the product of <code>numbers</code> is zero, an error is +signaled. If <code>number</code> is infinite and the product of <code>numbers</code> is +infinite, an error is signaled. +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>numerator</b> (<var>numerator rational</var>)<var><a name="index-numerator-194"></a></var><br> +&mdash; Applicative: <b>denominator</b> (<var>denominator rational</var>)<var><a name="index-denominator-195"></a></var><br> +<blockquote><p> These applicatives return the numerator and denominator of +<code>rational</code>, in least terms (i.e., chosen for the least positive +denominator). Note that if <code>rational</code> is inexact, and either of +its bounds is not its primary value, the denominator has upper bound +positive infinity, and the numerator must have at least one infinite +bound (two infinite bounds if the bounds of rational allow values of +both signs). +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>floor</b> (<var>floor real</var>)<var><a name="index-floor-196"></a></var><br> +&mdash; Applicative: <b>ceiling</b> (<var>ceiling real</var>)<var><a name="index-ceiling-197"></a></var><br> +&mdash; Applicative: <b>truncate</b> (<var>truncate real</var>)<var><a name="index-truncate-198"></a></var><br> +&mdash; Applicative: <b>round</b> (<var>round real</var>)<var><a name="index-round-199"></a></var><br> +<blockquote><p> Applicative <code>floor</code> returns the largest integer not greater +than <code>real</code>. + + <p>Applicative <code>ceiling</code> returns the smallest integer not less +than <code>real</code>. + + <p>Applicative <code>truncate</code> returns the integer closest to +<code>real</code> whose absolute value is not greater than that of +<code>real</code>. + + <p>Applicative <code>round</code> returns the closest integer to <code>real</code>, +rounding to even when <code>real</code> is halfway between two integers. +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>rationalize</b> (<var>rationalize real1 real2</var>)<var><a name="index-rationalize-200"></a></var><br> +&mdash; Applicative: <b>simplest-rational</b> (<var>simplest-rational real1 real2</var>)<var><a name="index-simplest_002drational-201"></a></var><br> +<blockquote><p> A rational number <code>r1</code> is simpler than another rational +<code>r2</code> if <code>r1 = p1 / q1</code> and <code>r2 = p2 / q2</code>, both in +lowest terms, and <code>|p1| &lt;= |p2|</code> and <code>|q1| &lt;= |q2|</code>. Thus +<code>3/5</code> is simpler than <code>4/7</code>. Not all rationals are +comparable in this ordering, as for example <code>2/7</code> and <code>3/5</code>. +However, any interval (that contains rational numbers) contains a +rational number that is simpler than every other rational number in +that interval. Note that <code>0 = 0/1</code> is simpler than any other +rational (so that one never has to choose between <code>p/q</code> and +<code>−p/q</code>). + + <p>For applicative <code>simplest-rational</code>, let <code>x0</code> be the +simplest rational mathematically not less than the primary value of +<code>real1</code> and not greater than the primary value of <code>real2</code>. +If no such <code>x0</code> exists (because the primary value of <code>real1</code> +is greater, or because the primary values of the arguments are equal +and irrational), or if either argument does not have a primary value, +an error is signaled. + + <p>For applicative <code>rationalize</code>, let <code>x0</code> be the simplest +rational mathematical number within the interval bounded by the +primary value of <code>real1</code> plus and minus the primary value of +<code>real2</code>. If no such <code>x0</code> exists (because the primary value +of <code>real1</code> is irrational and the primary value <code>real2</code> is +zero), or if either argument does not have a primary value, an error +is signaled. + + <!-- TODO add xref to real->inexact --> + <p>If <code>real1</code> and <code>real2</code> are exact, the applicative +(whichever it is) returns exact <code>x0</code>. If one or both of +<code>real1</code> and <code>real2</code> are inexact, the applicative returns an +inexact rational approximating <code>x0</code> (as by <code>real-&gt;inexact</code>. +Note that an inexact result returned is not necessarily bounded by the +primary values of the arguments; but the result is an approximation of +<code>x0</code>, which is so bounded, and the bounds of the result include +<code>x0</code>. +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>exp</b> (<var>exp number</var>)<var><a name="index-exp-202"></a></var><br> +&mdash; Applicative: <b>log</b> (<var>log number</var>)<var><a name="index-log-203"></a></var><br> +<blockquote><p>TODO +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>sin</b> (<var>sin number</var>)<var><a name="index-sin-204"></a></var><br> +&mdash; Applicative: <b>cos</b> (<var>cos number</var>)<var><a name="index-cos-205"></a></var><br> +&mdash; Applicative: <b>tan</b> (<var>tan number</var>)<var><a name="index-tan-206"></a></var><br> +<blockquote><p>TODO +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>asin</b> (<var>asin number</var>)<var><a name="index-asin-207"></a></var><br> +&mdash; Applicative: <b>acos</b> (<var>acos number</var>)<var><a name="index-acos-208"></a></var><br> +&mdash; Applicative: <b>atan</b> (<var>atan number1 </var>[<var>number2</var>])<var><a name="index-atan-209"></a></var><br> +<blockquote><p>TODO +</p></blockquote></div> + +<div class="defun"> +&mdash; Applicative: <b>sqrt</b> (<var>sqrt number</var>)<var><a name="index-sqrt-210"></a></var><br> +&mdash; Applicative: <b>expt</b> (<var>expt number1 number2</var>)<var><a name="index-expt-211"></a></var><br> +<blockquote><p>TODO +</p></blockquote></div> <!-- *-texinfo-*- --> </body></html> diff --git a/manual/html/Ports.html b/manual/html/Ports.html @@ -34,7 +34,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a> <!-- node-name, next, previous, up --> <h2 class="chapter">16 Ports</h2> -<p><a name="index-ports-196"></a> +<p><a name="index-ports-257"></a> A port is an object that mediates character-based input from a source or character-based output to a destination. In the former case, the port is an input port, in the latter case, an output port. @@ -53,14 +53,14 @@ normal result of a call to read). The eof type is encapsulated. klisp and was taken from Scheme. <div class="defun"> -&mdash; Applicative: <b>port?</b> (<var>port? . objects</var>)<var><a name="index-port_003f-197"></a></var><br> +&mdash; Applicative: <b>port?</b> (<var>port? . objects</var>)<var><a name="index-port_003f-258"></a></var><br> <blockquote><p> The primitive type predicate for type port. <code>port?</code> returns true iff all the objects in <code>objects</code> are of type port. </p></blockquote></div> <div class="defun"> -&mdash; Applicative: <b>input-port?</b> (<var>input-port? . objects</var>)<var><a name="index-input_002dport_003f-198"></a></var><br> -&mdash; Applicative: <b>output-port?</b> (<var>output-port? . objects</var>)<var><a name="index-output_002dport_003f-199"></a></var><br> +&mdash; Applicative: <b>input-port?</b> (<var>input-port? . objects</var>)<var><a name="index-input_002dport_003f-259"></a></var><br> +&mdash; Applicative: <b>output-port?</b> (<var>output-port? . objects</var>)<var><a name="index-output_002dport_003f-260"></a></var><br> <blockquote><p> Applicative <code>input-port?</code> is a predicate that returns true unless one or more of its arguments is not an input port. Applicative output-port? is a predicate that returns true unless one or more of @@ -70,8 +70,8 @@ its arguments is not an output port. </p></blockquote></div> <div class="defun"> -&mdash; with-input-from-file: <b>(</b><var>with-input-from-file string combiner</var>)<var><a name="index-g_t_0028-200"></a></var><br> -&mdash; with-output-to-file: <b>(</b><var>with-output-to-file string combiner</var>)<var><a name="index-g_t_0028-201"></a></var><br> +&mdash; with-input-from-file: <b>(</b><var>with-input-from-file string combiner</var>)<var><a name="index-g_t_0028-261"></a></var><br> +&mdash; with-output-to-file: <b>(</b><var>with-output-to-file string combiner</var>)<var><a name="index-g_t_0028-262"></a></var><br> <blockquote><!-- add xref get-current-input-port/get-current-output-port --> <p>These two applicatives open the file named in <code>string</code> for input or output, an invoke the binder of the input-port &amp; output-port @@ -88,8 +88,8 @@ klisp implementation in the near future. </p></blockquote></div> <div class="defun"> -&mdash; get-current-input-port: <b>(</b><var>get-current-input-port</var>)<var><a name="index-g_t_0028-202"></a></var><br> -&mdash; get-current-output-port: <b>(</b><var>get-current-output-port</var>)<var><a name="index-g_t_0028-203"></a></var><br> +&mdash; get-current-input-port: <b>(</b><var>get-current-input-port</var>)<var><a name="index-g_t_0028-263"></a></var><br> +&mdash; get-current-output-port: <b>(</b><var>get-current-output-port</var>)<var><a name="index-g_t_0028-264"></a></var><br> <blockquote><p> These are the accessors for the input-port and output-port keyed dynamic variables repectively. <!-- add xref to with-input-from-file, etc --> @@ -102,7 +102,7 @@ klisp implementation in the near future. </p></blockquote></div> <div class="defun"> -&mdash; Applicative: <b>open-input-file</b> (<var>open-input-file string</var>)<var><a name="index-open_002dinput_002dfile-204"></a></var><br> +&mdash; Applicative: <b>open-input-file</b> (<var>open-input-file string</var>)<var><a name="index-open_002dinput_002dfile-265"></a></var><br> <blockquote><p> <code>string</code> should be the name/path for an existing file. <p>Applicative <code>open-input-file</code> creates and returns an input port @@ -115,7 +115,7 @@ still missing. </p></blockquote></div> <div class="defun"> -&mdash; Applicative: <b>open-output-file</b> (<var>open-output-file string</var>)<var><a name="index-open_002doutput_002dfile-205"></a></var><br> +&mdash; Applicative: <b>open-output-file</b> (<var>open-output-file string</var>)<var><a name="index-open_002doutput_002dfile-266"></a></var><br> <blockquote><p> <code>string</code> should be the name/path for an existing file. <p>Applicative <code>open-output-file</code> creates and returns an output @@ -132,8 +132,8 @@ still missing. </p></blockquote></div> <div class="defun"> -&mdash; close-input-file: <b>(</b><var>close-input-file input-port</var>)<var><a name="index-g_t_0028-206"></a></var><br> -&mdash; close-output-file: <b>(</b><var>close-output-file output-port</var>)<var><a name="index-g_t_0028-207"></a></var><br> +&mdash; close-input-file: <b>(</b><var>close-input-file input-port</var>)<var><a name="index-g_t_0028-267"></a></var><br> +&mdash; close-output-file: <b>(</b><var>close-output-file output-port</var>)<var><a name="index-g_t_0028-268"></a></var><br> <blockquote><p> These applicatives close the port argument, so that no more input/output may be performed on them, and the resources can be freed. If the port was already closed these applicatives have no @@ -148,7 +148,7 @@ probably be called close-input-port &amp; close-output-port. </p></blockquote></div> <div class="defun"> -&mdash; Applicative: <b>read</b> (<var>read </var>[<var>input-port</var>])<var><a name="index-read-208"></a></var><br> +&mdash; Applicative: <b>read</b> (<var>read </var>[<var>input-port</var>])<var><a name="index-read-269"></a></var><br> <blockquote><p> If the <code>port</code> optional argument is not specified, then the value of the <code>input-port</code> keyed dynamic variable is used. If the port is closed, an error is signaled. @@ -164,7 +164,7 @@ still missing. </p></blockquote></div> <div class="defun"> -&mdash; write: <b>(</b><var>write object </var>[<var>port</var>])<var><a name="index-g_t_0028-209"></a></var><br> +&mdash; write: <b>(</b><var>write object </var>[<var>port</var>])<var><a name="index-g_t_0028-270"></a></var><br> <blockquote><p> If the <code>port</code> optional argument is not specified, then the value of the <code>output-port</code> keyed dynamic variable is used. If the port is closed, an error is signaled. @@ -182,8 +182,8 @@ still missing. </p></blockquote></div> <div class="defun"> -&mdash; Applicative: <b>call-with-input-file</b> (<var>call-with-input-file string combiner</var>)<var><a name="index-call_002dwith_002dinput_002dfile-210"></a></var><br> -&mdash; Applicative: <b>call-with-output-file</b> (<var>call-with-output-file string combiner</var>)<var><a name="index-call_002dwith_002doutput_002dfile-211"></a></var><br> +&mdash; Applicative: <b>call-with-input-file</b> (<var>call-with-input-file string combiner</var>)<var><a name="index-call_002dwith_002dinput_002dfile-271"></a></var><br> +&mdash; Applicative: <b>call-with-output-file</b> (<var>call-with-output-file string combiner</var>)<var><a name="index-call_002dwith_002doutput_002dfile-272"></a></var><br> <blockquote><p> These applicatives open file named in <code>string</code> and call their <code>combiner</code> argument in a fresh empty environment passing it as a sole operand the opened port. When/if the combiner normally returns a @@ -195,7 +195,7 @@ still missing. </p></blockquote></div> <div class="defun"> -&mdash; Applicative: <b>load</b> (<var>load string</var>)<var><a name="index-load-212"></a></var><br> +&mdash; Applicative: <b>load</b> (<var>load string</var>)<var><a name="index-load-273"></a></var><br> <blockquote><!-- TODO add xref, open/input, read --> <p>Applicative <code>load</code> opens for input a file named <code>string</code>; reads objects from the file until the end of the file is reached; @@ -211,7 +211,7 @@ return the value of the last evaluation. </p></blockquote></div> <div class="defun"> -&mdash; Applicative: <b>get-module</b> (<var>get-module string </var>[<var>environment</var>])<var><a name="index-get_002dmodule-213"></a></var><br> +&mdash; Applicative: <b>get-module</b> (<var>get-module string </var>[<var>environment</var>])<var><a name="index-get_002dmodule-274"></a></var><br> <blockquote><!-- TODO add xref standard-environment, open/input, read --> <p>Applicative <code>get-module</code> creates a fresh standard environment; opens for input a file named <code>string</code>; reads objects from the @@ -224,7 +224,7 @@ prior to evaluating read expressions, by binding symbol </p></blockquote></div> <div class="defun"> -&mdash; Applicative: <b>eof-object?</b> (<var>eof-object? . objects</var>)<var><a name="index-eof_002dobject_003f-214"></a></var><br> +&mdash; Applicative: <b>eof-object?</b> (<var>eof-object? . objects</var>)<var><a name="index-eof_002dobject_003f-275"></a></var><br> <blockquote><p> The primitive type predicate for type eof. <code>eof-object?</code> returns true iff all the objects in <code>objects</code> are of type eof. @@ -235,7 +235,7 @@ primitive type predicates. </p></blockquote></div> <div class="defun"> -&mdash; read-char: <b>(</b><var>read-char </var>[<var>port</var>])<var><a name="index-g_t_0028-215"></a></var><br> +&mdash; read-char: <b>(</b><var>read-char </var>[<var>port</var>])<var><a name="index-g_t_0028-276"></a></var><br> <blockquote><p> If the <code>port</code> optional argument is not specified, then the value of the <code>input-port</code> keyed dynamic variable is used. If the port is closed, an error is signaled. @@ -248,7 +248,7 @@ an eof if the end of file was reached. </p></blockquote></div> <div class="defun"> -&mdash; peek-char: <b>(</b><var>peek-char </var>[<var>port</var>])<var><a name="index-g_t_0028-216"></a></var><br> +&mdash; peek-char: <b>(</b><var>peek-char </var>[<var>port</var>])<var><a name="index-g_t_0028-277"></a></var><br> <blockquote><p> If the <code>port</code> optional argument is not specified, then the value of the <code>input-port</code> keyed dynamic variable is used. If the port is closed, an error is signaled. @@ -263,7 +263,7 @@ remains unchanged so that new call to <code>peek-char</code> or </p></blockquote></div> <div class="defun"> -&mdash; char-ready?: <b>(</b><var>char-ready? </var>[<var>port</var>])<var><a name="index-g_t_0028-217"></a></var><br> +&mdash; char-ready?: <b>(</b><var>char-ready? </var>[<var>port</var>])<var><a name="index-g_t_0028-278"></a></var><br> <blockquote><p> If the <code>port</code> optional argument is not specified, then the value of the <code>input-port</code> keyed dynamic variable is used. If the port is closed, an error is signaled. @@ -278,7 +278,7 @@ the code to do this is non-portable. </p></blockquote></div> <div class="defun"> -&mdash; write-char: <b>(</b><var>write-char char </var>[<var>port</var>])<var><a name="index-g_t_0028-218"></a></var><br> +&mdash; write-char: <b>(</b><var>write-char char </var>[<var>port</var>])<var><a name="index-g_t_0028-279"></a></var><br> <blockquote><p> If the <code>port</code> optional argument is not specified, then the value of the <code>output-port</code> keyed dynamic variable is used. If the port is closed, an error is signaled. @@ -291,7 +291,7 @@ The result returned by <code>write-char</code> is inert. </p></blockquote></div> <div class="defun"> -&mdash; newline: <b>(</b><var>newline </var>[<var>port</var>])<var><a name="index-g_t_0028-219"></a></var><br> +&mdash; newline: <b>(</b><var>newline </var>[<var>port</var>])<var><a name="index-g_t_0028-280"></a></var><br> <blockquote><p> If the <code>port</code> optional argument is not specified, then the value of the <code>output-port</code> keyed dynamic variable is used. If the port is closed, an error is signaled. @@ -303,7 +303,7 @@ The result returned by <code>newline</code> is inert. </p></blockquote></div> <div class="defun"> -&mdash; display: <b>(</b><var>display object </var>[<var>port</var>])<var><a name="index-g_t_0028-220"></a></var><br> +&mdash; display: <b>(</b><var>display object </var>[<var>port</var>])<var><a name="index-g_t_0028-281"></a></var><br> <blockquote><p> If the <code>port</code> optional argument is not specified, then the value of the <code>output-port</code> keyed dynamic variable is used. If the port is closed, an error is signaled. diff --git a/manual/html/Strings.html b/manual/html/Strings.html @@ -34,7 +34,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a> <!-- node-name, next, previous, up --> <h2 class="chapter">14 Strings</h2> -<p><a name="index-strings-151"></a> +<p><a name="index-strings-212"></a> A string is an object that represent a sequence of characters (for now, only ASCII is supported in klisp, in the future, full UNICODE will be supported). The external representation of strings consists @@ -68,34 +68,34 @@ to a new type (like Java's StringBuilder/StringBuffer). But for now, compatibility with r5rs was preferred/simpler. <div class="defun"> -&mdash; Applicative: <b>string?</b> (<var>string? . objects</var>)<var><a name="index-string_003f-152"></a></var><br> +&mdash; Applicative: <b>string?</b> (<var>string? . objects</var>)<var><a name="index-string_003f-213"></a></var><br> <blockquote><p> The primitive type predicate for type string. <code>string?</code> returns true iff all the objects in <code>objects</code> are of type string. </p></blockquote></div> <div class="defun"> -&mdash; Applicative: <b>string=?</b> (<var>string=? . strings</var>)<var><a name="index-string_003d_003f-153"></a></var><br> -&mdash; Applicative: <b>string&lt;?</b> (<var>string&lt;? . strings</var>)<var><a name="index-string_003c_003f-154"></a></var><br> -&mdash; Applicative: <b>string&lt;=?</b> (<var>string&lt;=? . strings</var>)<var><a name="index-string_003c_003d_003f-155"></a></var><br> -&mdash; Applicative: <b>string&gt;?</b> (<var>string&gt;? . strings</var>)<var><a name="index-string_003e_003f-156"></a></var><br> -&mdash; Applicative: <b>string&gt;=?</b> (<var>string&gt;=? . strings</var>)<var><a name="index-string_003e_003d_003f-157"></a></var><br> +&mdash; Applicative: <b>string=?</b> (<var>string=? . strings</var>)<var><a name="index-string_003d_003f-214"></a></var><br> +&mdash; Applicative: <b>string&lt;?</b> (<var>string&lt;? . strings</var>)<var><a name="index-string_003c_003f-215"></a></var><br> +&mdash; Applicative: <b>string&lt;=?</b> (<var>string&lt;=? . strings</var>)<var><a name="index-string_003c_003d_003f-216"></a></var><br> +&mdash; Applicative: <b>string&gt;?</b> (<var>string&gt;? . strings</var>)<var><a name="index-string_003e_003f-217"></a></var><br> +&mdash; Applicative: <b>string&gt;=?</b> (<var>string&gt;=? . strings</var>)<var><a name="index-string_003e_003d_003f-218"></a></var><br> <blockquote><p> These predicates compare any number of strings by their lexicographic order. </p></blockquote></div> <div class="defun"> -&mdash; Applicative: <b>string-ci=?</b> (<var>string-ci=? . strings</var>)<var><a name="index-string_002dci_003d_003f-158"></a></var><br> -&mdash; Applicative: <b>string-ci&lt;?</b> (<var>string-ci&lt;? . strings</var>)<var><a name="index-string_002dci_003c_003f-159"></a></var><br> -&mdash; Applicative: <b>string-ci&lt;=?</b> (<var>string-ci&lt;=? . strings</var>)<var><a name="index-string_002dci_003c_003d_003f-160"></a></var><br> -&mdash; Applicative: <b>string-ci&gt;?</b> (<var>string-ci&gt;? . strings</var>)<var><a name="index-string_002dci_003e_003f-161"></a></var><br> -&mdash; Applicative: <b>string-ci&gt;=?</b> (<var>string-ci&gt;=? . strings</var>)<var><a name="index-string_002dci_003e_003d_003f-162"></a></var><br> +&mdash; Applicative: <b>string-ci=?</b> (<var>string-ci=? . strings</var>)<var><a name="index-string_002dci_003d_003f-219"></a></var><br> +&mdash; Applicative: <b>string-ci&lt;?</b> (<var>string-ci&lt;? . strings</var>)<var><a name="index-string_002dci_003c_003f-220"></a></var><br> +&mdash; Applicative: <b>string-ci&lt;=?</b> (<var>string-ci&lt;=? . strings</var>)<var><a name="index-string_002dci_003c_003d_003f-221"></a></var><br> +&mdash; Applicative: <b>string-ci&gt;?</b> (<var>string-ci&gt;? . strings</var>)<var><a name="index-string_002dci_003e_003f-222"></a></var><br> +&mdash; Applicative: <b>string-ci&gt;=?</b> (<var>string-ci&gt;=? . strings</var>)<var><a name="index-string_002dci_003e_003d_003f-223"></a></var><br> <blockquote><p> These predicates convert the strings to lowercase and then compare them using their lexicographic order. </p></blockquote></div> <div class="defun"> -&mdash; Applicative: <b>make-string</b> (<var>make-string k </var>[<var>char</var>])<var><a name="index-make_002dstring-163"></a></var><br> +&mdash; Applicative: <b>make-string</b> (<var>make-string k </var>[<var>char</var>])<var><a name="index-make_002dstring-224"></a></var><br> <blockquote><p> Applicative <code>make-string</code> constructs and returns a new mutable string of length <code>k</code>. If <code>char</code> is specified, then all characters in the returned string are <code>char</code>, otherwise the @@ -103,19 +103,19 @@ content of the string is unspecified. </p></blockquote></div> <div class="defun"> -&mdash; Applicative: <b>string</b> (<var>string . chars</var>)<var><a name="index-string-164"></a></var><br> +&mdash; Applicative: <b>string</b> (<var>string . chars</var>)<var><a name="index-string-225"></a></var><br> <blockquote><p> Applicative <code>string</code> contructs and return a new mutable string composed of the character arguments. </p></blockquote></div> <div class="defun"> -&mdash; Applicative: <b>string-length</b> (<var>string-length string</var>)<var><a name="index-string_002dlength-165"></a></var><br> +&mdash; Applicative: <b>string-length</b> (<var>string-length string</var>)<var><a name="index-string_002dlength-226"></a></var><br> <blockquote><p> Applicative <code>string-length</code> returns the length of <code>string</code>. </p></blockquote></div> <div class="defun"> -&mdash; Applicative: <b>string-ref</b> (<var>string-ref string k</var>)<var><a name="index-string_002dref-166"></a></var><br> +&mdash; Applicative: <b>string-ref</b> (<var>string-ref string k</var>)<var><a name="index-string_002dref-227"></a></var><br> <blockquote><p> Applicative <code>string-ref</code> returns the character of <code>string</code> at position <code>k</code>. If <code>k</code> is out of bounds (i.e. less than <code>0</code> or greater or equal than <code>(length string)</code>) an error is @@ -123,21 +123,21 @@ signaled. </p></blockquote></div> <div class="defun"> -&mdash; Applicative: <b>string-set!</b> (<var>string-set! string k char</var>)<var><a name="index-string_002dset_0021-167"></a></var><br> +&mdash; Applicative: <b>string-set!</b> (<var>string-set! string k char</var>)<var><a name="index-string_002dset_0021-228"></a></var><br> <blockquote><p> Applicative <code>string-set!</code> replaces the character with index <code>k</code> in <code>string</code> with character <code>char</code>. If <code>k</code> is out of bounds, or <code>string</code> is immutable, an error is signaled. </p></blockquote></div> <div class="defun"> -&mdash; Applicative: <b>string-fill!</b> (<var>string-fill! string char</var>)<var><a name="index-string_002dfill_0021-168"></a></var><br> +&mdash; Applicative: <b>string-fill!</b> (<var>string-fill! string char</var>)<var><a name="index-string_002dfill_0021-229"></a></var><br> <blockquote><p> Applicative <code>string-fill!</code> replaces all the characters in <code>string</code> with character <code>char</code>. If <code>string</code> is an immutable string, an error is signaled. </p></blockquote></div> <div class="defun"> -&mdash; Applicative: <b>substring</b> (<var>substring string k1 k2</var>)<var><a name="index-substring-169"></a></var><br> +&mdash; Applicative: <b>substring</b> (<var>substring string k1 k2</var>)<var><a name="index-substring-230"></a></var><br> <blockquote><p> Both <code>k1</code> &amp; <code>k2</code> should be valid indexes in <code>string</code>. Also it should be the case that <code>k1 &lt;= k2</code>. @@ -148,27 +148,27 @@ index <code>k2</code> (exclusive). </p></blockquote></div> <div class="defun"> -&mdash; Applicative: <b>string-append</b> (<var>string-append . strings</var>)<var><a name="index-string_002dappend-170"></a></var><br> +&mdash; Applicative: <b>string-append</b> (<var>string-append . strings</var>)<var><a name="index-string_002dappend-231"></a></var><br> <blockquote><p> Applicative <code>string-append</code> constructs and returns a new mutable string consisting of the concatenation of all its arguments. </p></blockquote></div> <div class="defun"> -&mdash; Applicative: <b>string-copy</b> (<var>string-copy string</var>)<var><a name="index-string_002dcopy-171"></a></var><br> +&mdash; Applicative: <b>string-copy</b> (<var>string-copy string</var>)<var><a name="index-string_002dcopy-232"></a></var><br> <blockquote><p> Applicative <code>string-copy</code> constructs and returns a new mutable string with the same length and characters as <code>string</code>. </p></blockquote></div> <div class="defun"> -&mdash; Applicative: <b>string-&gt;immutable-string</b> (<var>string-&gt;immutable-string string</var>)<var><a name="index-string_002d_003eimmutable_002dstring-172"></a></var><br> +&mdash; Applicative: <b>string-&gt;immutable-string</b> (<var>string-&gt;immutable-string string</var>)<var><a name="index-string_002d_003eimmutable_002dstring-233"></a></var><br> <blockquote><p> Applicative <code>string-&gt;immutable-string</code> constructs and returns a new immutable string with the same length and characters as <code>string</code>. </p></blockquote></div> <div class="defun"> -&mdash; Applicative: <b>string-&gt;list</b> (<var>string-&gt;list string</var>)<var><a name="index-string_002d_003elist-173"></a></var><br> -&mdash; Applicative: <b>list-&gt;string</b> (<var>list-&gt;string chars</var>)<var><a name="index-list_002d_003estring-174"></a></var><br> +&mdash; Applicative: <b>string-&gt;list</b> (<var>string-&gt;list string</var>)<var><a name="index-string_002d_003elist-234"></a></var><br> +&mdash; Applicative: <b>list-&gt;string</b> (<var>list-&gt;string chars</var>)<var><a name="index-list_002d_003estring-235"></a></var><br> <blockquote><p> Applicatives <code>string-&gt;list</code> and <code>list-&gt;string</code> convert between strings and list of characters. The strings returned by <code>list-&gt;string</code> are mutable. diff --git a/manual/klisp.info b/manual/klisp.info @@ -1565,6 +1565,392 @@ File: klisp.info, Node: Numbers, Next: Strings, Prev: Keyed Variables, Up: T 13 Numbers ********** +All numbers are immutable, and `equal?' iff `eq?'. The number type is +encapsulated. + + The external representation of an undefined number is `#undefined'. +The external representation of a real with no primary value is `#real' +(but this may change in the future, the report is missing the output +representation for reals with no primary values). All other rules for +externally representing numbers pertain only to defined numbers with +primary values. + + An external representation of a real number consists of optional +radix and/or exactness prefixes, optional sign (`+' or `-'), and +magnitude. The radix prefixes are `#b' (binary), `#o' (octal), `#d' +(decimal), and `#x' (hexadecimal); the default is decimal. The +exactness prefixes are `#e' (exact) and `#i' (inexact); by default, the +number is inexact iff the magnitude representation uses floating point. +If both kinds of prefixes are used, they may occur in either order. The +magnitude is either `infinity'; an unsigned integer (nonempty sequence +of digits); a ratio of unsigned integers (two unsigned integers with a +`/' between, of which the second is non-zero); or a floating point +representation. If the magnitude is `infinity', there must be an +exactness prefix and a sign, and no radix prefix. Floating point +representation can only be used with decimal radix; it consists of +nonempty integer part, point (`.'), nonempty fraction part, and +optional exponent part. The optional exponent part consists of an +exponent letter, and an (optionally signed) integer indicating a power +of ten by which to multiply the magnitude. The choice of exponent +letter makes no difference in what mathematical number is indicated by +the external representation, but does indicate internal representation +precision. Exponent letters `s', `f', `d', `f' indicate preference for +successively higher internal precision - short, float, double, long. +When reading an inexact real number, exponent letter `e' accepts the +default internal precision, which must be at least double. When +writeing an inexact real number, exponent letter `e' may be used for +the default internal precision, and must be used for any internal +number format not indicated by any of the other exponent letters. +Float and double must provide, respectively, at least as much precision +as IEEE 32-bit and 64-bit floating point standards [IE85]. For +example, `#i#xa/c' represents an inexact number using hexadecimal +notation, with signed magnitude positive five sixths (ten over twelve). +`-3.5l-2' represents an inexact number using decimal notation, with +signed magnitude negative thirty five thousandths, and requested long +precision (which must be at least IEEE 64-bit floating point). When +reading an external representation of an inexact real, the bounds on +the resulting inexact number are chosen in accordance with the +narrow-arithmetic keyed dynamic variable. + + NOTE: in klisp, all inexact numbers are stored as IEEE 64-bit +floating point. No bounding or robustness info is kept. + + -- Applicative: number? (number? . objects) + The primitive type predicate for type number. `number?' returns + true iff all the objects in `objects' are of type number. + + -- Applicative: integer? (integer? . objects) + The primitive type predicate for number subtype integer. + `integer?' returns true iff all the objects in `objects' are of + type integer. + + -- Applicative: rational? (rational? . objects) + The primitive type predicate for number subtype rational. + `rational?' returns true iff all the objects in `objects' are of + type rational. + + -- Applicative: real? (real? . objects) + The primitive type predicate for number subtype real. `real?' + returns true iff all the objects in `objects' are of type real. + + -- Applicative: finite? (finite? . numbers) + Predicate `finite?' returns true iff all the numbers in `numbers' + are finite. + + -- Applicative: exact? (exact? . numbers) + Predicate `exact?' returns true iff all the numbers in `numbers' + are exact. + + -- Applicative: inexact? (inexact? . numbers) + Predicate `inexact?' returns true iff all the numbers in `numbers' + are inexact. + + -- Applicative: robust? (robust? . numbers) + Predicate `robust?' returns true iff all the numbers in `numbers' + are robust. + + -- Applicative: undefined? (undefined? . numbers) + Predicate `undefined?' returns true iff all the numbers in + `numbers' are undefined. + + -- Applicative: =? (=? . numbers) + Applicative `=?' is a predicate that returns true iff all its + arguments are numerically equal to each other. If any of its + arguments has no primary value, an error is signaled. + + -- Applicative: <? (<? . reals) + -- Applicative: <=? (<=? . reals) + -- Applicative: >? (>? . reals) + -- Applicative: >=? (>=? . reals) + Each of these applicatives is a predicate that returns true iff + every two consecutive elements of `reals' have primary values in + the order indicated by the name of the applicative. If any + element of `reals' has no primary value, an error is signaled. + + -- Applicative: + (+ . numbers) + Applicative `+' returns the sum of the elements of numbers. If + numbers is empty, the sum of its elements is exact zero. If a + positive infinity is added to a negative infinity, the result has + no primary value. If all the elements of a cycle are zero, the + sum of the cycle is zero. If the acyclic sum of the elements of a + cycle (i.e., the sum of an acyclic list containing just those + elements) is non-zero, the sum of the cycle is positive infinity + times the acyclic sum of the elements. If the acyclic sum of the + elements of a cycle is zero, but some of the elements of the cycle + are non-zero, the sum of the cycle has no primary value. + + -- Applicative: * (* . numbers) + Applicative `*' returns the product of the elements of numbers. + If numbers is empty, the product of its elements is exact one. If + an infinity is multiplied by zero, the result has no primary + value. If the acyclic product of the elements of a cycle is real + greater than one, the product of the cycle is positive infinity. + If all the elements of a cycle are positive one, the product of + the cycle is positive one. If the acyclic product of the elements + of a cycle is positive one, but some of the elements of the cycle + are not positive one, the product of the cycle has no primary + value. If the acyclic product of the elements of a cycle has + magnitude less than one, the product of the cycle is zero. If the + acyclic product of the elements of a cycle has magnitude greater + than or equal to one, and is not positive real, the product of the + cycle has no primary value. + + -- Applicative: - (- number . numbers) + `numbers' should be a nonempty list of numbers. + + Applicative `-' returns the sum of `number' with the negation of + the sum of `numbers'. + + -- Applicative: zero? (zero? . numbers) + Applicative `zero?' is a predicate that returns true iff every + element of `numbers' is zero. For this purpose, a real number is + zero if its primary value is zero. If any element of numbers has + no primary value an error is signaled. + + -- Applicative: div (div real1 real2) + -- Applicative: mod (mod real1 real2) + -- Applicative: div-and-mod (div-and-mod real1 real2) + For all three applicatives, if `real1' is infinite or `real2' is + zero, an error is signaled. + + Let `n' be the greatest integer such that `real2 * n <= real1'. + Applicative `div' returns `n'. Applicative `mod' returns `real1 - + (real2 * n)'. Applicative `div-and-mod' returns a freshly + allocated list of length two, whose first element is `n' and whose + second element is `real1 - (real2 * n)'. + + NOTE: I'm not really sure about this description... + + -- Applicative: div0 (div0 real1 real2) + -- Applicative: mod0 (mod0 real1 real2) + -- Applicative: div0-and-mod0 (div0-and-mod0 real1 real2) + For all three applicatives, if `real1' is infinite or `real2' is + zero, an error is signaled. + + Let `n' be the greatest integer such that `real2 * n <= real1 + + |real2/2|'. Applicative `div0' returns `n'. Applicative `mod0' + returns `real1 - (real2 * n)'. Applicative `div0-and-mod0' + returns a freshly allocated list of length two, whose first + element is `n' and whose second element is `real1 - (real2 * n)'. + + NOTE: I'm not really sure about this description... + + -- Applicative: positive? (positive? . reals) + -- Applicative: negative? (negative? . reals) + Applicative `positive?' is a predicate that returns true iff every + element of `reals' is greater than zero. Applicative `negative?' + is a predicate that returns true iff every element of `reals' is + less than zero. If any argument to either applicative has no + primary value an error is signaled. + + -- Applicative: odd? (odd? . integers) + -- Applicative: even? (even? . integers) + Applicative `odd?' is a predicate that returns true iff every + element of `integers' is odd. Applicative `even?' is a predicate + that returns true iff every element of `integers' is even. If any + argument to either applicative has no primary value an error is + signaled. + + -- Applicative: (abs real) + Applicative `abs' returns the nonnegative real number with the + same magnitude as `real'; that is, if `real' is nonnegative it + returns `real', otherwise it returns the negation of `real'. + + -- Applicative: max (max . reals) + -- Applicative: min (min . reals) + If `reals' is nil, applicative `max' returns exact negative + infinity, and applicative `min' returns exact positive infinity. + If `reals' is non-nil, applicative `max' returns the largest + number in `reals', and applicative `min' returns the smallest + number in `reals'. + + -- Applicative: lcm (lcm . impints) + -- Applicative: gcd (gcd . impints) + `impints' should be a list of improper integers, that is, real + numbers each of which is either an integer or an infinity. + + Applicative `lcm' returns the smallest positive improper integer + that is an improper0integer multiple of every element of `impints' + (that is, smallest `n >= 1' such that for every argument `nk' + there exists `n'k' with `nk * n'k = n'). If any of the arguments + is zero, the result of `lcm' has no primary value. According to + these rules, `lcm' with nil argument list returns `1', and `lcm' + with any infinite argument returns positive infinity. + + Applicative `gcd' returns the largest positive improper integer + such that every element of `impints' is an improper-integer + multiple of it (that is, largest `n >= 1' such that for every + argument `nk' there exists `n'k' with `n * n'k = nk'). `gcd' with + nil argument list returns exact positive infinity. If `gcd' is + called with one or more arguments, and at least one of the + arguments is zero, but none of the arguments is a non-zero finite + integer, its result has no primary value. According to these + rules, if `gcd' is called with at least one finite non-zero + argument, its result is the same as if all zero and infinite + arguments were deleted. + + -- Applicative: get-real-internal-bounds (get-real-internal-bounds + real) + -- Applicative: get-real-exact-bounds (get-real-exact-bounds real) + Applicative `get-real-internal-bounds' returns a freshly allocated + list of reals `(x1 x2)', where the primary value of `x1' is the + lower bound of `real', using the same internal representation as + the primary value of `real', and the primary value of `x2' is the + upper bound of `real', using the same internal representation as + the primary value of `real'. The `xk' are inexact iff real is + inexact. The `xk' are robust (i.e., tagged if the implementation + supports such), and the bounds of each `xk' are only required to + contain its primary value (i.e., the implementation is allowed to + make the bounds equal to the primary value). + + Applicative `get-real-exact-bounds' returns a freshly allocated + list of exact reals `(x1 x2)', where `x1' is not greater than the + lower bound of `real', and `x2' is not less than the upper bound + of `real'. + + -- Applicative: get-real-internal-primary (get-real-internal-primary + real) + -- Applicative: get-real-exact-primary (get-real-exact-primary real) + If `real' is exact, both applicatives return `real'. If `real' + has no primary value, both applicatives signal an error. + + If `real' is inexact with a primary value, applicative + `get-real-internal-primary' returns a real number `x0' whose + primary value is the same as, and has the same internal format as, + the primary value of `real'. `x0' is robust, and its bounds are + only required to contain its primary value. + + If `real' is inexact with a primary value, applicative + `get-real-exact-primary' returns an exact real number `x0' within + the exact bounds that would be returned for `real' by applicative + `get-real-exact-bounds'. Preferably, `x0' should be as close to + the primary value of `real' as the implementation can reasonably + arrange. If the implementation does not support any exact `real' + that reasonably approximates `real', an error may be signaled. + + -- Applicative: make-inexact (make-inexact real1 real2 real3) + Applicative `make-inexact' returns an inexact real number, as + follows. If `real2' is inexact, the result has the same primary + value as `real2'; and if `real2' has no primary value, the result + has no primary value. The result has the same robustness as + `real2'. If possible, the result uses the same internal + representation as `real2'. If `real2' is exact, the primary value + of the result is as close to `real2' as the implementation can + reasonably arrange; overflow and underflow are handled as + described in .... The lower bound of the result is no greater than + the lower bound of `real1', the primary value of `real2', and the + primary value of the result. The upper bound of the result is no + less than the upper bound of `real3', the primary value of + `real2', and the primary value of the result. + + -- Applicative: real->inexact (real->inexact real) + -- Applicative: real->exact (real->exact real) + Applicative `real->exact' behaves just as `get-real-exact-primary'. + + If `real' is inexact, applicative `real->inexact' returns `real'. + If `real' is exact, applicative `real->inexact' returns an inexact + real `x0' such that `real' would be a permissible result of + passing `x0' to `real->exact'. If the implementation does not + support any such `x0', an error may be signaled. Otherwise, `x0' + is robust, and its bounds are only required to contain its primary + value and `real'. + + -- Applicative: with-strict-arithmetic (with-strict-arithmetic boolean + combiner) + -- Applicative: get-string-arithmetic (get-strict-arithmetic?) + These applicatives are the binder and accessor of the + `strict-arithmetic' keyed dynamic variable. When this keyed + variable is true, various survivable but dubious arithmetic events + signal an error - notably, operation results with no primary value, + and over- and underflows. + + -- Applicative: / (/ number . numbers) + `numbers' should be a nonempty list of numbers. + + Applicative `/' returns `number' divided by the product of + `numbers'. If the product of `numbers' is zero, an error is + signaled. If `number' is infinite and the product of `numbers' is + infinite, an error is signaled. + + -- Applicative: numerator (numerator rational) + -- Applicative: denominator (denominator rational) + These applicatives return the numerator and denominator of + `rational', in least terms (i.e., chosen for the least positive + denominator). Note that if `rational' is inexact, and either of + its bounds is not its primary value, the denominator has upper + bound positive infinity, and the numerator must have at least one + infinite bound (two infinite bounds if the bounds of rational + allow values of both signs). + + -- Applicative: floor (floor real) + -- Applicative: ceiling (ceiling real) + -- Applicative: truncate (truncate real) + -- Applicative: round (round real) + Applicative `floor' returns the largest integer not greater than + `real'. + + Applicative `ceiling' returns the smallest integer not less than + `real'. + + Applicative `truncate' returns the integer closest to `real' whose + absolute value is not greater than that of `real'. + + Applicative `round' returns the closest integer to `real', + rounding to even when `real' is halfway between two integers. + + -- Applicative: rationalize (rationalize real1 real2) + -- Applicative: simplest-rational (simplest-rational real1 real2) + A rational number `r1' is simpler than another rational `r2' if + `r1 = p1 / q1' and `r2 = p2 / q2', both in lowest terms, and `|p1| + <= |p2|' and `|q1| <= |q2|'. Thus `3/5' is simpler than `4/7'. Not + all rationals are comparable in this ordering, as for example + `2/7' and `3/5'. However, any interval (that contains rational + numbers) contains a rational number that is simpler than every + other rational number in that interval. Note that `0 = 0/1' is + simpler than any other rational (so that one never has to choose + between `p/q' and `−p/q'). + + For applicative `simplest-rational', let `x0' be the simplest + rational mathematically not less than the primary value of `real1' + and not greater than the primary value of `real2'. If no such + `x0' exists (because the primary value of `real1' is greater, or + because the primary values of the arguments are equal and + irrational), or if either argument does not have a primary value, + an error is signaled. + + For applicative `rationalize', let `x0' be the simplest rational + mathematical number within the interval bounded by the primary + value of `real1' plus and minus the primary value of `real2'. If + no such `x0' exists (because the primary value of `real1' is + irrational and the primary value `real2' is zero), or if either + argument does not have a primary value, an error is signaled. + + If `real1' and `real2' are exact, the applicative (whichever it + is) returns exact `x0'. If one or both of `real1' and `real2' are + inexact, the applicative returns an inexact rational approximating + `x0' (as by `real->inexact'. Note that an inexact result returned + is not necessarily bounded by the primary values of the arguments; + but the result is an approximation of `x0', which is so bounded, + and the bounds of the result include `x0'. + + -- Applicative: exp (exp number) + -- Applicative: log (log number) + TODO + + -- Applicative: sin (sin number) + -- Applicative: cos (cos number) + -- Applicative: tan (tan number) + TODO + + -- Applicative: asin (asin number) + -- Applicative: acos (acos number) + -- Applicative: atan (atan number1 [number2]) + TODO + + -- Applicative: sqrt (sqrt number) + -- Applicative: expt (expt number1 number2) + TODO +  File: klisp.info, Node: Strings, Next: Characters, Prev: Numbers, Up: Top @@ -2017,8 +2403,19 @@ Index * $set!: Environments. (line 182) * $vau: Combiners. (line 26) * ( <1>: Ports. (line 37) -* ( <2>: Continuations. (line 143) +* ( <2>: Numbers. (line 193) +* ( <3>: Continuations. (line 143) * (: Environments. (line 174) +* *: Numbers. (line 121) +* +: Numbers. (line 109) +* -: Numbers. (line 137) +* /: Numbers. (line 306) +* <=?: Numbers. (line 101) +* <?: Numbers. (line 100) +* =?: Numbers. (line 95) +* >=?: Numbers. (line 103) +* >?: Numbers. (line 102) +* acos: Numbers. (line 385) * and?: Booleans. (line 20) * append: Pairs and lists. (line 208) * append!: Pairs and lists. (line 306) @@ -2028,8 +2425,10 @@ Index * applicatives: Combiners. (line 6) * apply: Combiners. (line 83) * apply-continuation: Continuations. (line 134) +* asin: Numbers. (line 384) * assoc: Pairs and lists. (line 252) * assq: Pairs and lists. (line 333) +* atan: Numbers. (line 386) * boolean?: Booleans. (line 12) * booleans: Booleans. (line 6) * caaaar: Pairs and lists. (line 101) @@ -2065,6 +2464,7 @@ Index * cdddr: Pairs and lists. (line 100) * cddr: Pairs and lists. (line 92) * cdr: Pairs and lists. (line 86) +* ceiling: Numbers. (line 325) * char->integer: Characters. (line 58) * char-alphabetic?: Characters. (line 37) * char-ci<=?: Characters. (line 31) @@ -2094,9 +2494,15 @@ Index * control: Control. (line 6) * copy-es: Pairs and lists. (line 321) * copy-es-immutable!: Pairs and lists. (line 49) +* cos: Numbers. (line 380) * countable-list?: Pairs and lists. (line 265) +* denominator: Numbers. (line 315) * description format: Format of Descriptions. (line 6) +* div: Numbers. (line 149) +* div-and-mod: Numbers. (line 151) +* div0: Numbers. (line 163) +* div0-and-mod0: Numbers. (line 165) * documentation notation: Evaluation Notation. (line 6) * empty list: Pairs and lists. (line 6) * encapsulations: Encapsulations. (line 6) @@ -2111,30 +2517,45 @@ Index * error-continuation: Continuations. (line 110) * eval: Environments. (line 32) * evaluation notation: Evaluation Notation. (line 6) +* even?: Numbers. (line 186) +* exact?: Numbers. (line 79) * exit: Continuations. (line 162) +* exp: Numbers. (line 375) +* expt: Numbers. (line 390) * extend-continuation: Continuations. (line 50) * filter: Pairs and lists. (line 239) * finite-list?: Pairs and lists. (line 261) +* finite?: Numbers. (line 75) +* floor: Numbers. (line 324) * fonts: Some Terms. (line 13) * foo: A Sample Applicative Description. (line 15) * for-each: Control. (line 42) * force: Promises. (line 35) +* gcd: Numbers. (line 207) * get-current-environment: Environments. (line 114) * get-list-metrics: Pairs and lists. (line 123) * get-module: Ports. (line 156) +* get-real-exact-bounds: Numbers. (line 233) +* get-real-exact-primary: Numbers. (line 252) +* get-real-internal-bounds: Numbers. (line 232) +* get-real-internal-primary: Numbers. (line 251) +* get-string-arithmetic: Numbers. (line 299) * guard-continuation: Continuations. (line 63) * guard-dynamic-extent: Continuations. (line 156) * ignore: Environments. (line 6) * ignore?: Environments. (line 28) * inert: Control. (line 6) * inert?: Control. (line 11) +* inexact?: Numbers. (line 83) * input-port?: Ports. (line 27) * integer->char: Characters. (line 59) +* integer?: Numbers. (line 61) * Kernel history: Kernel History. (line 6) * keyed dynamic variables: Keyed Variables. (line 15) * keyed static variables: Keyed Variables. (line 40) * keyed variables: Keyed Variables. (line 6) +* lcm: Numbers. (line 206) * length: Pairs and lists. (line 191) * list: Pairs and lists. (line 72) * list*: Pairs and lists. (line 78) @@ -2144,23 +2565,33 @@ Index * list-tail: Pairs and lists. (line 147) * lists: Pairs and lists. (line 6) * load: Ports. (line 143) +* log: Numbers. (line 376) * make-encapsulation-type: Encapsulations. (line 12) * make-environment: Environments. (line 36) +* make-inexact: Numbers. (line 270) * make-kernel-standard-environment: Environments. (line 119) * make-keyed-dynamic-variable: Keyed Variables. (line 21) * make-keyed-static-variable: Keyed Variables. (line 44) * make-string: Strings. (line 57) * map <1>: Combiners. (line 96) * map: Pairs and lists. (line 169) +* max: Numbers. (line 198) * member?: Pairs and lists. (line 257) * memoize: Promises. (line 74) * memq?: Pairs and lists. (line 338) +* min: Numbers. (line 199) +* mod: Numbers. (line 150) +* mod0: Numbers. (line 164) +* negative?: Numbers. (line 178) * nil: Pairs and lists. (line 6) * not?: Booleans. (line 16) * null?: Pairs and lists. (line 31) +* number?: Numbers. (line 57) * numbers: Numbers. (line 6) +* numerator: Numbers. (line 314) * object descriptions: A Sample Applicative Description. (line 6) +* odd?: Numbers. (line 185) * open-input-file: Ports. (line 62) * open-output-file: Ports. (line 73) * operative descriptions: A Sample Applicative Description. @@ -2173,14 +2604,25 @@ Index * pairs: Pairs and lists. (line 6) * port?: Ports. (line 23) * ports: Ports. (line 6) +* positive?: Numbers. (line 177) * printing notation: Printing Notation. (line 6) * promise?: Promises. (line 31) * promises: Promises. (line 6) +* rational?: Numbers. (line 66) +* rationalize: Numbers. (line 340) * read: Ports. (line 102) +* real->exact: Numbers. (line 286) +* real->inexact: Numbers. (line 285) +* real?: Numbers. (line 71) * reduce: Pairs and lists. (line 270) +* robust?: Numbers. (line 87) * root-continuation: Continuations. (line 104) +* round: Numbers. (line 327) * set-car!: Pairs and lists. (line 41) * set-cdr!: Pairs and lists. (line 42) +* simplest-rational: Numbers. (line 341) +* sin: Numbers. (line 379) +* sqrt: Numbers. (line 389) * string: Strings. (line 63) * string->immutable-string: Strings. (line 103) * string->list: Strings. (line 108) @@ -2207,8 +2649,13 @@ Index * symbol->string: Symbols. (line 16) * symbol?: Symbols. (line 12) * symbols: Symbols. (line 6) +* tan: Numbers. (line 381) +* truncate: Numbers. (line 326) +* undefined?: Numbers. (line 91) * unwrap: Combiners. (line 72) +* with-strict-arithmetic: Numbers. (line 298) * wrap: Combiners. (line 68) +* zero?: Numbers. (line 143)  @@ -2238,9 +2685,9 @@ Node: Encapsulations63984 Node: Promises65437 Node: Keyed Variables69360 Node: Numbers72131 -Node: Strings72240 -Node: Characters77587 -Node: Ports80297 -Node: Index91582 +Node: Strings91630 +Node: Characters96977 +Node: Ports99687 +Node: Index110972  End Tag Table diff --git a/manual/src/numbers.texi b/manual/src/numbers.texi @@ -6,3 +6,461 @@ @chapter Numbers @cindex numbers + +All numbers are immutable, and @code{equal?} iff @code{eq?}. The +number type is encapsulated. + +@c TODO add more content on numbers + + The external representation of an undefined number is +@code{#undefined}. The external representation of a real with no +primary value is @code{#real} (but this may change in the future, the +report is missing the output representation for reals with no primary +values). All other rules for externally representing numbers pertain +only to defined numbers with primary values. + + An external representation of a real number consists of optional +radix and/or exactness prefixes, optional sign (@code{+} or @code{-}), +and magnitude. The radix prefixes are @code{#b} (binary), @code{#o} +(octal), @code{#d} (decimal), and @code{#x} (hexadecimal); the default +is decimal. The exactness prefixes are @code{#e} (exact) and +@code{#i} (inexact); by default, the number is inexact iff the +magnitude representation uses floating point. If both kinds of +prefixes are used, they may occur in either order. The magnitude is +either @code{infinity}; an unsigned integer (nonempty sequence of +digits); a ratio of unsigned integers (two unsigned integers with a +@code{/} between, of which the second is non-zero); or a floating +point representation. If the magnitude is @code{infinity}, there must +be an exactness prefix and a sign, and no radix prefix. Floating +point representation can only be used with decimal radix; it consists +of nonempty integer part, point (@code{.}), nonempty fraction part, +and optional exponent part. The optional exponent part consists of an +exponent letter, and an (optionally signed) integer indicating a power +of ten by which to multiply the magnitude. The choice of exponent +letter makes no difference in what mathematical number is indicated by +the external representation, but does indicate internal representation +precision. Exponent letters @code{s}, @code{f}, @code{d}, @code{f} +indicate preference for successively higher internal precision - +short, float, double, long. When reading an inexact real number, +exponent letter @code{e} accepts the default internal precision, which +must be at least double. When writeing an inexact real number, +exponent letter @code{e} may be used for the default internal +precision, and must be used for any internal number format not +indicated by any of the other exponent letters. Float and double must +provide, respectively, at least as much precision as IEEE 32-bit and +64-bit floating point standards [IE85]. For example, @code{#i#xa/c} +represents an inexact number using hexadecimal notation, with signed +magnitude positive five sixths (ten over twelve). @code{-3.5l-2} +represents an inexact number using decimal notation, with signed +magnitude negative thirty five thousandths, and requested long +precision (which must be at least IEEE 64-bit floating point). When +reading an external representation of an inexact real, the bounds on +the resulting inexact number are chosen in accordance with the +@c TODO add xref +narrow-arithmetic keyed dynamic variable. + +NOTE: in klisp, all inexact numbers are stored as IEEE 64-bit floating +point. No bounding or robustness info is kept. + +@deffn Applicative number? (number? . objects) + The primitive type predicate for type number. @code{number?} +returns true iff all the objects in @code{objects} are of type number. +@end deffn + +@deffn Applicative integer? (integer? . objects) + The primitive type predicate for number subtype integer. +@code{integer?} returns true iff all the objects in @code{objects} +are of type integer. +@end deffn + +@deffn Applicative rational? (rational? . objects) + The primitive type predicate for number subtype rational. +@code{rational?} returns true iff all the objects in @code{objects} +are of type rational. +@end deffn + +@deffn Applicative real? (real? . objects) + The primitive type predicate for number subtype real. +@code{real?} returns true iff all the objects in @code{objects} +are of type real. +@end deffn + +@deffn Applicative finite? (finite? . numbers) + Predicate @code{finite?} returns true iff all the numbers in +@code{numbers} are finite. +@end deffn + +@deffn Applicative exact? (exact? . numbers) + Predicate @code{exact?} returns true iff all the numbers in +@code{numbers} are exact. +@end deffn + +@deffn Applicative inexact? (inexact? . numbers) + Predicate @code{inexact?} returns true iff all the numbers in +@code{numbers} are inexact. +@end deffn + +@deffn Applicative robust? (robust? . numbers) + Predicate @code{robust?} returns true iff all the numbers in +@code{numbers} are robust. +@end deffn + +@deffn Applicative undefined? (undefined? . numbers) + Predicate @code{undefined?} returns true iff all the numbers in +@code{numbers} are undefined. +@end deffn + +@deffn Applicative =? (=? . numbers) + Applicative @code{=?} is a predicate that returns true iff all its +arguments are numerically equal to each other. If any of its +arguments has no primary value, an error is signaled. +@end deffn + +@deffn Applicative <? (<? . reals) +@deffnx Applicative <=? (<=? . reals) +@deffnx Applicative >? (>? . reals) +@deffnx Applicative >=? (>=? . reals) + Each of these applicatives is a predicate that returns true iff +every two consecutive elements of @code{reals} have primary values in +the order indicated by the name of the applicative. If any element of +@code{reals} has no primary value, an error is signaled. +@end deffn + +@deffn Applicative + (+ . numbers) + Applicative @code{+} returns the sum of the elements of numbers. If +numbers is empty, the sum of its elements is exact zero. If a +positive infinity is added to a negative infinity, the result has no +primary value. If all the elements of a cycle are zero, the sum of +the cycle is zero. If the acyclic sum of the elements of a cycle +(i.e., the sum of an acyclic list containing just those elements) is +non-zero, the sum of the cycle is positive infinity times the acyclic +sum of the elements. If the acyclic sum of the elements of a cycle is +zero, but some of the elements of the cycle are non-zero, the sum of +the cycle has no primary value. +@end deffn + +@deffn Applicative * (* . numbers) + Applicative @code{*} returns the product of the elements of numbers. +If numbers is empty, the product of its elements is exact one. If an +infinity is multiplied by zero, the result has no primary value. If +the acyclic product of the elements of a cycle is real greater than +one, the product of the cycle is positive infinity. If all the +elements of a cycle are positive one, the product of the cycle is +positive one. If the acyclic product of the elements of a cycle is +positive one, but some of the elements of the cycle are not positive +one, the product of the cycle has no primary value. If the acyclic +product of the elements of a cycle has magnitude less than one, the +product of the cycle is zero. If the acyclic product of the elements +of a cycle has magnitude greater than or equal to one, and is not +positive real, the product of the cycle has no primary value. +@end deffn + +@deffn Applicative - (- number . numbers) + @code{numbers} should be a nonempty list of numbers. + + Applicative @code{-} returns the sum of @code{number} with the +negation of the sum of @code{numbers}. +@end deffn + +@deffn Applicative zero? (zero? . numbers) + Applicative @code{zero?} is a predicate that returns true iff every +element of @code{numbers} is zero. For this purpose, a real number is +zero if its primary value is zero. If any element of numbers has no +primary value an error is signaled. +@end deffn + +@deffn Applicative div (div real1 real2) +@deffnx Applicative mod (mod real1 real2) +@deffnx Applicative div-and-mod (div-and-mod real1 real2) + For all three applicatives, if @code{real1} is infinite or +@code{real2} is zero, an error is signaled. + + Let @code{n} be the greatest integer such that @code{real2 * n <= +real1}. Applicative @code{div} returns @code{n}. Applicative +@code{mod} returns @code{real1 - (real2 * n)}. Applicative +@code{div-and-mod} returns a freshly allocated list of length two, +whose first element is @code{n} and whose second element is +@code{real1 - (real2 * n)}. + + NOTE: I'm not really sure about this description... +@end deffn + +@deffn Applicative div0 (div0 real1 real2) +@deffnx Applicative mod0 (mod0 real1 real2) +@deffnx Applicative div0-and-mod0 (div0-and-mod0 real1 real2) + For all three applicatives, if @code{real1} is infinite or +@code{real2} is zero, an error is signaled. + + Let @code{n} be the greatest integer such that @code{real2 * n <= +real1 + |real2/2|}. Applicative @code{div0} returns @code{n}. +Applicative @code{mod0} returns @code{real1 - (real2 * n)}. +Applicative @code{div0-and-mod0} returns a freshly allocated list of +length two, whose first element is @code{n} and whose second element +is @code{real1 - (real2 * n)}. + + NOTE: I'm not really sure about this description... +@end deffn + +@deffn Applicative positive? (positive? . reals) +@deffnx Applicative negative? (negative? . reals) + Applicative @code{positive?} is a predicate that returns true iff +every element of @code{reals} is greater than zero. Applicative +@code{negative?} is a predicate that returns true iff every element of +@code{reals} is less than zero. If any argument to either applicative +has no primary value an error is signaled. +@end deffn + +@deffn Applicative odd? (odd? . integers) +@deffnx Applicative even? (even? . integers) + Applicative @code{odd?} is a predicate that returns true iff every +element of @code{integers} is odd. Applicative @code{even?} is a +predicate that returns true iff every element of @code{integers} is +even. If any argument to either applicative has no primary value an +error is signaled. +@end deffn + +@deffn Applicative (abs real) + Applicative @code{abs} returns the nonnegative real number with the +same magnitude as @code{real}; that is, if @code{real} is nonnegative +it returns @code{real}, otherwise it returns the negation of +@code{real}. +@end deffn + +@deffn Applicative max (max . reals) +@deffnx Applicative min (min . reals) + If @code{reals} is nil, applicative @code{max} returns exact +negative infinity, and applicative @code{min} returns exact positive +infinity. If @code{reals} is non-nil, applicative @code{max} returns +the largest number in @code{reals}, and applicative @code{min} returns +the smallest number in @code{reals}. +@end deffn + + +@deffn Applicative lcm (lcm . impints) +@deffnx Applicative gcd (gcd . impints) + @code{impints} should be a list of improper integers, that is, real +numbers each of which is either an integer or an infinity. + + Applicative @code{lcm} returns the smallest positive improper +integer that is an improper0integer multiple of every element of +@code{impints} (that is, smallest @code{n >= 1} such that for every +argument @code{nk} there exists @code{n'k} with @code{nk * n'k = n}). +If any of the arguments is zero, the result of @code{lcm} has no +primary value. According to these rules, @code{lcm} with nil argument +list returns @code{1}, and @code{lcm} with any infinite argument +returns positive infinity. + + Applicative @code{gcd} returns the largest positive improper integer +such that every element of @code{impints} is an improper-integer +multiple of it (that is, largest @code{n >= 1} such that for every +argument @code{nk} there exists @code{n'k} with @code{n * n'k = nk}). +@code{gcd} with nil argument list returns exact positive infinity. If +@code{gcd} is called with one or more arguments, and at least one of +the arguments is zero, but none of the arguments is a non-zero finite +integer, its result has no primary value. According to these rules, +if @code{gcd} is called with at least one finite non-zero argument, +its result is the same as if all zero and infinite arguments were +deleted. +@end deffn + +@deffn Applicative get-real-internal-bounds (get-real-internal-bounds real) +@deffnx Applicative get-real-exact-bounds (get-real-exact-bounds real) + Applicative @code{get-real-internal-bounds} returns a freshly +allocated list of reals @code{(x1 x2)}, where the primary value of +@code{x1} is the lower bound of @code{real}, using the same internal +representation as the primary value of @code{real}, and the primary +value of @code{x2} is the upper bound of @code{real}, using the same +internal representation as the primary value of @code{real}. The +@code{xk} are inexact iff real is inexact. The @code{xk} are robust +(i.e., tagged if the implementation supports such), and the bounds of +each @code{xk} are only required to contain its primary value (i.e., +the implementation is allowed to make the bounds equal to the primary +value). + + Applicative @code{get-real-exact-bounds} returns a freshly allocated +list of exact reals @code{(x1 x2)}, where @code{x1} is not greater +than the lower bound of @code{real}, and @code{x2} is not less than +the upper bound of @code{real}. +@end deffn + +@deffn Applicative get-real-internal-primary (get-real-internal-primary real) +@deffnx Applicative get-real-exact-primary (get-real-exact-primary real) + If @code{real} is exact, both applicatives return @code{real}. If +@code{real} has no primary value, both applicatives signal an error. + + If @code{real} is inexact with a primary value, applicative +@code{get-real-internal-primary} returns a real number @code{x0} whose +primary value is the same as, and has the same internal format as, the +primary value of @code{real}. @code{x0} is robust, and its bounds are +only required to contain its primary value. + +@c TODO add xref to get-real-exact-bounds + If @code{real} is inexact with a primary value, applicative +@code{get-real-exact-primary} returns an exact real number @code{x0} +within the exact bounds that would be returned for @code{real} by +applicative @code{get-real-exact-bounds}. Preferably, @code{x0} +should be as close to the primary value of @code{real} as the +implementation can reasonably arrange. If the implementation does not +support any exact @code{real} that reasonably approximates +@code{real}, an error may be signaled. +@end deffn + +@deffn Applicative make-inexact (make-inexact real1 real2 real3) + Applicative @code{make-inexact} returns an inexact real number, as +follows. If @code{real2} is inexact, the result has the same primary +value as @code{real2}; and if @code{real2} has no primary value, the +result has no primary value. The result has the same robustness as +@code{real2}. If possible, the result uses the same internal +representation as @code{real2}. If @code{real2} is exact, the primary +value of the result is as close to @code{real2} as the implementation +can reasonably arrange; overflow and underflow are handled as +@c TODO add xref to overflow +described in .... The lower bound of the result is no greater than +the lower bound of @code{real1}, the primary value of @code{real2}, +and the primary value of the result. The upper bound of the result is +no less than the upper bound of @code{real3}, the primary value of +@code{real2}, and the primary value of the result. +@end deffn + +@deffn Applicative real->inexact (real->inexact real) +@deffnx Applicative real->exact (real->exact real) +@c TODO add xref to get-real-exact-primary + Applicative @code{real->exact} behaves just as +@code{get-real-exact-primary}. + + If @code{real} is inexact, applicative @code{real->inexact} returns +@code{real}. If @code{real} is exact, applicative +@code{real->inexact} returns an inexact real @code{x0} such that +@code{real} would be a permissible result of passing @code{x0} to +@code{real->exact}. If the implementation does not support any such +@code{x0}, an error may be signaled. Otherwise, @code{x0} is robust, +and its bounds are only required to contain its primary value and +@code{real}. +@end deffn + +@deffn Applicative with-strict-arithmetic (with-strict-arithmetic boolean combiner) +@deffnx Applicative get-string-arithmetic (get-strict-arithmetic?) +@c TODO add xref to dynamic keys and under/over flow, no prim value + These applicatives are the binder and accessor of the +@code{strict-arithmetic} keyed dynamic variable. When this keyed +variable is true, various survivable but dubious arithmetic events +signal an error - notably, operation results with no primary value, +and over- and underflows. +@end deffn + +@deffn Applicative / (/ number . numbers) + @code{numbers} should be a nonempty list of numbers. + + Applicative @code{/} returns @code{number} divided by the product of +@code{numbers}. If the product of @code{numbers} is zero, an error is +signaled. If @code{number} is infinite and the product of @code{numbers} is +infinite, an error is signaled. +@end deffn + +@deffn Applicative numerator (numerator rational) +@deffnx Applicative denominator (denominator rational) + These applicatives return the numerator and denominator of +@code{rational}, in least terms (i.e., chosen for the least positive +denominator). Note that if @code{rational} is inexact, and either of +its bounds is not its primary value, the denominator has upper bound +positive infinity, and the numerator must have at least one infinite +bound (two infinite bounds if the bounds of rational allow values of +both signs). +@end deffn + + +@deffn Applicative floor (floor real) +@deffnx Applicative ceiling (ceiling real) +@deffnx Applicative truncate (truncate real) +@deffnx Applicative round (round real) + Applicative @code{floor} returns the largest integer not greater +than @code{real}. + + Applicative @code{ceiling} returns the smallest integer not less +than @code{real}. + + Applicative @code{truncate} returns the integer closest to +@code{real} whose absolute value is not greater than that of +@code{real}. + + Applicative @code{round} returns the closest integer to @code{real}, +rounding to even when @code{real} is halfway between two integers. +@end deffn + +@deffn Applicative rationalize (rationalize real1 real2) +@deffnx Applicative simplest-rational (simplest-rational real1 real2) + A rational number @code{r1} is simpler than another rational +@code{r2} if @code{r1 = p1 / q1} and @code{r2 = p2 / q2}, both in +lowest terms, and @code{|p1| <= |p2|} and @code{|q1| <= |q2|}. Thus +@code{3/5} is simpler than @code{4/7}. Not all rationals are +comparable in this ordering, as for example @code{2/7} and @code{3/5}. +However, any interval (that contains rational numbers) contains a +rational number that is simpler than every other rational number in +that interval. Note that @code{0 = 0/1} is simpler than any other +rational (so that one never has to choose between @code{p/q} and +@code{−p/q}). + + For applicative @code{simplest-rational}, let @code{x0} be the +simplest rational mathematically not less than the primary value of +@code{real1} and not greater than the primary value of @code{real2}. +If no such @code{x0} exists (because the primary value of @code{real1} +is greater, or because the primary values of the arguments are equal +and irrational), or if either argument does not have a primary value, +an error is signaled. + + For applicative @code{rationalize}, let @code{x0} be the simplest +rational mathematical number within the interval bounded by the +primary value of @code{real1} plus and minus the primary value of +@code{real2}. If no such @code{x0} exists (because the primary value +of @code{real1} is irrational and the primary value @code{real2} is +zero), or if either argument does not have a primary value, an error +is signaled. + +@c TODO add xref to real->inexact + If @code{real1} and @code{real2} are exact, the applicative +(whichever it is) returns exact @code{x0}. If one or both of +@code{real1} and @code{real2} are inexact, the applicative returns an +inexact rational approximating @code{x0} (as by @code{real->inexact}. +Note that an inexact result returned is not necessarily bounded by the +primary values of the arguments; but the result is an approximation of +@code{x0}, which is so bounded, and the bounds of the result include +@code{x0}. +@end deffn + +@deffn Applicative exp (exp number) +@deffnx Applicative log (log number) +TODO +@end deffn + + +@deffn Applicative sin (sin number) +@deffnx Applicative cos (cos number) +@deffnx Applicative tan (tan number) +TODO +@end deffn + +@deffn Applicative asin (asin number) +@deffnx Applicative acos (acos number) +@deffnx Applicative atan (atan number1 [number2]) +TODO +@end deffn + +@deffn Applicative sqrt (sqrt number) +@deffnx Applicative expt (expt number1 number2) +TODO +@end deffn + + + + + + + + + + + + + + +