Transpose.html 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <html lang="en">
  2. <head>
  3. <title>Transpose - 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="List-Functions.html#List-Functions" title="List Functions">
  9. <link rel="prev" href="Distribute.html#Distribute" title="Distribute">
  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="Transpose"></a>
  27. <p>
  28. Previous:&nbsp;<a rel="previous" accesskey="p" href="Distribute.html#Distribute">Distribute</a>,
  29. Up:&nbsp;<a rel="up" accesskey="u" href="List-Functions.html#List-Functions">List Functions</a>
  30. <hr>
  31. </div>
  32. <h5 class="subsubsection">2.7.14.4 Transpose</h5>
  33. <p>The <code>transpose</code> operation has the following representation in
  34. virtual code.
  35. <dl>
  36. <dt><em>T31</em><dd>[[<code>transpose</code>]] = <code>((nil,nil),((nil,nil),(nil,nil)))</code>
  37. </dl>
  38. <p class="noindent"><a name="index-g_t_0040code_007btranspose_007d-346"></a>This function takes a list of equal length lists as an argument, and
  39. returns a list of lists as a result. In the resulting list, the first
  40. item is the list of all first items of lists in the argument. The next
  41. item is the list of all second items, and so on.
  42. <p>In the specification of the semantics, the <code>silly</code> mnemonic
  43. <a name="index-g_t_0040code_007bflat_007d-347"></a><code>flat</code> is defined by <code>flat = reduce(cat,nil)</code> in the standard
  44. <code>silly</code> prelude, which means that it flattens a list of lists into
  45. one long list.
  46. <dl>
  47. <dt><em>P41</em><dd>[[<code>transpose</code>]] <var>x</var> = <code>nil</code> if [[<code>flat</code>]] <var>x</var> = <code>nil</code>
  48. <br><dt><em>P42</em><dd>[[<code>transpose</code>]] <var>x</var> =
  49. <code>(</code>[[<code>map left</code>]] <var>x</var><code>,</code>[[<code>transpose</code>]] [[<code>map right</code>]] <var>x</var><code>)</code><br>
  50. &nbsp;<!-- /@w -->&nbsp;<!-- /@w -->&nbsp;<!-- /@w --> if [[<code>flat</code>]] <var>x</var> is a non-<code>nil</code> tree
  51. </dl>
  52. </body></html>