Version: 4.1.4.1
15 Match utilities
(require (planet untyped/unlib/match)) |
Additional patterns for use in scheme/match expressions like match and match-lambda.
(eq? expr pattern ) |
Binds values that are eq? to expr. Behaves similarly to the built-in ? pattern: if the eq? pattern matches, the other patterns are also matched against the same value.
Examples: | |||||
> (define x 123) | |||||
| |||||
> (eq-to-x? 123) | |||||
"yes: 123" | |||||
> (eq-to-x? 234) | |||||
"no" |
(equal? expr pattern ) |
Binds values that are equal? to expr. Behaves similarly to the built-in ? pattern: if the equal? pattern matches, the other patterns are also matched against the same value.
Examples: | |||||
> (define x "123") | |||||
| |||||
> (equal-to-x? "123") | |||||
"yes: 123" | |||||
> (equal-to-x? "456") | |||||
"no" |