1 <html> 2 <head> 3 <title>CL Unification: Macro MATCH-CASE</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: Macro MATCH-CASE</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%"> </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>Macro</i> <strong>MATCH-CASE</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>Syntax:</h2> 44 45 46 <p> 47 <pre> 48 <b>match-case</b> (<i>object</i> &key <i>errorp</i>) <clause>*</i> 49 => <i>results</i>* 50 </pre> 51 </p> 52 53 <p> 54 <pre> 55 <clause> ::= <regular clause> | <default clause> 56 <regular clause> ::= (<i>template</i> &body <i>forms</i>) 57 <default clause> ::= (t &body <i>forms</i>) 58 | (otherwise &body <i>forms</i>) 59 </pre> 60 </p> 61 62 <h3>Arguments and Values:</h3> 63 64 <p><i><code>template</code></i>---a <i>unification template</i> 65 <p><i><code>object</code></i>---an <i>object</i> 66 <p><i><code>substitution</code></i>---a <i>substitution</i> 67 <p><i><code>errorp</code></i>---a <i>generalized boolean</i> 68 <p><i><code>error-value</code></i>---an <i>object</i> 69 <p><i><code>forms</code></i>---an <i>implicit progn</i> 70 <p><i><code>results</code></i>---the <i>values</i> returned by <i>forms</i> 71 72 73 74 75 <h2>Description:</h2> 76 77 <p>MATCH-CASE sets up a CASE-like environment for multiple template matching clauses. 78 Each clause evaluates its forms in an environment where the variables 79 present in the template are bound lexically. Note that both variable 80 names '?FOO' and 'FOO' are bound for convenience.</p> 81 82 <p>The values returned by the MATCH-CASE form are those of the last form in 83 the first clause that satisfies the match test. I.e. the first 84 clause for which the <i>template</i> UNIFYes against <i>object</i>.</p> 85 86 <p>If <i>errorp</i> is non-NIL then if none of the regular clauses matches, then 87 an error of type UNIFICATION-NON-EXHAUSTIVE is signalled, regardless of 88 any default clause. Otherwise, the default clause behaves as a 89 standard COND default clause. The default value of <i>errorp</i> is NIL.</p> 90 91 <h2>Affected By:</h2> 92 93 <p>None.</p> 94 95 96 <h2>Exceptional Situations:</h2> 97 98 <p>See above.</p> 99 100 101 <h2>See Also:</h2> 102 103 <p>UNIFY, UNIFICATION-FAILURE, UNIFICATION-NON-EXHAUSTIVE</p> 104 105 <h2>Notes:</h2> 106 107 <p>Note that UNIFICATION-FAILUREs 108 raising from the evaluation of <i>forms</i> in each clause will 109 <em>not</em> be caught and handled by the enclosing MATCH-CASE block.</p> 110 111 112 </td> 113 114 <!-- <td height="100%"> </td> --> 115 </tr> 116 117 <tr height="100%"> 118 <td height="100%"> </td> 119 <td valign="top" width="80%" height="100%"> 120 121 <div class="content"> 122 <div class="text" style="padding-top: 10px;"> 123 124 <h1>News</h1> 125 126 <p>News in chronological order, most recent on top. 127 </p> 128 129 <ul> 130 <li><strong>2004-06-11</strong><br> 131 Completed description. 132 </li> 133 134 </ul> 135 136 </div> 137 </div> 138 139 </td> 140 141 <td height="100%"> </td> 142 </tr> 143 144 145 146 147 <tr> 148 <td colspan="3" valign="bottom" align="right"> 149 <div class="copyright"> 150 © 2003-2004, Marco Antoniotti, all rights reserved. 151 </div> 152 </td> 153 </tr> 154 155 </table> 156 </body> 157 </html> 158 159 <!-- end of file -- usci-variable.html -->