Use define-syntax-parser in auto-hash-ref/explicit.
This commit is contained in:
parent
b07cda477f
commit
5aa816507d
1 changed files with 6 additions and 7 deletions
|
@ -1,6 +1,6 @@
|
|||
#lang typed/racket
|
||||
|
||||
(require typed/graph typed-compose typed/racket/stream
|
||||
(require typed/graph typed-compose typed/racket/stream syntax/parse/define
|
||||
(for-syntax syntax/parse racket/list))
|
||||
|
||||
(provide
|
||||
|
@ -45,12 +45,11 @@
|
|||
(check-equal? (eval1-with ht expr)
|
||||
4)))
|
||||
|
||||
(define-syntax (auto-hash-ref/explicit stx)
|
||||
(syntax-parse stx
|
||||
(define-syntax-parser auto-hash-ref/explicit
|
||||
[(_ (ht:id keys:id ...) body:expr)
|
||||
#`(let #,(for/list ([key (syntax->list #'(keys ...))])
|
||||
`[,key (hash-ref ,#'ht ',key)])
|
||||
body)]))
|
||||
body)])
|
||||
|
||||
(module+ test
|
||||
(test-case "auto-hash-ref/explicit"
|
||||
|
|
Loading…
Reference in a new issue