Use define-syntax-parse-rule in make-tabulate*.
This commit is contained in:
parent
5aa816507d
commit
1e4f6d3fbc
1 changed files with 6 additions and 7 deletions
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
(module typed typed/racket
|
(module typed typed/racket
|
||||||
(require "utils.rkt"
|
(require "utils.rkt"
|
||||||
|
syntax/parse/define
|
||||||
(only-in typed/racket/unsafe unsafe-provide)
|
(only-in typed/racket/unsafe unsafe-provide)
|
||||||
(for-syntax syntax/parse))
|
(for-syntax syntax/parse))
|
||||||
|
|
||||||
|
@ -76,13 +77,11 @@
|
||||||
(check-false (g #t #f))
|
(check-false (g #t #f))
|
||||||
(check-exn exn:fail? (λ () (g #t #f #f))))
|
(check-exn exn:fail? (λ () (g #t #f #f))))
|
||||||
|
|
||||||
(define-syntax (make-tabulate* stx)
|
(define-syntax-parse-rule (make-tabulate* name:id row-op)
|
||||||
(syntax-parse stx
|
(define (name funcs doms)
|
||||||
[(_ name:id row-op)
|
|
||||||
#'(define (name funcs doms)
|
|
||||||
(for/list ([xs (in-list (apply cartesian-product doms))])
|
(for/list ([xs (in-list (apply cartesian-product doms))])
|
||||||
(row-op xs (for/list ([f funcs]) : (Listof b)
|
(row-op xs (for/list ([f funcs]) : (Listof b)
|
||||||
(apply f xs)))))]))
|
(apply f xs))))))
|
||||||
|
|
||||||
(: tabulate* (All (b a ... ) (-> (Listof (-> a ... b)) (List (Listof a) ... a)
|
(: tabulate* (All (b a ... ) (-> (Listof (-> a ... b)) (List (Listof a) ... a)
|
||||||
(Listof (Listof (U Any b))))))
|
(Listof (Listof (U Any b))))))
|
||||||
|
|
Loading…
Reference in a new issue