NOTE: This library is deprecated; use racket/match, instead.
|(require unstable/match)||package: unstable-lib|
The subsequent bindings were added by Carl Eastlund <[email protected]>.
(match? val-expr pat ...)
(as ([lhs-id rhs-expr] ...) pat ...)
The subsequent bindings were added by Asumu Takikawa <[email protected]>.
(match*? (val-expr ...) (pat ...) ...)
(object maybe-class field-clause ...)
| class-expr field-clause = (field field-id maybe-pat) maybe-pat =
If class-expr is provided, the match expander will also check that the supplied object is an instance of the class that the given expression evaluates to.
(define point% (class object% (super-new) (init-field x y)))
> (match (make-object point% 3 5) [(object point% (field x) (field y)) (sqrt (+ (* x x) (* y y)))])
> (match (make-object point% 0 0) [(object (field x (? zero?)) (field y (? zero?))) 'origin])
> (match (make-object object%) [(object (field x) (field y)) 'ok] [_ 'fail])