commit 7594257e3af614efb6268cc3e636d60656b58980
parent ded69756a89eff8213c621186197225fba9cbbe6
Author: Andres Navarro <canavarro82@gmail.com>
Date: Tue, 7 Jun 2011 17:33:14 -0300
Completed section characters in the manual.
Diffstat:
5 files changed, 285 insertions(+), 40 deletions(-)
diff --git a/manual/html/Characters.html b/manual/html/Characters.html
@@ -35,6 +35,80 @@ Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a>
<h2 class="chapter">15 Characters</h2>
<p><a name="index-characters-152"></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
+consists of a leading “#\” and the character or character name. The
+only supported names for now are “newline” and “space” (both from
+r5rs scheme). Characters are immutable. The character type is
+encapsulated.
+
+ <p>SOURCE NOTE: This section is still missing from the report. The
+features defined here were taken mostly from r5rs scheme.
+
+<div class="defun">
+— Applicative: <b>char?</b> (<var>char? . objects</var>)<var><a name="index-char_003f-153"></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">
+— Applicative: <b>char=?</b> (<var>char=? . chars</var>)<var><a name="index-char_003d_003f-154"></a></var><br>
+— Applicative: <b>char<?</b> (<var>char<? . chars</var>)<var><a name="index-char_003c_003f-155"></a></var><br>
+— Applicative: <b>char<=?</b> (<var>char<=? . chars</var>)<var><a name="index-char_003c_003d_003f-156"></a></var><br>
+— Applicative: <b>char>?</b> (<var>char>? . chars</var>)<var><a name="index-char_003e_003f-157"></a></var><br>
+— Applicative: <b>char>=?</b> (<var>char>=? . chars</var>)<var><a name="index-char_003e_003d_003f-158"></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">
+— Applicative: <b>char-ci=?</b> (<var>char-ci=? . chars</var>)<var><a name="index-char_002dci_003d_003f-159"></a></var><br>
+— Applicative: <b>char-ci<?</b> (<var>char-ci<? . chars</var>)<var><a name="index-char_002dci_003c_003f-160"></a></var><br>
+— Applicative: <b>char-ci<=?</b> (<var>char-ci<=? . chars</var>)<var><a name="index-char_002dci_003c_003d_003f-161"></a></var><br>
+— Applicative: <b>char-ci>?</b> (<var>char-ci>? . chars</var>)<var><a name="index-char_002dci_003e_003f-162"></a></var><br>
+— Applicative: <b>char-ci>=?</b> (<var>char-ci>=? . chars</var>)<var><a name="index-char_002dci_003e_003d_003f-163"></a></var><br>
+<blockquote><p> These predicates convert the chars to lowercase and then compare
+their ASCII values.
+</p></blockquote></div>
+
+<div class="defun">
+— Applicative: <b>char-alphabetic?</b> (<var>char-alphabetic? . chars</var>)<var><a name="index-char_002dalphabetic_003f-164"></a></var><br>
+— Applicative: <b>char-numeric?</b> (<var>char-numeric? . chars</var>)<var><a name="index-char_002dnumeric_003f-165"></a></var><br>
+— Applicative: <b>char-whitespace?</b> (<var>char-whitespace? . chars</var>)<var><a name="index-char_002dwhitespace_003f-166"></a></var><br>
+<blockquote><p> These predicates return true iff all of their arguments are
+respectively “alphabetic”, “numeric”, or “whitespace”.
+</p></blockquote></div>
+
+<div class="defun">
+— Applicative: <b>char-upper-case?</b> (<var>char-upper-case? . chars</var>)<var><a name="index-char_002dupper_002dcase_003f-167"></a></var><br>
+— Applicative: <b>char-lower-case?</b> (<var>char-lower-case? . chars</var>)<var><a name="index-char_002dlower_002dcase_003f-168"></a></var><br>
+<blockquote><p> These predicates return true iff all of their arguments are
+respectively “upper case, or “lower case”.
+</p></blockquote></div>
+
+<div class="defun">
+— Applicative: <b>char-upcase</b> (<var>char-upcase char</var>)<var><a name="index-char_002dupcase-169"></a></var><br>
+— Applicative: <b>char-downcase</b> (<var>char-downcase char</var>)<var><a name="index-char_002ddowncase-170"></a></var><br>
+<blockquote><p> These applicatives return a character <code>char2</code> so that:
+ <pre class="example"> (char-ci=? char char2) ⇒ #t
+</pre>
+ <p>If <code>char</code> is alphabetic then the following holds:
+
+ <pre class="example"> (char-upper-case? (char-upcase char)) ⇒ #t
+ (char-lower-case? (char-downcase char)) ⇒ #t
+</pre>
+ </blockquote></div>
+
+<div class="defun">
+— Applicative: <b>char->integer</b> (<var>char->integer char</var>)<var><a name="index-char_002d_003einteger-171"></a></var><br>
+— Applicative: <b>integer->char</b> (<var>integer->char k</var>)<var><a name="index-integer_002d_003echar-172"></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->char</code>, an error is
+signaled.
+</p></blockquote></div>
<!-- *-texinfo-*- -->
</body></html>
diff --git a/manual/html/Index.html b/manual/html/Index.html
@@ -55,7 +55,7 @@ Up: <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-157"><code>(</code></a>: <a href="Ports.html#Ports">Ports</a></li>
+<li><a href="Ports.html#index-g_t_0028-177"><code>(</code></a>: <a href="Ports.html#Ports">Ports</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="Booleans.html#index-and_003f-15"><code>and?</code></a>: <a href="Booleans.html#Booleans">Booleans</a></li>
@@ -84,8 +84,8 @@ Up: <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-167"><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-168"><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-187"><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-188"><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,6 +103,25 @@ Up: <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-171"><code>char->integer</code></a>: <a href="Characters.html#Characters">Characters</a></li>
+<li><a href="Characters.html#index-char_002dalphabetic_003f-164"><code>char-alphabetic?</code></a>: <a href="Characters.html#Characters">Characters</a></li>
+<li><a href="Characters.html#index-char_002dci_003c_003d_003f-161"><code>char-ci<=?</code></a>: <a href="Characters.html#Characters">Characters</a></li>
+<li><a href="Characters.html#index-char_002dci_003c_003f-160"><code>char-ci<?</code></a>: <a href="Characters.html#Characters">Characters</a></li>
+<li><a href="Characters.html#index-char_002dci_003d_003f-159"><code>char-ci=?</code></a>: <a href="Characters.html#Characters">Characters</a></li>
+<li><a href="Characters.html#index-char_002dci_003e_003d_003f-163"><code>char-ci>=?</code></a>: <a href="Characters.html#Characters">Characters</a></li>
+<li><a href="Characters.html#index-char_002dci_003e_003f-162"><code>char-ci>?</code></a>: <a href="Characters.html#Characters">Characters</a></li>
+<li><a href="Characters.html#index-char_002ddowncase-170"><code>char-downcase</code></a>: <a href="Characters.html#Characters">Characters</a></li>
+<li><a href="Characters.html#index-char_002dlower_002dcase_003f-168"><code>char-lower-case?</code></a>: <a href="Characters.html#Characters">Characters</a></li>
+<li><a href="Characters.html#index-char_002dnumeric_003f-165"><code>char-numeric?</code></a>: <a href="Characters.html#Characters">Characters</a></li>
+<li><a href="Characters.html#index-char_002dupcase-169"><code>char-upcase</code></a>: <a href="Characters.html#Characters">Characters</a></li>
+<li><a href="Characters.html#index-char_002dupper_002dcase_003f-167"><code>char-upper-case?</code></a>: <a href="Characters.html#Characters">Characters</a></li>
+<li><a href="Characters.html#index-char_002dwhitespace_003f-166"><code>char-whitespace?</code></a>: <a href="Characters.html#Characters">Characters</a></li>
+<li><a href="Characters.html#index-char_003c_003d_003f-156"><code>char<=?</code></a>: <a href="Characters.html#Characters">Characters</a></li>
+<li><a href="Characters.html#index-char_003c_003f-155"><code>char<?</code></a>: <a href="Characters.html#Characters">Characters</a></li>
+<li><a href="Characters.html#index-char_003d_003f-154"><code>char=?</code></a>: <a href="Characters.html#Characters">Characters</a></li>
+<li><a href="Characters.html#index-char_003e_003d_003f-158"><code>char>=?</code></a>: <a href="Characters.html#Characters">Characters</a></li>
+<li><a href="Characters.html#index-char_003e_003f-157"><code>char>?</code></a>: <a href="Characters.html#Characters">Characters</a></li>
+<li><a href="Characters.html#index-char_003f-153"><code>char?</code></a>: <a href="Characters.html#Characters">Characters</a></li>
<li><a href="Characters.html#index-characters-152">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>
@@ -121,7 +140,7 @@ Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a>
<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-171"><code>eof-object?</code></a>: <a href="Ports.html#Ports">Ports</a></li>
+<li><a href="Ports.html#index-eof_002dobject_003f-191"><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>
@@ -139,14 +158,15 @@ Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a>
<li><a href="Promises.html#index-force-142"><code>force</code></a>: <a href="Promises.html#Promises">Promises</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-170"><code>get-module</code></a>: <a href="Ports.html#Ports">Ports</a></li>
+<li><a href="Ports.html#index-get_002dmodule-190"><code>get-module</code></a>: <a href="Ports.html#Ports">Ports</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-155"><code>input-port?</code></a>: <a href="Ports.html#Ports">Ports</a></li>
+<li><a href="Ports.html#index-input_002dport_003f-175"><code>input-port?</code></a>: <a href="Ports.html#Ports">Ports</a></li>
+<li><a href="Characters.html#index-integer_002d_003echar-172"><code>integer->char</code></a>: <a href="Characters.html#Characters">Characters</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>
@@ -158,7 +178,7 @@ Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a>
<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-169"><code>load</code></a>: <a href="Ports.html#Ports">Ports</a></li>
+<li><a href="Ports.html#index-load-189"><code>load</code></a>: <a href="Ports.html#Ports">Ports</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="Environments.html#index-make_002dkernel_002dstandard_002denvironment-103"><code>make-kernel-standard-environment</code></a>: <a href="Environments.html#Environments">Environments</a></li>
@@ -174,21 +194,21 @@ Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a>
<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-numbers-150">numbers</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-161"><code>open-input-file</code></a>: <a href="Ports.html#Ports">Ports</a></li>
-<li><a href="Ports.html#index-open_002doutput_002dfile-162"><code>open-output-file</code></a>: <a href="Ports.html#Ports">Ports</a></li>
+<li><a href="Ports.html#index-open_002dinput_002dfile-181"><code>open-input-file</code></a>: <a href="Ports.html#Ports">Ports</a></li>
+<li><a href="Ports.html#index-open_002doutput_002dfile-182"><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-156"><code>output-port?</code></a>: <a href="Ports.html#Ports">Ports</a></li>
+<li><a href="Ports.html#index-output_002dport_003f-176"><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-154"><code>port?</code></a>: <a href="Ports.html#Ports">Ports</a></li>
-<li><a href="Ports.html#index-ports-153">ports</a>: <a href="Ports.html#Ports">Ports</a></li>
+<li><a href="Ports.html#index-port_003f-174"><code>port?</code></a>: <a href="Ports.html#Ports">Ports</a></li>
+<li><a href="Ports.html#index-ports-173">ports</a>: <a href="Ports.html#Ports">Ports</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-165"><code>read</code></a>: <a href="Ports.html#Ports">Ports</a></li>
+<li><a href="Ports.html#index-read-185"><code>read</code></a>: <a href="Ports.html#Ports">Ports</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="Continuations.html#index-root_002dcontinuation-132"><code>root-continuation</code></a>: <a href="Continuations.html#Continuations">Continuations</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>
diff --git a/manual/html/Ports.html b/manual/html/Ports.html
@@ -34,7 +34,7 @@ Up: <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-153"></a>
+<p><a name="index-ports-173"></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">
-— Applicative: <b>port?</b> (<var>port? . objects</var>)<var><a name="index-port_003f-154"></a></var><br>
+— Applicative: <b>port?</b> (<var>port? . objects</var>)<var><a name="index-port_003f-174"></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">
-— Applicative: <b>input-port?</b> (<var>input-port? . objects</var>)<var><a name="index-input_002dport_003f-155"></a></var><br>
-— Applicative: <b>output-port?</b> (<var>output-port? . objects</var>)<var><a name="index-output_002dport_003f-156"></a></var><br>
+— Applicative: <b>input-port?</b> (<var>input-port? . objects</var>)<var><a name="index-input_002dport_003f-175"></a></var><br>
+— Applicative: <b>output-port?</b> (<var>output-port? . objects</var>)<var><a name="index-output_002dport_003f-176"></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">
-— with-input-from-file: <b>(</b><var>with-input-from-file string combiner</var>)<var><a name="index-g_t_0028-157"></a></var><br>
-— with-output-to-file: <b>(</b><var>with-output-to-file string combiner</var>)<var><a name="index-g_t_0028-158"></a></var><br>
+— with-input-from-file: <b>(</b><var>with-input-from-file string combiner</var>)<var><a name="index-g_t_0028-177"></a></var><br>
+— with-output-to-file: <b>(</b><var>with-output-to-file string combiner</var>)<var><a name="index-g_t_0028-178"></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 & output-port
@@ -88,8 +88,8 @@ klisp implementation in the near future.
</p></blockquote></div>
<div class="defun">
-— get-current-input-port: <b>(</b><var>get-current-input-port</var>)<var><a name="index-g_t_0028-159"></a></var><br>
-— get-current-output-port: <b>(</b><var>get-current-output-port</var>)<var><a name="index-g_t_0028-160"></a></var><br>
+— get-current-input-port: <b>(</b><var>get-current-input-port</var>)<var><a name="index-g_t_0028-179"></a></var><br>
+— get-current-output-port: <b>(</b><var>get-current-output-port</var>)<var><a name="index-g_t_0028-180"></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">
-— Applicative: <b>open-input-file</b> (<var>open-input-file string</var>)<var><a name="index-open_002dinput_002dfile-161"></a></var><br>
+— Applicative: <b>open-input-file</b> (<var>open-input-file string</var>)<var><a name="index-open_002dinput_002dfile-181"></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">
-— Applicative: <b>open-output-file</b> (<var>open-output-file string</var>)<var><a name="index-open_002doutput_002dfile-162"></a></var><br>
+— Applicative: <b>open-output-file</b> (<var>open-output-file string</var>)<var><a name="index-open_002doutput_002dfile-182"></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">
-— close-input-file: <b>(</b><var>close-input-file input-port</var>)<var><a name="index-g_t_0028-163"></a></var><br>
-— close-output-file: <b>(</b><var>close-output-file output-port</var>)<var><a name="index-g_t_0028-164"></a></var><br>
+— close-input-file: <b>(</b><var>close-input-file input-port</var>)<var><a name="index-g_t_0028-183"></a></var><br>
+— close-output-file: <b>(</b><var>close-output-file output-port</var>)<var><a name="index-g_t_0028-184"></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 & close-output-port.
</p></blockquote></div>
<div class="defun">
-— Applicative: <b>read</b> (<var>read </var>[<var>input-port</var>])<var><a name="index-read-165"></a></var><br>
+— Applicative: <b>read</b> (<var>read </var>[<var>input-port</var>])<var><a name="index-read-185"></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">
-— write: <b>(</b><var>write object </var>[<var>port</var>])<var><a name="index-g_t_0028-166"></a></var><br>
+— write: <b>(</b><var>write object </var>[<var>port</var>])<var><a name="index-g_t_0028-186"></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">
-— Applicative: <b>call-with-input-file</b> (<var>call-with-input-file string combiner</var>)<var><a name="index-call_002dwith_002dinput_002dfile-167"></a></var><br>
-— Applicative: <b>call-with-output-file</b> (<var>call-with-output-file string combiner</var>)<var><a name="index-call_002dwith_002doutput_002dfile-168"></a></var><br>
+— Applicative: <b>call-with-input-file</b> (<var>call-with-input-file string combiner</var>)<var><a name="index-call_002dwith_002dinput_002dfile-187"></a></var><br>
+— Applicative: <b>call-with-output-file</b> (<var>call-with-output-file string combiner</var>)<var><a name="index-call_002dwith_002doutput_002dfile-188"></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">
-— Applicative: <b>load</b> (<var>load string</var>)<var><a name="index-load-169"></a></var><br>
+— Applicative: <b>load</b> (<var>load string</var>)<var><a name="index-load-189"></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">
-— Applicative: <b>get-module</b> (<var>get-module string </var>[<var>environment</var>])<var><a name="index-get_002dmodule-170"></a></var><br>
+— Applicative: <b>get-module</b> (<var>get-module string </var>[<var>environment</var>])<var><a name="index-get_002dmodule-190"></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">
-— Applicative: <b>eof-object?</b> (<var>eof-object? . objects</var>)<var><a name="index-eof_002dobject_003f-171"></a></var><br>
+— Applicative: <b>eof-object?</b> (<var>eof-object? . objects</var>)<var><a name="index-eof_002dobject_003f-191"></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">
-— read-char: <b>(</b><var>read-char </var>[<var>port</var>])<var><a name="index-g_t_0028-172"></a></var><br>
+— read-char: <b>(</b><var>read-char </var>[<var>port</var>])<var><a name="index-g_t_0028-192"></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">
-— peek-char: <b>(</b><var>peek-char </var>[<var>port</var>])<var><a name="index-g_t_0028-173"></a></var><br>
+— peek-char: <b>(</b><var>peek-char </var>[<var>port</var>])<var><a name="index-g_t_0028-193"></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">
-— char-ready?: <b>(</b><var>char-ready? </var>[<var>port</var>])<var><a name="index-g_t_0028-174"></a></var><br>
+— char-ready?: <b>(</b><var>char-ready? </var>[<var>port</var>])<var><a name="index-g_t_0028-194"></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">
-— write-char: <b>(</b><var>write-char char </var>[<var>port</var>])<var><a name="index-g_t_0028-175"></a></var><br>
+— write-char: <b>(</b><var>write-char char </var>[<var>port</var>])<var><a name="index-g_t_0028-195"></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">
-— newline: <b>(</b><var>newline </var>[<var>port</var>])<var><a name="index-g_t_0028-176"></a></var><br>
+— newline: <b>(</b><var>newline </var>[<var>port</var>])<var><a name="index-g_t_0028-196"></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">
-— display: <b>(</b><var>display object </var>[<var>port</var>])<var><a name="index-g_t_0028-177"></a></var><br>
+— display: <b>(</b><var>display object </var>[<var>port</var>])<var><a name="index-g_t_0028-197"></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/klisp.info b/manual/klisp.info
@@ -1577,6 +1577,64 @@ File: klisp.info, Node: Characters, Next: Ports, Prev: Strings, Up: Top
15 Characters
*************
+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 consists of a
+leading "#\" and the character or character name. The only supported
+names for now are "newline" and "space" (both from r5rs scheme).
+Characters are immutable. The character type is encapsulated.
+
+ SOURCE NOTE: This section is still missing from the report. The
+features defined here were taken mostly from r5rs scheme.
+
+ -- Applicative: char? (char? . objects)
+ The primitive type predicate for type character. `char?' returns
+ true iff all the objects in `objects' are of type character.
+
+ -- Applicative: char=? (char=? . chars)
+ -- Applicative: char<? (char<? . chars)
+ -- Applicative: char<=? (char<=? . chars)
+ -- Applicative: char>? (char>? . chars)
+ -- Applicative: char>=? (char>=? . chars)
+ These predicates compare any number of characters using their
+ ASCII value for the comparison.
+
+ -- Applicative: char-ci=? (char-ci=? . chars)
+ -- Applicative: char-ci<? (char-ci<? . chars)
+ -- Applicative: char-ci<=? (char-ci<=? . chars)
+ -- Applicative: char-ci>? (char-ci>? . chars)
+ -- Applicative: char-ci>=? (char-ci>=? . chars)
+ These predicates convert the chars to lowercase and then compare
+ their ASCII values.
+
+ -- Applicative: char-alphabetic? (char-alphabetic? . chars)
+ -- Applicative: char-numeric? (char-numeric? . chars)
+ -- Applicative: char-whitespace? (char-whitespace? . chars)
+ These predicates return true iff all of their arguments are
+ respectively "alphabetic", "numeric", or "whitespace".
+
+ -- Applicative: char-upper-case? (char-upper-case? . chars)
+ -- Applicative: char-lower-case? (char-lower-case? . chars)
+ These predicates return true iff all of their arguments are
+ respectively "upper case, or "lower case".
+
+ -- Applicative: char-upcase (char-upcase char)
+ -- Applicative: char-downcase (char-downcase char)
+ These applicatives return a character `char2' so that:
+ (char-ci=? char char2) => #t
+
+ If `char' is alphabetic then the following holds:
+
+ (char-upper-case? (char-upcase char)) => #t
+ (char-lower-case? (char-downcase char)) => #t
+
+ -- Applicative: char->integer (char->integer char)
+ -- Applicative: integer->char (integer->char k)
+ 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 `integer->char', an error
+ is signaled.
+
File: klisp.info, Node: Ports, Next: Index, Prev: Characters, Up: Top
@@ -1900,6 +1958,25 @@ Index
* cdddr: Pairs and lists. (line 100)
* cddr: Pairs and lists. (line 92)
* cdr: Pairs and lists. (line 86)
+* char->integer: Characters. (line 58)
+* char-alphabetic?: Characters. (line 37)
+* char-ci<=?: Characters. (line 31)
+* char-ci<?: Characters. (line 30)
+* char-ci=?: Characters. (line 29)
+* char-ci>=?: Characters. (line 33)
+* char-ci>?: Characters. (line 32)
+* char-downcase: Characters. (line 49)
+* char-lower-case?: Characters. (line 44)
+* char-numeric?: Characters. (line 38)
+* char-upcase: Characters. (line 48)
+* char-upper-case?: Characters. (line 43)
+* char-whitespace?: Characters. (line 39)
+* char<=?: Characters. (line 23)
+* char<?: Characters. (line 22)
+* char=?: Characters. (line 21)
+* char>=?: Characters. (line 25)
+* char>?: Characters. (line 24)
+* char?: Characters. (line 17)
* characters: Characters. (line 6)
* combiner?: Combiners. (line 120)
* combiners: Combiners. (line 6)
@@ -1946,6 +2023,7 @@ Index
* inert: Control. (line 6)
* inert?: Control. (line 11)
* input-port?: Ports. (line 27)
+* integer->char: Characters. (line 59)
* Kernel history: Kernel History. (line 6)
* keyed dynamic variables: Keyed Variables. (line 15)
* keyed static variables: Keyed Variables. (line 40)
@@ -2032,7 +2110,7 @@ Node: Keyed Variables69360
Node: Numbers72131
Node: Strings72240
Node: Characters72344
-Node: Ports72452
-Node: Index83737
+Node: Ports75054
+Node: Index86339
End Tag Table
diff --git a/manual/src/characters.texi b/manual/src/characters.texi
@@ -6,3 +6,76 @@
@chapter Characters
@cindex characters
+
+ 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
+consists of a leading ``#\'' and the character or character name. The
+only supported names for now are ``newline'' and ``space'' (both from
+r5rs scheme). Characters are immutable. The character type is
+encapsulated.
+
+ SOURCE NOTE: This section is still missing from the report. The
+features defined here were taken mostly from r5rs scheme.
+
+@deffn Applicative char? (char? . objects)
+ The primitive type predicate for type character. @code{char?}
+returns true iff all the objects in @code{objects} are of type
+character.
+@end deffn
+
+@deffn Applicative char=? (char=? . chars)
+@deffnx Applicative char<? (char<? . chars)
+@deffnx Applicative char<=? (char<=? . chars)
+@deffnx Applicative char>? (char>? . chars)
+@deffnx Applicative char>=? (char>=? . chars)
+ These predicates compare any number of characters using their
+ASCII value for the comparison.
+@end deffn
+
+@deffn Applicative char-ci=? (char-ci=? . chars)
+@deffnx Applicative char-ci<? (char-ci<? . chars)
+@deffnx Applicative char-ci<=? (char-ci<=? . chars)
+@deffnx Applicative char-ci>? (char-ci>? . chars)
+@deffnx Applicative char-ci>=? (char-ci>=? . chars)
+ These predicates convert the chars to lowercase and then compare
+their ASCII values.
+@end deffn
+
+@deffn Applicative char-alphabetic? (char-alphabetic? . chars)
+@deffnx Applicative char-numeric? (char-numeric? . chars)
+@deffnx Applicative char-whitespace? (char-whitespace? . chars)
+ These predicates return true iff all of their arguments are
+respectively ``alphabetic'', ``numeric'', or ``whitespace''.
+@end deffn
+
+@deffn Applicative char-upper-case? (char-upper-case? . chars)
+@deffnx Applicative char-lower-case? (char-lower-case? . chars)
+ These predicates return true iff all of their arguments are
+respectively ``upper case, or ``lower case''.
+@end deffn
+
+@deffn Applicative char-upcase (char-upcase char)
+@deffnx Applicative char-downcase (char-downcase char)
+ These applicatives return a character @code{char2} so that:
+@example
+(char-ci=? char char2) @result{} #t
+@end example
+
+ If @code{char} is alphabetic then the following holds:
+
+@example
+(char-upper-case? (char-upcase char)) @result{} #t
+(char-lower-case? (char-downcase char)) @result{} #t
+@end example
+@end deffn
+
+@deffn Applicative char->integer (char->integer char)
+@deffnx Applicative integer->char (integer->char k)
+ 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->char}, an error is
+signaled.
+@end deffn
+
+