# Function MISMATCH

### Syntax

• mismatch sequence-1 sequence-2 `&key` from-end test test-not key start1 start2 end1 end2position

### Description

The specified subsequences of sequence-1 and sequence-2 are compared element-wise.

The key argument is used for both the sequence-1 and the sequence-2.

If sequence-1 and sequence-2 are of equal length and match in every element, the result is false. Otherwise, the result is a non-negative integer, the index within sequence-1 of the leftmost or rightmost position, depending on from-end, at which the two subsequences fail to match. If one subsequence is shorter than and a matching prefix of the other, the result is the index relative to sequence-1 beyond the last position tested.

If from-end is true, then one plus the index of the rightmost position in which the sequences differ is returned. In effect, the subsequences are aligned at their right-hand ends; then, the last elements are compared, the penultimate elements, and so on. The index returned is an index relative to sequence-1.

### Examples

```
(mismatch "abcd" "ABCDE" :test #'char-equal)

→
4

(mismatch '(3 2 1 1 2 3) '(1 2 3) :from-end t)

→
3

(mismatch '(1 2 3) '(2 3 4) :test-not #'eq :key #'oddp)

→
NIL

(mismatch '(1 2 3 4 5 6) '(3 4 5 6 7) :start1 2 :end2 4)

→
NIL

```

None.

None.

### Exceptional Situations

None.

• {\secref\TraversalRules}

### Notes

The `:test-not` argument is deprecated.

\issue{SUBSEQ-OUT-OF-BOUNDS} \issue{RANGE-OF-START-AND-END-PARAMETERS:INTEGER-AND-INTEGER-NIL} \issue{MAPPING-DESTRUCTIVE-INTERACTION:EXPLICITLY-VAGUE} \issue{TEST-NOT-IF-NOT:FLUSH-ALL}