/ docs / html /
/docs/html/array-template-class.html
  1 <html>
  2  <head>
  3      <title>CL Unification: Class ARRAY-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 ARRAY-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>ARRAY-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   ARRAY-TEMPLATE, TYPE-TEMPLATE, TEMPLATE, STANDARD-OBJECT, T.
 47   </p>
 48 
 49   <h2>Known Subclasses:</h2>
 50 
 51   <p>
 52   VECTOR-TEMPLATE.
 53   </p>
 54 
 55 
 56   <h2>Slots:</h2>
 57 
 58   <p>None.</p>
 59 
 60 
 61   <h2>Description:</h2>
 62 
 63   <p>The ARRAY-TEMPLATE class denotes those object  that are used
 64   to unify against an ARRAY.</p>
 65 
 66   <h3>Template Syntax:</h3>
 67 
 68   <p>
 69   <pre>
 70   #T(<b>array</b> <i>&lt;shape-template&gt;</i>)
 71   </pre>
 72   </p>
 73 
 74   <p>
 75   <pre>
 76   #T(<i>&lt;<strong>CL</strong> array type specifier&gt;</i> <i>&lt;shape-template&gt;</i>)
 77   </pre>
 78   </p>
 79 
 80   <p>
 81   <pre>
 82   #T(<b>array</b> ([* | <i>&lt;<strong>CL</strong> type specifier&gt;</i>] [<i>&lt;dimension sped&gt;</i>]) <i>&lt;shape-template&gt;</i>)
 83   </pre>
 84   </p>
 85 
 86   <p>Where <i>&lt;shape-template&gt;</i> can be:</p>
 87 
 88   <p>
 89   <pre>
 90   <i>&lt;shape-template&gt;</i> ::= <i>&lt;sequence-template&gt;</i>
 91                    |   <i>&lt;destructuring template lambda list&gt;</i>
 92                    |   (<i>&lt;shape-template&gt;</i>)
 93   </pre>
 94   </p>
 95   
 96 
 97   <p>The ARRAY-TEMPLATE syntax denotes an ARRAY object.  An
 98   ARRAY-TEMPLATE must be unified against an ARRAY object. The elements
 99   of the array must be unified against the
100   <i>&lt;shape-template&gt;</i>.  Each row of the array is unified
101   recursively against each element of the <i>&lt;shape-template&gt;</i>.
102 
103 
104 
105   <h2>Examples:</h2>
106 
107   <p>
108   <pre>
109   cl-prompt> (setf e (unify #(0 1 42 3 4 5) #T(<b>array</b> (0 1 ?x 3 4 5))))
110   #&lt;ENVIRONMENT xxx&gt;
111   
112   cl-prompt> (find-variable-value '?x e)
113   42
114 
115   cl-prompt> (setq e (unify #(0 1 42 3 4 5)  #T(<b>array</b> (0 1 "FOO" 3 4 5))))
116   --> Error: UNIFICATION-FAILURE
117 
118   cl-prompt> (setq e (unify #2A((0 1 42) (3 4 5)) #T(<b>array</b> ((0 1 ?x) (3 4 5)))))
119   #&lt;ENVIRONMENT xxx&gt;
120 
121   cl-prompt> (find-variable-value '?x e)
122   42
123 
124   cl-prompt> (setq e (unify #2A(("foo" "bar" 42) (3 4 5)) #T(<b>array</b> ((_ _ ?x) (3 4 5)))))
125   #&lt;ENVIRONMENT xxx&gt;
126 
127   cl-prompt> (find-variable-value '?x e)
128   42
129 
130   cl-prompt> (setq e (unify #2A(("foo" "bar" 42) (3 4 5)) #T(<b>array</b> (#T(vector _ &rest ?x) (3 4 5)))))
131   #&lt;ENVIRONMENT xxx&gt;
132 
133   cl-prompt> (find-variable-value '?x e)
134   #("bar" 42)
135   </pre>
136   </p>
137 
138 
139   <h2>Affected By:</h2>
140 
141   <p>None.</p>
142 
143 
144   <h2>Exceptional Situations:</h2>
145 
146   <p>Unifying an ARRAY-TEMPLATE against a non-ARRAY object results in
147   an UNIFICATION-FAILURE error being signaled.</p>
148 
149 
150   <h2>See Also:</h2>
151 
152   <p>UNIFY</p>
153 
154   <h2>Notes:</h2>
155 
156   <h3>Syntax Note</h3>
157 
158   <p>The ARRAY-TEMPLATE syntax tries to be easy to use, at the cost of
159   being overloaded.  There is no actual need to have the separate
160   forms <code>(<b>array</b> (fixnum) ...)</code> and
161   <code>((<b>array</b> fixnum) ...)</code>.</p>
162 
163   <p>In a future release they may be conflated.  For the time being
164   they are kept separate as it is unclear which would be better to
165   provide.</p>
166 
167   <h3>Elements Unification</h3>
168 
169   <p>It would be nice to have the possibility to unify against
170   <em>slices</em> of the array.  Alas, this seems non trivial to get
171   right, and it is left as a future extension of the semantics of
172   <i>&lt;shape-template&gt;</i>.</p>
173 
174   <h3>ARRAY Structural Properties</h3>
175 
176   <p>There is no way to "unify" against structural properties of
177   vectors like fill pointers and displacements.</p>
178 
179 
180  </td>
181  
182  <!--  <td height="100%">&nbsp;</td> -->
183  </tr>
184 
185  <tr height="100%">
186   <td height="100%">&nbsp;</td>
187   <td valign="top" width="80%" height="100%">
188 
189   <div class="content">
190   <div class="text" style="padding-top: 10px;">
191 
192   <h1>News</h1>
193 
194   <p>News in chronological order, most recent on top.
195   </p>
196 
197   <ul>
198   <li><strong>2004-10-30</strong><br>
199       Completed description.
200   </li>
201 
202   </ul>
203 
204   </div>
205   </div>
206 						
207  </td>
208  
209  <td height="100%">&nbsp;</td>
210  </tr>
211 
212 
213 
214  
215  <tr>
216   <td colspan="3" valign="bottom" align="right">
217   <div class="copyright">
218   &copy; 2003-2004, Marco Antoniotti, all rights reserved.
219   </div>
220   </td>
221  </tr>
222  
223  </table>
224  </body>
225 </html>
226 
227 <!-- end of file -- expression-template-class.html -->