klisp

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

A-Sample-Applicative-Description.html (3875B)


      1 <html lang="en">
      2 <head>
      3 <title>A Sample Applicative Description - 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="up" href="Format-of-Descriptions.html#Format-of-Descriptions" title="Format of Descriptions">
      9 <link rel="prev" href="Format-of-Descriptions.html#Format-of-Descriptions" title="Format of Descriptions">
     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="A-Sample-Applicative-Description"></a>
     28 <p>
     29 Previous:&nbsp;<a rel="previous" accesskey="p" href="Format-of-Descriptions.html#Format-of-Descriptions">Format of Descriptions</a>,
     30 Up:&nbsp;<a rel="up" accesskey="u" href="Format-of-Descriptions.html#Format-of-Descriptions">Format of Descriptions</a>
     31 <hr>
     32 </div>
     33 
     34 <h5 class="subsubsection">1.3.5.1 A Sample Applicative Description</h5>
     35 
     36 <p><a name="index-applicative-descriptions-8"></a><a name="index-operative-descriptions-9"></a><a name="index-object-descriptions-10"></a>
     37   In an applicative description, the name of the applicative being
     38 described appears first.  It is followed on the same line by an
     39 applicative combination that includes the name of the applicative and
     40 the arguments, as would appear in a program.  The names used for the
     41 arguments are also used in the body of the description.
     42 
     43    <p>Here is a description of an imaginary applicative <code>foo</code>:
     44 
     45 <div class="defun">
     46 &mdash; Applicative: <b>foo</b> (<var>foo integer1 integer2 . rest</var>)<var><a name="index-foo-11"></a></var><br>
     47 <blockquote><p>  The applicative <code>foo</code> subtracts <var>integer1</var> from <var>integer2</var>,
     48 then adds all the rest of the arguments to the result.
     49 
     50      <pre class="example">          (foo 1 5 3 9)
     51                &rArr; 16
     52 </pre>
     53         <p>More generally,
     54 
     55      <pre class="example">          (foo <var>w</var> <var>x</var> <var>y</var>...)
     56           ==
     57           (+ (- <var>x</var> <var>w</var>) <var>y</var>...)
     58 </pre>
     59         </blockquote></div>
     60 
     61    <p>Any parameter whose name contains the name of a type (e.g.,
     62 <var>integer</var>, <var>integer1</var> or <var>continuation</var>) is expected to be of that
     63 type.  A plural of a type (such as <var>numbers</var>) often means a list of
     64 objects of that type.  Parameters named <var>object</var> may be of any
     65 type.  Additionally parameters named <var>k</var>, or <var>kn</var> (for any
     66 value of <var>n</var>), should be exact, non-negative integers. 
     67 <!-- TODO add xref types of objects -->
     68 (XXX Types of Lisp Object XXX, for a list of Kernel object types.) 
     69 Parameters with other sorts of names are
     70 discussed specifically in the description of the combiner.  In some
     71 sections, features common to parameters of several combiners are
     72 described at the beginning.
     73 
     74 <!-- TODO xref to ptree -->
     75 <!-- TODO clean this up a little -->
     76    <p>Operative descriptions have the same format, but the word
     77 `Applicative' is  replaced by `Operative', and `Argument' is replaced
     78 by `Operand'.  Also Operatives always have an environment parameter
     79 (that can be #ignore or a symbol).
     80 
     81    </body></html>
     82