Refer.html 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <html lang="en">
  2. <head>
  3. <title>Refer - avram - a virtual machine code interpreter</title>
  4. <meta http-equiv="Content-Type" content="text/html">
  5. <meta name="description" content="avram - a virtual machine code interpreter">
  6. <meta name="generator" content="makeinfo 4.13">
  7. <link title="Top" rel="start" href="index.html#Top">
  8. <link rel="up" href="Recursion.html#Recursion" title="Recursion">
  9. <link rel="prev" href="Recur.html#Recur" title="Recur">
  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. </head>
  24. <body>
  25. <div class="node">
  26. <a name="Refer"></a>
  27. <p>
  28. Previous:&nbsp;<a rel="previous" accesskey="p" href="Recur.html#Recur">Recur</a>,
  29. Up:&nbsp;<a rel="up" accesskey="u" href="Recursion.html#Recursion">Recursion</a>
  30. <hr>
  31. </div>
  32. <h5 class="subsubsection">2.7.9.2 Refer</h5>
  33. <p><a name="index-g_t_0040code_007brefer_007d-300"></a>In the style of recursive programming compelled by the available
  34. <code>meta</code> primitive, a function effectively requires a copy of its own
  35. machine code as its left argument. Bringing about that state of
  36. affairs is an interesting party trick.
  37. <p><a name="index-g_t_0040code_007bbu_007d-301"></a>If we had a definition of <code>bu</code> in the standard library implying
  38. <dl>
  39. <dt><em>T16</em><dd>([[<code>bu</code>]] <code>(</code><var>f</var><code>,</code><var>k</var><code>)</code>) <var>x</var> = <var>f</var><code>(</code><var>k</var><code>,</code><var>x</var><code>)</code>
  40. </dl>
  41. <p class="noindent">which for the sake of concreteness can be done like this,
  42. <pre class="example"> bu = (hired compose)(
  43. left,
  44. (hired couple)(compose(constant,right),constant identity))
  45. </pre>
  46. <p class="noindent">then a definition of <code>refer</code> as
  47. <pre class="example"> refer = (hired bu)(identity,identity)
  48. </pre>
  49. <p class="noindent">would be consistent with the following property of the operator.
  50. <dl>
  51. <dt><em>P15</em><dd>([[<code>refer</code>]] <var>f</var>) <var>x</var> = <var>f</var><code> (</code><var>f</var><code>,</code><var>x</var><code>)</code>
  52. </dl>
  53. <p class="noindent">The proof, as always, is a matter of routine calculation in the manner
  54. of the section on how <code>avram</code> thinks.
  55. <p>However, this pattern would occur so frequently in recursively defined
  56. functions as to be a significant waste of space and time. Therefore,
  57. rather than requiring it to be defined in terms of other operations, the
  58. virtual machine specification recognizes a pattern of the form below with
  59. respect to property <em>P15</em>,
  60. <dl>
  61. <dt><em>T17</em><dd>[[<code>refer</code>]] <var>f</var> = <code>(((</code><var>f</var><code>,nil),nil),nil)</code>
  62. </dl>
  63. <p class="noindent">and takes the property to be true by definition of the operator. A
  64. definition of <code>refer</code> consistent with <em>T17</em> is therefore to
  65. <a name="index-standard-library-302"></a>be found in the standard library, not the definition proposed above.
  66. </body></html>