Predicates.html 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <html lang="en">
  2. <head>
  3. <title>Predicates - 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="Virtual-Code-Semantics.html#Virtual-Code-Semantics" title="Virtual Code Semantics">
  9. <link rel="prev" href="Assignment.html#Assignment" title="Assignment">
  10. <link rel="next" href="Iteration.html#Iteration" title="Iteration">
  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="Predicates"></a>
  28. <p>
  29. Next:&nbsp;<a rel="next" accesskey="n" href="Iteration.html#Iteration">Iteration</a>,
  30. Previous:&nbsp;<a rel="previous" accesskey="p" href="Assignment.html#Assignment">Assignment</a>,
  31. Up:&nbsp;<a rel="up" accesskey="u" href="Virtual-Code-Semantics.html#Virtual-Code-Semantics">Virtual Code Semantics</a>
  32. <hr>
  33. </div>
  34. <h4 class="subsection">2.7.11 Predicates</h4>
  35. <p><a name="index-predicates-310"></a>A couple of operations are built into the virtual machine for performing
  36. tests efficiently. These functions return either <code>nil</code> for false or
  37. <code>(nil,nil)</code> for true, and are useful for example as a predicate
  38. <var>p</var> in programs of the form
  39. <code>conditional(</code><var>p</var><code>,(</code><var>f</var><code>,</code><var>g</var><code>))</code> among other things. In
  40. this example, the predicate is applied to the argument, a result of
  41. <code>(nil,nil)</code> causes <var>f</var> to be applied to it, and a result
  42. of <code>nil</code> causes <var>g</var> to be applied to it.
  43. <ul class="menu">
  44. <li><a accesskey="1" href="Compare.html#Compare">Compare</a>
  45. <li><a accesskey="2" href="Member.html#Member">Member</a>
  46. </ul>
  47. </body></html>