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
|
||||
(require "utils.rkt"
|
||||
syntax/parse/define
|
||||
(only-in typed/racket/unsafe unsafe-provide)
|
||||
(for-syntax syntax/parse))
|
||||
|
||||
|
@ -76,13 +77,11 @@
|
|||
(check-false (g #t #f))
|
||||
(check-exn exn:fail? (λ () (g #t #f #f))))
|
||||
|
||||
(define-syntax (make-tabulate* stx)
|
||||
(syntax-parse stx
|
||||
[(_ name:id row-op)
|
||||
#'(define (name funcs doms)
|
||||
(for/list ([xs (in-list (apply cartesian-product doms))])
|
||||
(row-op xs (for/list ([f funcs]) : (Listof b)
|
||||
(apply f xs)))))]))
|
||||
(define-syntax-parse-rule (make-tabulate* name:id row-op)
|
||||
(define (name funcs doms)
|
||||
(for/list ([xs (in-list (apply cartesian-product doms))])
|
||||
(row-op xs (for/list ([f funcs]) : (Listof b)
|
||||
(apply f xs))))))
|
||||
|
||||
(: tabulate* (All (b a ... ) (-> (Listof (-> a ... b)) (List (Listof a) ... a)
|
||||
(Listof (Listof (U Any b))))))
|
||||
|
|
Loading…
Reference in a new issue