Ticket #1020: arrows-and-questionmarks.diff

File arrows-and-questionmarks.diff, 1.7 KB (added by Moritz Heidkamp, 8 years ago)
  • matchable.scm

     
    125125;; pattern so far.
    126126
    127127(define-syntax match-two
    128   (syntax-rules (_ ___ ..1 *** quote quasiquote ? $ = and or not set! get!)
     128  (syntax-rules (_ ___ ..1 *** quote quasiquote ? -> -?> $ = and or not set! get!)
    129129    ((match-two v () g+s (sk ...) fk i)
    130130     (if (null? v) (sk ... i) fk))
    131131    ((match-two v (quote p) g+s (sk ...) fk i)
     
    148148     (let ((setter (lambda (x) (s ... x)))) (sk ... i)))
    149149    ((match-two v (? pred . p) g+s sk fk i)
    150150     (if (pred v) (match-one v (and . p) g+s sk fk i) fk))
     151    ((match-two v (-> convert . p) g+s sk fk i)
     152     (let ((w (convert v))) (match-one w (and . p) g+s sk fk i)))
     153    ((match-two v (-?> convert . p) g+s sk fk i)
     154     (match-two v (-> convert (? (lambda (x) x) . p)) g+s sk fk i))
    151155    ((match-two v (= proc p) . x)
    152156     (let ((w (proc v))) (match-one w p . x)))
    153157    ((match-two v (p ___ . r) g+s sk fk i)
     
    515519;; (match-extract-vars pattern continuation (ids ...) (new-vars ...))
    516520
    517521(define-syntax match-extract-vars
    518   (syntax-rules (_ ___ ..1 *** ? $ = quote quasiquote and or not get! set!)
     522  (syntax-rules (_ ___ ..1 *** ? -> -?> $ = quote quasiquote and or not get! set!)
    519523    ((match-extract-vars (? pred . p) . x)
    520524     (match-extract-vars p . x))
     525    ((match-extract-vars (-> convert . p) . x)
     526     (match-extract-vars p . x))
     527    ((match-extract-vars (-?> convert . p) . x)
     528     (match-extract-vars p . x))
    521529    ((match-extract-vars ($ rec . p) . x)
    522530     (match-extract-vars p . x))
    523531    ((match-extract-vars (= proc p) . x)