This site is a static rendering of the Trac instance that was used by R7RS-WG1 for its work on R7RS-small (PDF), which was ratified in 2013. For more information, see Home.
Source for wiki SearchMismatchCowan version 1
author
cowan
comment
ipnr
198.185.18.207
name
SearchMismatchCowan
readonly
0
text
This is a small WG2 proposal for Scheme procedures corresponding to the Common Lisp functions [http://www.lispworks.com/documentation/lw50/CLHS/Body/f_search.htm SEARCH] and [http://www.lispworks.com/documentation/lw50/CLHS/Body/f_mismat.htm MISMATCH].
`(vector-search `''test''` `''vector1''` `''vector2''` ` [ [ [ [ ''start1'' ] ''end1'' ] ''start2'' ] ''end2'' ]`)`
`(vector-rsearch `''test''` `''vector1''` `''vector2''` ` [ [ [ [ ''start1'' ] ''end1'' ] ''start2'' ] ''end2'' ]`)`
Searches ''vector2'' from ''start2'' to ''end2'' for the leftmost (for `vector-search`) or the rightmost (for `vector-rsearch`) sub-vector whose elements are the same (in the sense of ''test'') as those of ''vector1'' from ''start1'' to ''end1''. ''Test'' is a predicate of two arguments. The usual default rules and restrictions apply to the start and end arguments.
Returns an index into ''vector2'' if the search succeeds, or `#f` if it fails.
The order in which the search is made is unspecified; in particular, `vector-rsearch` may search from left to right rather than right to left. The number of times that ''test'' is invoked is also unspecified.
`(list-search `''test''` `''list1''` `''list2''` ` [ [ [ [ ''start1'' ] ''end1'' ] ''start2'' ] ''end2'' ]`)`
`(list-rsearch `''test''` `''list1''` `''list2''` ` [ [ [ [ ''start1'' ] ''end1'' ] ''start2'' ] ''end2'' ]`)`
Analogous to `vector-search` and `vector-rsearch`, but applicable to lists.
`(string-search `''test''` `''string1''` `''string2''` ` [ [ [ [ ''start1'' ] ''end1'' ] ''start2'' ] ''end2'' ]`)`
`(string-rsearch `''test''` `''string1''` `''string2''` ` [ [ [ [ ''start1'' ] ''end1'' ] ''start2'' ] ''end2'' ]`)`
Analogous to `vector-search` and `vector-rsearch`, but applicable to strings.
`(vector-mismatch `''test''` `''vector1''` `''vector2''` ` [ [ [ [ ''start1'' ] ''end1'' ] ''start2'' ] ''end2'' ]`)`
`(vector-rmismatch `''test''` `''vector1''` `''vector2''` ` [ [ [ [ ''start1'' ] ''end1'' ] ''start2'' ] ''end2'' ]`)`
Compares ''vector1'' from ''start1'' to ''end1'' element-wise with ''vector2'' from ''start2'' to ''end2''. If there are the same number of elements, and they are the same in the sense of ''test'', then returns `#f`, otherwise returns the leftmost (for `vector-mismatch`) or the rightmost (for `vector-rmismatch`) position within ''vector1'' at which they fail to match. ''Test'' is a predicate of two arguments. The usual default rules and restrictions apply to the start and end arguments.
The order in which the examination is made is unspecified; in particular, `vector-rmismatch` may examine elements from left to right rather than right to left. The number of times that ''test'' is invoked is also unspecified.
`(list-mismatch `''test''` `''list1''` `''list2''` ` [ [ [ [ ''start1'' ] ''end1'' ] ''start2'' ] ''end2'' ]`)`
`(list-rmismatch `''test''` `''list1''` `''list2''` ` [ [ [ [ ''start1'' ] ''end1'' ] ''start2'' ] ''end2'' ]`)`
Analogous to `vector-mismatch` and `vector-rmismatch`, but applicable to lists.
`(string-mismatch `''test''` `''string1''` `''string2''` ` [ [ [ [ ''start1'' ] ''end1'' ] ''start2'' ] ''end2'' ]`)`
`(string-rmismatch `''test''` `''string1''` `''string2''` ` [ [ [ [ ''start1'' ] ''end1'' ] ''start2'' ] ''end2'' ]`)`
Analogous to `vector-mismatch` and `vector-rmismatch`, but applicable to strings.
time
2012-11-19 14:33:29
version
1