Replace.html 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <html lang="en">
  2. <head>
  3. <title>Replace - 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="Reference-Implementations.html#Reference-Implementations" title="Reference Implementations">
  9. <link rel="prev" href="Insert.html#Insert" title="Insert">
  10. <link rel="next" href="Transition.html#Transition" title="Transition">
  11. <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
  12. <meta http-equiv="Content-Style-Type" content="text/css">
  13. <style type="text/css"><!--
  14. pre.display { font-family:inherit }
  15. pre.format { font-family:inherit }
  16. pre.smalldisplay { font-family:inherit; font-size:smaller }
  17. pre.smallformat { font-family:inherit; font-size:smaller }
  18. pre.smallexample { font-size:smaller }
  19. pre.smalllisp { font-size:smaller }
  20. span.sc { font-variant:small-caps }
  21. span.roman { font-family:serif; font-weight:normal; }
  22. span.sansserif { font-family:sans-serif; font-weight:normal; }
  23. --></style>
  24. </head>
  25. <body>
  26. <div class="node">
  27. <a name="Replace"></a>
  28. <p>
  29. Next:&nbsp;<a rel="next" accesskey="n" href="Transition.html#Transition">Transition</a>,
  30. Previous:&nbsp;<a rel="previous" accesskey="p" href="Insert.html#Insert">Insert</a>,
  31. Up:&nbsp;<a rel="up" accesskey="u" href="Reference-Implementations.html#Reference-Implementations">Reference Implementations</a>
  32. <hr>
  33. </div>
  34. <h3 class="section">B.3 Replace</h3>
  35. <p><a name="index-g_t_0040code_007breplace_007d-701"></a>This code is needed in the discussion of assignment in <a href="Assignment.html#Assignment">Assignment</a>.
  36. where it serves as a solution to equation <em>E0</em>. The idea is that
  37. the function takes an argument of the form
  38. <code>((</code><var>locations</var><code>,</code><var>values</var><code>),</code><var>store</var><code>)</code> and returns the
  39. store with the values stored at the locations indicated.
  40. <pre class="example">
  41. locations = compose(left,compose(left,argument))
  42. values = compose(right,compose(left,argument))
  43. store = compose(right,argument)
  44. replace =
  45. refer conditional(
  46. store,
  47. (
  48. conditional(
  49. compose(left,locations),
  50. (
  51. conditional(
  52. compose(right,locations),
  53. (
  54. (hired meta)(
  55. self,
  56. couple(
  57. (hired fan right)(locations,values),
  58. (hired meta)(
  59. self,
  60. couple(
  61. (hired fan left)(locations,values),
  62. store)))),
  63. couple(
  64. (hired meta)(
  65. self,
  66. couple(
  67. couple(compose(left,locations),values),
  68. compose(left,store))),
  69. compose(right,store)))),
  70. conditional(
  71. compose(right,locations),
  72. (
  73. couple(
  74. compose(left,store),
  75. (hired meta)(
  76. self,
  77. couple(
  78. couple(compose(right,locations),values),
  79. compose(right,store)))),
  80. values)))),
  81. (hired meta)(
  82. self,
  83. couple(couple(locations,values),constant (nil,nil)))))
  84. </pre>
  85. </body></html>