/ docs / html /
docs/html/aref-template-class.html
  1 <html>
  2  <head>
  3      <title>CL Unification: Class AREF-TEMPLATE</title>
  4      <link rel="stylesheet" href="main.css">
  5  </head>
  6 	
  7  <body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0" bgcolor="#ffffff">
  8 
  9  <table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%" vspace="0" hspace="0">
 10   <tr>
 11   <td colspan="3">
 12    <div class="header"
 13         style="font-family:=Verdana,Arial,Helvetica; font-size: 18px; color: #41286f;">
 14     <strong><i>CL Unification: Class AREF-TEMPLATE</title></i></strong>
 15     <div class="navigation">
 16      <a href="index.html" class="navigation-link">Home</a>
 17       | <a href="unification-package.html" class="navigation-link">Previous</a>
 18       | <a href="index.html" class="navigation-link">Next</a>
 19       | <a href="downloads.html" class="navigation-link">Downloads</a>
 20       |  <a href="links.html" class="navigation-link">Links</a>
 21     </div>
 22    </div>
 23    <div class="black-line"><img src="images/shim.gif" height="1" width="1"></div>
 24    <div class="middle-bar"><img src="images/shim.gif" height="5" width="1"></div>
 25    <div class="black-line"><img src="images/shim.gif" height="1" width="1"></div>
 26   </td>
 27  </tr>
 28 
 29  <tr height="100%">
 30   <td height="100%">&nbsp;</td>
 31   <td valign="top" width="80%" height="100%">
 32 
 33   <div class="content">
 34   <div class="text" style="padding-top: 10px;">
 35 	
 36   <h1><i>Class</i> <strong>AREF-TEMPLATE</strong></h1>
 37 
 38   <h2>Package:</h2>
 39 
 40   <p><code>COMMON-LISP.EXTENSIONS.DATA-AND-CONTROL-FLOW.UNIFICATION</code></p>
 41 
 42 
 43   <h2>Class Precedence List:</h2>
 44 
 45   <p>
 46   AREF-TEMPLATE, ELEMENT-TEMPLATE, EXPRESSION-TEMPLATE, TEMPLATE, STANDARD-OBJECT, T.
 47   </p>
 48 
 49   <h2>Known Subclasses:</h2>
 50 
 51   <p>
 52   None.
 53   </p>
 54 
 55 
 56   <h2>Slots:</h2>
 57 
 58   <p>None.</p>
 59 
 60 
 61   <h2>Description:</h2>
 62 
 63   <p>The AREF-TEMPLATE class denotes those object  that are used
 64   to unify against a particular element of an ARRAY.</p>
 65 
 66   <h3>Template Syntax:</h3>
 67 
 68   <p>
 69   <pre>
 70   #T(<b>aref</b> (<i>index1</i> ... <i>indexN</i>) <i>item</i>)
 71   </pre>
 72   </p>
 73 
 74   <p>
 75   <pre>
 76   #T(<b>aref</b> <i>index</i> <i>item</i>)
 77   </pre>
 78   </p>
 79 
 80   <p>The AREF-TEMPLATE syntax denotes the <i>item</i> at
 81   <i>index1</i> ... <i>indexN</i> of an ARRAY.  An AREF-TEMPLATE must
 82   be unified against a ARRAY object.  <i>item</i> is <em>unified</em>
 83   against the element extracted from the sequence object at
 84   <i>index1</i> ... <i>indexN</i> by the standard function AREF.</p>
 85 
 86   <p>The second form is a shorthand.</p>
 87   <p>
 88   <pre>
 89   #T(<b>aref</b> <i>index</i> <i>item</i>) <==> #T(<b>aref</b> (<i>index</i>) <i>item</i>)
 90   </pre>
 91   </p>
 92   
 93 
 94 
 95   <h2>Examples:</h2>
 96 
 97   <p>
 98   <pre>
 99   cl-prompt> (setf e (unify #(0 1 42 3 4 5) #T(<b>aref</b> 2 ?x)))
100   #&lt;ENVIRONMENT xxx&gt;
101   
102   cl-prompt> (find-variable-value '?x e)
103   42
104 
105   cl-prompt> (setq e (unify #(0 1 42 3 4 5) #T(<b>aref</b> 42 ?x)))
106   --> Error: index 42 out of bounds.
107 
108 
109   cl-prompt> (setq e (unify 42 #T(<b>aref</b> 42 ?x)))
110   --> Error: UNIFICATION-FAILURE
111 
112 
113   cl-prompt> (setq e (unify "This is a string!" #T(<b>aref</b> 4 ?x)))
114   #&lt;ENVIRONMENT xxx&gt;
115 
116   cl-prompt> (find-variable-value '?x e)
117   #\Space  
118 
119 
120   cl-prompt> (setq e (unify #2A((1 0) (foo bar)) #T(<b>aref</b> (1 1) ?x)))
121   #&lt;ENVIRONMENT xxx&gt;
122 
123   cl-prompt> (find-variable-value '?x e)
124   BAR
125 
126 
127   cl-prompt> (setq e (unify #2A((1 0) (foo bar)) #T(<b>aref</b> (1 1) baz)))
128   --> Error: UNIFICATION-FAILURE
129 
130 
131   cl-prompt> (setq e (unify #2A((1 0) (foo ?x)) #T(<b>aref</b> (1 1) baz)))
132   #&lt;ENVIRONMENT xxx&gt;
133 
134   cl-prompt> (find-variable-value '?x e)
135   BAZ
136   </pre>
137   </p>
138 
139 
140   <h2>Affected By:</h2>
141 
142   <p>None.</p>
143 
144 
145   <h2>Exceptional Situations:</h2>
146 
147   <p>Unifying an AREF-TEMPLATE against a non-ARRAY object results in
148   an UNIFICATION-FAILURE error being signaled.</p>
149 
150 
151   <h2>See Also:</h2>
152 
153   <p>UNIFY</p>
154 
155   <h2>Notes:</h2>
156 
157   <p>None.</p>
158 
159  </td>
160  
161  <!--  <td height="100%">&nbsp;</td> -->
162  </tr>
163 
164  <tr height="100%">
165   <td height="100%">&nbsp;</td>
166   <td valign="top" width="80%" height="100%">
167 
168   <div class="content">
169   <div class="text" style="padding-top: 10px;">
170 
171   <h1>News</h1>
172 
173   <p>News in chronological order, most recent on top.
174   </p>
175 
176   <ul>
177   <li><strong>2004-06-11</strong><br>
178       Completed description.
179   </li>
180 
181   </ul>
182 
183   </div>
184   </div>
185 						
186  </td>
187  
188  <td height="100%">&nbsp;</td>
189  </tr>
190 
191 
192 
193  
194  <tr>
195   <td colspan="3" valign="bottom" align="right">
196   <div class="copyright">
197   &copy; 2003-2004, Marco Antoniotti, all rights reserved.
198   </div>
199   </td>
200  </tr>
201  
202  </table>
203  </body>
204 </html>
205 
206 <!-- end of file -- expression-template-class.html -->