12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <html lang="en">
- <head>
- <title>Pairwise - 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="Reference-Implementations.html#Reference-Implementations" title="Reference Implementations">
- <link rel="next" href="Insert.html#Insert" title="Insert">
- <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="Pairwise"></a>
- <p>
- Next: <a rel="next" accesskey="n" href="Insert.html#Insert">Insert</a>,
- Previous: <a rel="previous" accesskey="p" href="Reference-Implementations.html#Reference-Implementations">Reference Implementations</a>,
- Up: <a rel="up" accesskey="u" href="Reference-Implementations.html#Reference-Implementations">Reference Implementations</a>
- <hr>
- </div>
- <h3 class="section">B.1 Pairwise</h3>
- <p><a name="index-g_t_0040code_007bpairwise_007d-699"></a>This <code>silly</code> code fragment is mentioned in <a href="Reduce.html#Reduce">Reduce</a>, in the
- discussion of <code>reduce</code>, and is provided as an example of a solution
- to equations <em>E1</em> to <em>E3</em>. It is written in the style of a
- higher order function, in that it takes a function <var>f</var> as an
- argument and returns another function, [[<code>pairwise</code>]]
- <var>f</var> as a result.
- <pre class="example">
- self = left
- argument = right
- head = left
- tail = right
-
- pairwise =
-
- compose(
- refer,
- compose(
- bu(
- conditional,
- conditional(argument,compose(tail,argument),constant nil)),
- couple(
- (hired couple)(
- (hired compose)(
- identity,
- constant (hired fan head)(
- argument,
- compose(tail,argument))),
- constant (hired meta)(
- self,
- compose(tail,compose(tail,argument)))),
- constant argument)))
-
- </pre>
- <p class="noindent">To see how this works, one should evaluate it symbolically with an
- unknown <var>f</var>, which will result in some <code>silly</code>
- pseudocode, and then evaluate that symbolically with some sample lists.
- </body></html>
|