lispdoc - results for mismatch |
(mismatch sequence1 sequence2 &rest args &key from-end (test #'eql) (test-not nil) (start1 0) (end1 nil) (start2 0) (end2 nil) (key nil)) | Function: The specified subsequences of SEQUENCE1 and SEQUENCE2 are compared element-wise. If they are of equal length and match in every element, the result is NIL. Otherwise, the result is a non-negative integer, the index within SEQUENCE1 of the leftmost position at which they fail to match; or, if one is shorter than and a matching prefix of the other, the index within SEQUENCE1 beyond the last position tested is returned. If a non-NIL :FROM-END argument is given, then one plus the index of the rightmost position in which the sequences differ is returned.
|
Example:(defun seq-starts-as (text prefix-str) "returns non-nil iff TEXT starts as STR" (let ((diff-pos (mismatch prefix-str text))) (or (null diff-pos) (>= diff-pos (length prefix-str))))) | Mentioned in: CLtL2 - 14.4. Searching Sequences for Items CLtL2 - 15.5. Using Lists as Sets HyperSpec - 3.5.1 Argument Mismatch Detection HyperSpec - 3.5.1.7 Destructuring Mismatch HyperSpec - Function MISMATCH PCL - subsequence manipulations Successful Lisp - chapter13 |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
| By Bill Moorier |