Add unstable/match with == match expander.
Add 'match expander' tech def. svn: r16814 original commit: 0ae5843f1163a247f776b47ac29e38e31664bc03
This commit is contained in:
parent
40c53e2191
commit
9dbe7c808f
|
@ -2,11 +2,11 @@
|
|||
(require "../utils/utils.ss")
|
||||
|
||||
(require mzlib/struct
|
||||
mzlib/plt-match
|
||||
scheme/match
|
||||
syntax/boundmap
|
||||
"free-variance.ss"
|
||||
"interning.ss"
|
||||
unstable/syntax
|
||||
unstable/syntax unstable/match
|
||||
mzlib/etc
|
||||
scheme/contract
|
||||
(for-syntax
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
[i:boolean (-val (syntax-e #'i))]
|
||||
[i:identifier (-val (syntax-e #'i))]
|
||||
[i:exact-integer -Integer]
|
||||
[i:number -Number]
|
||||
[(~var i (3d real?)) -Number]
|
||||
[i:str -String]
|
||||
[i:char -Char]
|
||||
[i:keyword (-val (syntax-e #'i))]
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
[->* -->*]
|
||||
[one-of/c -one-of/c])
|
||||
(rep type-rep)
|
||||
scheme/contract scheme/match
|
||||
scheme/contract scheme/match unstable/match
|
||||
(for-syntax scheme/base))
|
||||
|
||||
(provide combine-filter apply-filter abstract-filter abstract-filters
|
||||
|
|
|
@ -11,7 +11,7 @@ at least theoretically.
|
|||
scheme/pretty mzlib/pconvert syntax/parse)
|
||||
|
||||
;; to move to unstable
|
||||
(provide == debug reverse-begin)
|
||||
(provide debug reverse-begin)
|
||||
|
||||
(provide
|
||||
;; timing
|
||||
|
@ -140,14 +140,6 @@ at least theoretically.
|
|||
(printf "Timing ~a at ~a@~a~n" msg diff t)))]))
|
||||
(values (lambda _ #'(void)) (lambda _ #'(void)))))
|
||||
|
||||
|
||||
(define-match-expander
|
||||
==
|
||||
(lambda (stx)
|
||||
(syntax-case stx ()
|
||||
[(_ val)
|
||||
#'(? (lambda (x) (equal? val x)))])))
|
||||
|
||||
;; custom printing
|
||||
;; this requires lots of work for two reasons:
|
||||
;; - 1 printers have to be defined at the same time as the structs
|
||||
|
|
13
collects/unstable/match.ss
Normal file
13
collects/unstable/match.ss
Normal file
|
@ -0,0 +1,13 @@
|
|||
#lang scheme/base
|
||||
|
||||
(require scheme/match (for-syntax scheme/base))
|
||||
|
||||
(provide ==)
|
||||
|
||||
(define-match-expander
|
||||
==
|
||||
(lambda (stx)
|
||||
(syntax-case stx ()
|
||||
[(_ val comp)
|
||||
#'(? (lambda (x) (comp val x)))]
|
||||
[(_ val) #'(== val equal?)])))
|
Loading…
Reference in New Issue
Block a user