commit be06d132f32d56bd585b295cc176dcf1da3a5ceb
parent 5db885c480d8af3137cf1e381e12172b335c02aa
Author: Andres Navarro <canavarro82@gmail.com>
Date: Fri, 3 Jun 2011 13:27:50 -0300
Completed encapsulations module in the manual.
Diffstat:
10 files changed, 119 insertions(+), 21 deletions(-)
diff --git a/manual/html/Characters.html b/manual/html/Characters.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">15 Characters</h2>
-<p><a name="index-characters-145"></a>
+<p><a name="index-characters-146"></a>
<!-- *-texinfo-*- -->
</body></html>
diff --git a/manual/html/Encapsulations.html b/manual/html/Encapsulations.html
@@ -35,6 +35,38 @@ Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a>
<h2 class="chapter">10 Encapsulations</h2>
<p><a name="index-encapsulations-138"></a>
+An encapsulation is an object that refers to another object, called
+its content. The Kernel data type encapsulation is encapsulated. Two
+encapsulations are <code>equal?</code> iff they are <code>eq?</code>.
+Encapsulations are immutable.
+
+<!-- TODO this is a little spartan... maybe add some more content -->
+<div class="defun">
+— Applicative: <b>make-encapsulation-type</b> (<var>make-encapsulation-type</var>)<var><a name="index-make_002dencapsulation_002dtype-139"></a></var><br>
+<blockquote><p> Returns a list of the form <code>(e p? d)</code>, where <code>e</code>,
+<code>p</code>?, and <code>d</code> are applicatives, as follows. Each call to
+<code>make-encapsulation-type</code> returns different applicatives
+<code>e</code>, <code>p?</code>, and <code>d</code>.
+
+ <ul>
+<li><code>e</code> is an applicative that takes one argument, and returns a
+fresh encapsulation with the argument as content. Encapsulations
+returned on different occasions are not <code>eq?</code>.
+
+ <li><code>p?</code> is a primitive type predicate, that takes zero or more
+arguments and returns true iff all of them are encapsulations
+generated by <code>e</code>.
+
+ <li><code>d</code> is an applicative that takes one argument; if the argument is
+not an encapsulation generated by <code>e</code>, an error is signaled,
+otherwise the content of the encapsulation is returned.
+</ul>
+
+ <p>That is, the predicate <code>p?</code> only recognizes, and the decapsulator
+<code>d</code> only extracts the content of, encapsulations created by the
+encapsulator <code>e</code> that was returned by the same call to
+<code>make-encapsulation-type</code>.
+</p></blockquote></div>
<!-- *-texinfo-*- -->
</body></html>
diff --git a/manual/html/Index.html b/manual/html/Index.html
@@ -99,7 +99,7 @@ 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-characters-145">characters</a>: <a href="Characters.html#Characters">Characters</a></li>
+<li><a href="Characters.html#index-characters-146">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>
@@ -140,9 +140,9 @@ Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a>
<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="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-141">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-142">keyed static variables</a>: <a href="Keyed-Variables.html#Keyed-Variables">Keyed Variables</a></li>
-<li><a href="Keyed-Variables.html#index-keyed-variables-140">keyed variables</a>: <a href="Keyed-Variables.html#Keyed-Variables">Keyed Variables</a></li>
+<li><a href="Keyed-Variables.html#index-keyed-dynamic-variables-142">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-143">keyed static variables</a>: <a href="Keyed-Variables.html#Keyed-Variables">Keyed Variables</a></li>
+<li><a href="Keyed-Variables.html#index-keyed-variables-141">keyed variables</a>: <a href="Keyed-Variables.html#Keyed-Variables">Keyed Variables</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>
@@ -150,6 +150,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="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>
<li><a href="Combiners.html#index-map-124"><code>map</code></a>: <a href="Combiners.html#Combiners">Combiners</a></li>
@@ -159,7 +160,7 @@ Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a>
<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-numbers-143">numbers</a>: <a href="Numbers.html#Numbers">Numbers</a></li>
+<li><a href="Numbers.html#index-numbers-144">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="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>
@@ -167,15 +168,15 @@ Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a>
<li><a href="Booleans.html#index-or_003f-16"><code>or?</code></a>: <a href="Booleans.html#Booleans">Booleans</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-ports-146">ports</a>: <a href="Ports.html#Ports">Ports</a></li>
+<li><a href="Ports.html#index-ports-147">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-promises-139">promises</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="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>
<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="Symbols.html#index-string_002d_003esymbol-25"><code>string->symbol</code></a>: <a href="Symbols.html#Symbols">Symbols</a></li>
-<li><a href="Strings.html#index-strings-144">strings</a>: <a href="Strings.html#Strings">Strings</a></li>
+<li><a href="Strings.html#index-strings-145">strings</a>: <a href="Strings.html#Strings">Strings</a></li>
<li><a href="Symbols.html#index-symbol_002d_003estring-24"><code>symbol->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>
diff --git a/manual/html/Keyed-Variables.html b/manual/html/Keyed-Variables.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">12 Keyed Variables</h2>
-<p><a name="index-keyed-variables-140"></a><a name="index-keyed-dynamic-variables-141"></a><a name="index-keyed-static-variables-142"></a>
+<p><a name="index-keyed-variables-141"></a><a name="index-keyed-dynamic-variables-142"></a><a name="index-keyed-static-variables-143"></a>
<!-- *-texinfo-*- -->
</body></html>
diff --git a/manual/html/Numbers.html b/manual/html/Numbers.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">13 Numbers</h2>
-<p><a name="index-numbers-143"></a>
+<p><a name="index-numbers-144"></a>
<!-- *-texinfo-*- -->
</body></html>
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-146"></a>
+<p><a name="index-ports-147"></a>
<!-- appendices -->
<!-- TODO -->
diff --git a/manual/html/Promises.html b/manual/html/Promises.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">11 Promises</h2>
-<p><a name="index-promises-139"></a>
+<p><a name="index-promises-140"></a>
<!-- *-texinfo-*- -->
</body></html>
diff --git a/manual/html/Strings.html b/manual/html/Strings.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">14 Strings</h2>
-<p><a name="index-strings-144"></a>
+<p><a name="index-strings-145"></a>
<!-- *-texinfo-*- -->
</body></html>
diff --git a/manual/klisp.info b/manual/klisp.info
@@ -1377,6 +1377,35 @@ File: klisp.info, Node: Encapsulations, Next: Promises, Prev: Continuations,
10 Encapsulations
*****************
+An encapsulation is an object that refers to another object, called its
+content. The Kernel data type encapsulation is encapsulated. Two
+encapsulations are `equal?' iff they are `eq?'. Encapsulations are
+immutable.
+
+ -- Applicative: make-encapsulation-type (make-encapsulation-type)
+ Returns a list of the form `(e p? d)', where `e', `p'?, and `d'
+ are applicatives, as follows. Each call to
+ `make-encapsulation-type' returns different applicatives `e',
+ `p?', and `d'.
+
+ * `e' is an applicative that takes one argument, and returns a
+ fresh encapsulation with the argument as content.
+ Encapsulations returned on different occasions are not `eq?'.
+
+ * `p?' is a primitive type predicate, that takes zero or more
+ arguments and returns true iff all of them are encapsulations
+ generated by `e'.
+
+ * `d' is an applicative that takes one argument; if the
+ argument is not an encapsulation generated by `e', an error
+ is signaled, otherwise the content of the encapsulation is
+ returned.
+
+ That is, the predicate `p?' only recognizes, and the decapsulator
+ `d' only extracts the content of, encapsulations created by the
+ encapsulator `e' that was returned by the same call to
+ `make-encapsulation-type'.
+
File: klisp.info, Node: Promises, Next: Keyed Variables, Prev: Encapsulations, Up: Top
@@ -1540,6 +1569,7 @@ Index
* list-ref: Pairs and lists. (line 198)
* list-tail: Pairs and lists. (line 147)
* lists: Pairs and lists. (line 6)
+* make-encapsulation-type: Encapsulations. (line 12)
* make-environment: Environments. (line 36)
* make-kernel-standard-environment: Environments. (line 119)
* map <1>: Combiners. (line 96)
@@ -1599,12 +1629,12 @@ Node: Environments38764
Node: Combiners48971
Node: Continuations55007
Node: Encapsulations63181
-Node: Promises63310
-Node: Keyed Variables63429
-Node: Numbers63555
-Node: Strings63664
-Node: Characters63768
-Node: Ports63876
-Node: Index63972
+Node: Promises64634
+Node: Keyed Variables64753
+Node: Numbers64879
+Node: Strings64988
+Node: Characters65092
+Node: Ports65200
+Node: Index65296
End Tag Table
diff --git a/manual/src/encapsulations.texi b/manual/src/encapsulations.texi
@@ -6,3 +6,38 @@
@chapter Encapsulations
@cindex encapsulations
+
+An encapsulation is an object that refers to another object, called
+its content. The Kernel data type encapsulation is encapsulated. Two
+encapsulations are @code{equal?} iff they are @code{eq?}.
+Encapsulations are immutable.
+
+@c TODO this is a little spartan... maybe add some more content
+@deffn Applicative make-encapsulation-type (make-encapsulation-type)
+ Returns a list of the form @code{(e p? d)}, where @code{e},
+@code{p}?, and @code{d} are applicatives, as follows. Each call to
+@code{make-encapsulation-type} returns different applicatives
+@code{e}, @code{p?}, and @code{d}.
+
+@itemize @bullet
+@item
+@code{e} is an applicative that takes one argument, and returns a
+fresh encapsulation with the argument as content. Encapsulations
+returned on different occasions are not @code{eq?}.
+
+@item
+@code{p?} is a primitive type predicate, that takes zero or more
+arguments and returns true iff all of them are encapsulations
+generated by @code{e}.
+
+@item
+@code{d} is an applicative that takes one argument; if the argument is
+not an encapsulation generated by @code{e}, an error is signaled,
+otherwise the content of the encapsulation is returned.
+@end itemize
+
+That is, the predicate @code{p?} only recognizes, and the decapsulator
+@code{d} only extracts the content of, encapsulations created by the
+encapsulator @code{e} that was returned by the same call to
+@code{make-encapsulation-type}.
+@end deffn