Lists.html 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <html lang="en">
  2. <head>
  3. <title>Lists - 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="Library-Reference.html#Library-Reference" title="Library Reference">
  9. <link rel="prev" href="Library-Reference.html#Library-Reference" title="Library Reference">
  10. <link rel="next" href="Characters-and-Strings.html#Characters-and-Strings" title="Characters and Strings">
  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="Lists"></a>
  28. <p>
  29. Next:&nbsp;<a rel="next" accesskey="n" href="Characters-and-Strings.html#Characters-and-Strings">Characters and Strings</a>,
  30. Previous:&nbsp;<a rel="previous" accesskey="p" href="Library-Reference.html#Library-Reference">Library Reference</a>,
  31. Up:&nbsp;<a rel="up" accesskey="u" href="Library-Reference.html#Library-Reference">Library Reference</a>
  32. <hr>
  33. </div>
  34. <h3 class="section">3.1 Lists</h3>
  35. <p>The basic data structure used for representing virtual code and data in
  36. the <code>avram</code> library is declared as a <code>list</code>.
  37. <a name="index-lists-396"></a><a name="index-g_t_0040code_007bhead_007d-field-397"></a><a name="index-g_t_0040code_007btail_007d-field-398"></a>The <code>list</code> type is a pointer to a structure having a <code>head</code>
  38. field and a <code>tail</code> field, which are also lists. The empty tree,
  39. <code>nil</code>, is represented by the C constant <code>NULL</code>. A tree of the
  40. form <code>cons(</code><var>a</var><code>,</code><var>b</var><code>)</code> is represented in C as a list whose
  41. <code>head</code> is the representation of <var>a</var> and whose
  42. <code>tail</code> is the representation of <var>b</var>.
  43. <p>A number of other fields in the structure are maintained automatically
  44. and should not be touched. For that matter, even the <code>head</code> and
  45. <code>tail</code> fields should be considered read-only. Because of sharing,
  46. it is almost never valid to modify a list &ldquo;in place&rdquo;, except for cases
  47. that are already covered by library functions.
  48. <ul class="menu">
  49. <li><a accesskey="1" href="Simple-Operations.html#Simple-Operations">Simple Operations</a>
  50. <li><a accesskey="2" href="Recoverable-Operations.html#Recoverable-Operations">Recoverable Operations</a>
  51. <li><a accesskey="3" href="List-Transformations.html#List-Transformations">List Transformations</a>
  52. <li><a accesskey="4" href="Type-Conversions.html#Type-Conversions">Type Conversions</a>
  53. <li><a accesskey="5" href="Comparison.html#Comparison">Comparison</a>
  54. <li><a accesskey="6" href="Deconstruction-Functions.html#Deconstruction-Functions">Deconstruction Functions</a>
  55. <li><a accesskey="7" href="Indirection.html#Indirection">Indirection</a>
  56. <li><a accesskey="8" href="The-Universal-Function.html#The-Universal-Function">The Universal Function</a>
  57. </ul>
  58. </body></html>