diff --git a/utils.rkt b/utils.rkt index c47fadc..0602978 100644 --- a/utils.rkt +++ b/utils.rkt @@ -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 - [(_ (ht:id keys:id ...) body:expr) - #`(let #,(for/list ([key (syntax->list #'(keys ...))]) - `[,key (hash-ref ,#'ht ',key)]) - body)])) +(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)]) (module+ test (test-case "auto-hash-ref/explicit"