123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <html lang="en">
- <head>
- <title>Insert - avram - a virtual machine code interpreter</title>
- <meta http-equiv="Content-Type" content="text/html">
- <meta name="description" content="avram - a virtual machine code interpreter">
- <meta name="generator" content="makeinfo 4.13">
- <link title="Top" rel="start" href="index.html#Top">
- <link rel="up" href="Reference-Implementations.html#Reference-Implementations" title="Reference Implementations">
- <link rel="prev" href="Pairwise.html#Pairwise" title="Pairwise">
- <link rel="next" href="Replace.html#Replace" title="Replace">
- <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
- <meta http-equiv="Content-Style-Type" content="text/css">
- <style type="text/css"><!--
- pre.display { font-family:inherit }
- pre.format { font-family:inherit }
- pre.smalldisplay { font-family:inherit; font-size:smaller }
- pre.smallformat { font-family:inherit; font-size:smaller }
- pre.smallexample { font-size:smaller }
- pre.smalllisp { font-size:smaller }
- span.sc { font-variant:small-caps }
- span.roman { font-family:serif; font-weight:normal; }
- span.sansserif { font-family:sans-serif; font-weight:normal; }
- --></style>
- </head>
- <body>
- <div class="node">
- <a name="Insert"></a>
- <p>
- Next: <a rel="next" accesskey="n" href="Replace.html#Replace">Replace</a>,
- Previous: <a rel="previous" accesskey="p" href="Pairwise.html#Pairwise">Pairwise</a>,
- Up: <a rel="up" accesskey="u" href="Reference-Implementations.html#Reference-Implementations">Reference Implementations</a>
- <hr>
- </div>
- <h3 class="section">B.2 Insert</h3>
- <p><a name="index-g_t_0040code_007binsert_007d-700"></a>This function is mentioned in <a href="Sort.html#Sort">Sort</a>, on sorting. It takes the
- virtual code for a partial order relational operator and returns the
- code for a function of two arguments. The left argument is a list item
- and the right argument is a list of items of the same type, which is
- already sorted with respect to the relational operator given as the
- argument to <code>insert</code>. The result of the function returned by
- <code>insert</code> is a list similar to its right argument but with the left
- argument inserted in the proper position to maintain the order.
- <p>This code makes use of the <code>self</code>, <code>argument</code>, <code>head</code>
- and <code>tail</code> declarations associated with <code>pairwise</code>.
- <pre class="example">
- insert =
-
- bu(compose,refer) (hired conditional)(
- constant compose(right,argument),
- couple(
- (hired conditional)(
- (hired compose)(
- identity,
- constant compose(
- couple(left,compose(head,right)),
- argument)),
- constant (
- argument,
- couple(
- compose(head,compose(right,argument)),
- (hired meta)(
- self,
- couple(
- compose(left,argument),
- compose(tail,compose(right,argument))))))),
- constant argument))
-
- </pre>
- <p>As with the other higher order functions in this appendix, the only
- feasible ways to verify it would be either by formal proof or by some
- form of symbolic interpretation.
- </body></html>
|