1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <html lang="en">
- <head>
- <title>Member - avram - a virtual machine code interpreter</title>
- <meta http-equiv="Content-Type" content="text/html">
- <meta name="description" content="avram - a virtual machine code interpreter">
- <meta name="generator" content="makeinfo 4.13">
- <link title="Top" rel="start" href="index.html#Top">
- <link rel="up" href="Predicates.html#Predicates" title="Predicates">
- <link rel="prev" href="Compare.html#Compare" title="Compare">
- <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
- <meta http-equiv="Content-Style-Type" content="text/css">
- <style type="text/css"><!--
- pre.display { font-family:inherit }
- pre.format { font-family:inherit }
- pre.smalldisplay { font-family:inherit; font-size:smaller }
- pre.smallformat { font-family:inherit; font-size:smaller }
- pre.smallexample { font-size:smaller }
- pre.smalllisp { font-size:smaller }
- span.sc { font-variant:small-caps }
- span.roman { font-family:serif; font-weight:normal; }
- span.sansserif { font-family:sans-serif; font-weight:normal; }
- --></style>
- </head>
- <body>
- <div class="node">
- <a name="Member"></a>
- <p>
- Previous: <a rel="previous" accesskey="p" href="Compare.html#Compare">Compare</a>,
- Up: <a rel="up" accesskey="u" href="Predicates.html#Predicates">Predicates</a>
- <hr>
- </div>
- <h5 class="subsubsection">2.7.11.2 Member</h5>
- <p>Another built in predicate function has the virtual code shown below.
- <a name="index-g_t_0040code_007bmember_007d-313"></a>
- <dl>
- <dt><em>T20</em><dd>[[<code>member</code>]] = <code>((nil,nil),((nil,nil),nil))</code>
- </dl>
- <p class="noindent">As the mnemonic suggests, the function implemented by this code detects
- whether a given item is a member of a list. The left side of its
- argument is the item to be detected, and the right side is the list that
- may or may not contain it. Lists are represented as explained in
- <a href="Representation-of-Numeric-and-Textual-Data.html#Representation-of-Numeric-and-Textual-Data">Representation of Numeric and Textual Data</a>.
- <p>The virtual code semantics can be specified by these three properties of
- the operator.
- <dl>
- <dt><em>P19</em><dd>[[<code>member</code>]] <code>(</code><var>x</var><code>,nil)</code> = <code>nil</code>
- <br><dt><em>P20</em><dd>[[<code>member</code>]] <code>(</code><var>x</var><code>,(</code><var>x</var><code>,</code><var>y</var><code>))</code> = <code>(nil,nil)</code>
- <br><dt><em>P21</em><dd>For distinct trees <var>x</var> and <var>y</var>, [[<code>member</code>]] <code>(</code><var>x</var><code>,(</code><var>y</var><code>,</code><var>z</var><code>))</code> =
- [[<code>member</code>]] <code>(</code><var>x</var><code>,z)</code>
- </dl>
- <p>As in the case of <code>compare</code>, the implementation of <code>member</code> is
- well optimized in C, so this form is to be preferred over an ad hoc
- construction of a membership testing function in virtual code.
- </body></html>
|