| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Explanations through examples
-
?-matches any s-expr -
amatches the atom'a. -
?amatches any expression, and binds the variableato this expression. -
(? integer?)matches any integer -
(a (a b))matches the only list'(a (a b)). -
???-can only appear at the end of a list, and always succeeds. For instance,(a ???-)is equivalent to(a . ?-). - when occurring in a list,
??-matches any sequence of anything:(a ??- b)matches any list whosecarisaand lastcarisb. -
(a ...)matches any list ofa’s, possibly empty. -
(?x ?x)matches any list of length 2 whosecaris eq to itscadr -
((and (not a) ?x) ?x)matches any list of length 2 whosecaris not eq to'abut is eq to itscadr -
#(?- ?- ???-)matches any vector whose length is at least 2. -
#{foo (?- . ?-) (? integer?)}matches any structure or recordfoowhose first and second fields are respectively a pair and an integer. You can provide only the fields you want to test. The order is not relevant.
Remark: ??- and ... patterns can not appear
inside a vector, where you should use ???-: For example,
#(a ??- b) or #(a...) are invalid patterns, whereas
#(a ???-) is valid and matches any vector whose first element
is the atom a.
| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on October 23, 2011 using texi2html 5.0.
