| 1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| 2 |
<html> |
| 3 |
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ --> |
| 4 |
<head> |
| 5 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 6 |
<title>mismatch (ANSI and GNU Common Lisp Document)</title> |
| 7 |
|
| 8 |
<meta name="description" content="mismatch (ANSI and GNU Common Lisp Document)"> |
| 9 |
<meta name="keywords" content="mismatch (ANSI and GNU Common Lisp Document)"> |
| 10 |
<meta name="resource-type" content="document"> |
| 11 |
<meta name="distribution" content="global"> |
| 12 |
<meta name="Generator" content="makeinfo"> |
| 13 |
<link href="index.html" rel="start" title="Top"> |
| 14 |
<link href="Sequences-Dictionary.html" rel="up" title="Sequences Dictionary"> |
| 15 |
<link href="replace.html" rel="next" title="replace"> |
| 16 |
<link href="search.html" rel="prev" title="search"> |
| 17 |
<style type="text/css"> |
| 18 |
<!-- |
| 19 |
a.summary-letter {text-decoration: none} |
| 20 |
blockquote.indentedblock {margin-right: 0em} |
| 21 |
div.display {margin-left: 3.2em} |
| 22 |
div.example {margin-left: 3.2em} |
| 23 |
div.lisp {margin-left: 3.2em} |
| 24 |
kbd {font-style: oblique} |
| 25 |
pre.display {font-family: inherit} |
| 26 |
pre.format {font-family: inherit} |
| 27 |
pre.menu-comment {font-family: serif} |
| 28 |
pre.menu-preformatted {font-family: serif} |
| 29 |
span.nolinebreak {white-space: nowrap} |
| 30 |
span.roman {font-family: initial; font-weight: normal} |
| 31 |
span.sansserif {font-family: sans-serif; font-weight: normal} |
| 32 |
ul.no-bullet {list-style: none} |
| 33 |
--> |
| 34 |
</style> |
| 35 |
|
| 36 |
|
| 37 |
</head> |
| 38 |
|
| 39 |
<body lang="en"> |
| 40 |
<span id="mismatch"></span><div class="header"> |
| 41 |
<p> |
| 42 |
Next: <a href="replace.html" accesskey="n" rel="next">replace</a>, Previous: <a href="search.html" accesskey="p" rel="prev">search</a>, Up: <a href="Sequences-Dictionary.html" accesskey="u" rel="up">Sequences Dictionary</a> </p> |
| 43 |
</div> |
| 44 |
<hr> |
| 45 |
<span id="mismatch-_005bFunction_005d"></span><h4 class="subsection">17.3.17 mismatch [Function]</h4> |
| 46 |
|
| 47 |
<p><code>mismatch</code> <i>sequence-1 sequence-2 |
| 48 |
<span class="roman">&key</span> from-end test test-not key start1 start2 end1 end2</i><br> |
| 49 |
⇒ <i>position</i> |
| 50 |
</p> |
| 51 |
<span id="Arguments-and-Values_003a_003a-369"></span><h4 class="subsubheading">Arguments and Values::</h4> |
| 52 |
|
| 53 |
<p><i>Sequence-1</i>—a <i>sequence</i>. |
| 54 |
</p> |
| 55 |
<p><i>Sequence-2</i>—a <i>sequence</i>. |
| 56 |
</p> |
| 57 |
<p><i>from-end</i>—a <i>generalized boolean</i>. |
| 58 |
The default is <i>false</i>. |
| 59 |
</p> |
| 60 |
<p><i>test</i>—a <i>designator</i> for a <i>function</i> of two <i>arguments</i> |
| 61 |
that returns a <i>generalized boolean</i>. |
| 62 |
</p> |
| 63 |
<p><i>test-not</i>—a <i>designator</i> for |
| 64 |
a <i>function</i> of two <i>arguments</i> |
| 65 |
that returns a <i>generalized boolean</i>. |
| 66 |
</p> |
| 67 |
<p><i>start1</i>, <i>end1</i>—<i>bounding index designators</i> of <i>sequence-1</i>. |
| 68 |
The defaults for <i>start1</i> and <i>end1</i> are <tt>0</tt> and <b>nil</b>, respectively. |
| 69 |
</p> |
| 70 |
<p><i>start2</i>, <i>end2</i>—<i>bounding index designators</i> of <i>sequence-2</i>. |
| 71 |
The defaults for <i>start2</i> and <i>end2</i> are <tt>0</tt> and <b>nil</b>, respectively. |
| 72 |
</p> |
| 73 |
<p><i>key</i>—a <i>designator</i> for a <i>function</i> of one argument, |
| 74 |
or <b>nil</b>. |
| 75 |
</p> |
| 76 |
<p><i>position</i>—a <i>bounding index</i> of <i>sequence-1</i>, |
| 77 |
or <b>nil</b>. |
| 78 |
</p> |
| 79 |
<span id="Description_003a_003a-484"></span><h4 class="subsubheading">Description::</h4> |
| 80 |
|
| 81 |
<p>The specified subsequences of |
| 82 |
<i>sequence-1</i> and <i>sequence-2</i> are compared element-wise. |
| 83 |
</p> |
| 84 |
<p>The <i>key</i> argument is used for both the <i>sequence-1</i> and the <i>sequence-2</i>. |
| 85 |
</p> |
| 86 |
<p>If <i>sequence-1</i> and <i>sequence-2</i> |
| 87 |
are of equal length and match in every element, the result is |
| 88 |
<i>false</i>. Otherwise, the result is a non-negative <i>integer</i>, |
| 89 |
the index within |
| 90 |
<i>sequence-1</i> of the leftmost or rightmost position, depending |
| 91 |
on <i>from-end</i>, at which the two |
| 92 |
subsequences fail to match. |
| 93 |
If one subsequence |
| 94 |
is shorter than and a matching prefix of the other, |
| 95 |
the result is the index |
| 96 |
relative to <i>sequence-1</i> beyond the last position tested. |
| 97 |
</p> |
| 98 |
<p>If <i>from-end</i> is <i>true</i>, then one plus the index of the rightmost |
| 99 |
position in which the <i>sequences</i> |
| 100 |
differ is returned. In effect, the subsequences |
| 101 |
are aligned at their right-hand ends; then, the last elements are compared, |
| 102 |
the penultimate elements, and so on. The index returned is |
| 103 |
an index relative to <i>sequence-1</i>. |
| 104 |
</p> |
| 105 |
<span id="Examples_003a_003a-351"></span><h4 class="subsubheading">Examples::</h4> |
| 106 |
<div class="example"> |
| 107 |
<pre class="example"> (mismatch "abcd" "ABCDE" :test #'char-equal) ⇒ 4 |
| 108 |
(mismatch '(3 2 1 1 2 3) '(1 2 3) :from-end t) ⇒ 3 |
| 109 |
(mismatch '(1 2 3) '(2 3 4) :test-not #'eq :key #'oddp) ⇒ NIL |
| 110 |
(mismatch '(1 2 3 4 5 6) '(3 4 5 6 7) :start1 2 :end2 4) ⇒ NIL |
| 111 |
</pre></div> |
| 112 |
|
| 113 |
<span id="See-Also_003a_003a-394"></span><h4 class="subsubheading">See Also::</h4> |
| 114 |
|
| 115 |
<p><a href="Traversal-Rules-and-Side-Effects.html">Traversal Rules and Side Effects</a> |
| 116 |
</p> |
| 117 |
<span id="Notes_003a_003a-265"></span><h4 class="subsubheading">Notes::</h4> |
| 118 |
|
| 119 |
<p>The <tt>:test-not</tt> <i>argument</i> is deprecated. |
| 120 |
</p> |
| 121 |
<hr> |
| 122 |
<div class="header"> |
| 123 |
<p> |
| 124 |
Next: <a href="replace.html" accesskey="n" rel="next">replace</a>, Previous: <a href="search.html" accesskey="p" rel="prev">search</a>, Up: <a href="Sequences-Dictionary.html" accesskey="u" rel="up">Sequences Dictionary</a> </p> |
| 125 |
</div> |
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
</body> |
| 130 |
</html> |