klisp

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

Encapsulations.html (3339B)


      1 <html lang="en">
      2 <head>
      3 <title>Encapsulations - klisp Reference Manual</title>
      4 <meta http-equiv="Content-Type" content="text/html">
      5 <meta name="description" content="klisp Reference Manual">
      6 <meta name="generator" content="makeinfo 4.13">
      7 <link title="Top" rel="start" href="index.html#Top">
      8 <link rel="prev" href="Continuations.html#Continuations" title="Continuations">
      9 <link rel="next" href="Promises.html#Promises" title="Promises">
     10 <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
     11 <meta http-equiv="Content-Style-Type" content="text/css">
     12 <style type="text/css"><!--
     13   pre.display { font-family:inherit }
     14   pre.format  { font-family:inherit }
     15   pre.smalldisplay { font-family:inherit; font-size:smaller }
     16   pre.smallformat  { font-family:inherit; font-size:smaller }
     17   pre.smallexample { font-size:smaller }
     18   pre.smalllisp    { font-size:smaller }
     19   span.sc    { font-variant:small-caps }
     20   span.roman { font-family:serif; font-weight:normal; } 
     21   span.sansserif { font-family:sans-serif; font-weight:normal; } 
     22 --></style>
     23 <link rel="stylesheet" type="text/css" href="css/style.css">
     24 </head>
     25 <body>
     26 <div class="node">
     27 <a name="Encapsulations"></a>
     28 <p>
     29 Next:&nbsp;<a rel="next" accesskey="n" href="Promises.html#Promises">Promises</a>,
     30 Previous:&nbsp;<a rel="previous" accesskey="p" href="Continuations.html#Continuations">Continuations</a>,
     31 Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
     32 <hr>
     33 </div>
     34 
     35 <!-- node-name,  next,  previous,  up -->
     36 <h2 class="chapter">11 Encapsulations</h2>
     37 
     38 <p><a name="index-encapsulations-153"></a>
     39 An encapsulation is an object that refers to another object, called
     40 its content.  The Kernel data type encapsulation is encapsulated.  Two
     41 encapsulations are <code>equal?</code> iff they are <code>eq?</code>. 
     42 Encapsulations are immutable.
     43 
     44 <!-- TODO this is a little spartan... maybe add some more content -->
     45 <div class="defun">
     46 &mdash; Applicative: <b>make-encapsulation-type</b> (<var>make-encapsulation-type</var>)<var><a name="index-make_002dencapsulation_002dtype-154"></a></var><br>
     47 <blockquote><p>  Returns a list of the form <code>(e p? d)</code>, where <code>e</code>,
     48 <code>p</code>?, and <code>d</code> are applicatives, as follows.  Each call to
     49 <code>make-encapsulation-type</code> returns different applicatives
     50 <code>e</code>, <code>p?</code>, and <code>d</code>.
     51 
     52           <ul>
     53 <li><code>e</code> is an applicative that takes one argument, and returns a
     54 fresh encapsulation with the argument as content.  Encapsulations
     55 returned on different occasions are not <code>eq?</code>.
     56 
     57           <li><code>p?</code> is a primitive type predicate, that takes zero or more
     58 arguments and returns true iff all of them are encapsulations
     59 generated by <code>e</code>.
     60 
     61           <li><code>d</code> is an applicative that takes one argument; if the argument is
     62 not an encapsulation generated by <code>e</code>, an error is signaled,
     63 otherwise the content of the encapsulation is returned. 
     64 </ul>
     65 
     66         <p>That is, the predicate <code>p?</code> only recognizes, and the decapsulator
     67 <code>d</code> only extracts the content of, encapsulations created by the
     68 encapsulator <code>e</code> that was returned by the same call to
     69 <code>make-encapsulation-type</code>. 
     70 </p></blockquote></div>
     71 
     72 <!-- *-texinfo-*- -->
     73    </body></html>
     74