extended hash-table to accept flags
original commit: 0963e8c203a548ba12f0af88bf1e7a5f1a498944
This commit is contained in:
parent
6cd65dddb1
commit
b702ac3edd
|
@ -496,14 +496,19 @@
|
|||
(syntax/loc stx
|
||||
(define-syntaxes (id ...)
|
||||
(finish-syntax-set orig-stx)))))]))
|
||||
|
||||
|
||||
(define-syntax (hash-table stx)
|
||||
(syntax-case stx ()
|
||||
[(_ (key value) ...)
|
||||
(syntax/loc stx
|
||||
(let ([ht (make-hash-table)])
|
||||
(hash-table-put! ht key value) ...
|
||||
ht))]))
|
||||
(syntax-case stx (quote)
|
||||
[(_ x ...)
|
||||
(let loop ([xs #'(x ...)] [flags '()])
|
||||
(syntax-case xs (quote)
|
||||
[('flag x ...) (loop #'(x ...) (cons #''flag flags))]
|
||||
[([key val] ...)
|
||||
(with-syntax ([(flag ...) (reverse flags)])
|
||||
(syntax/loc stx
|
||||
(let ([ht (make-hash-table flag ...)])
|
||||
(hash-table-put! ht key val) ...
|
||||
ht)))]))]))
|
||||
|
||||
(define-syntax (begin-with-definitions stx)
|
||||
;; Body can have mixed exprs and defns. Wrap expressions with
|
||||
|
|
Loading…
Reference in New Issue
Block a user