auto-hash-ref/explicit: Add an example to the comment.
This commit is contained in:
parent
c33641fd66
commit
51e7ba3072
1 changed files with 5 additions and 0 deletions
|
@ -17,6 +17,11 @@
|
||||||
;;; Given a (HashTable Symbol a) and a sequence of symbols, binds
|
;;; Given a (HashTable Symbol a) and a sequence of symbols, binds
|
||||||
;;; these symbols to the values they are associated to in the hash
|
;;; these symbols to the values they are associated to in the hash
|
||||||
;;; table, then puts the body in the context of these bindings.
|
;;; table, then puts the body in the context of these bindings.
|
||||||
|
;;;
|
||||||
|
;;; > (let ([ht #hash((a . 1) (b . 2))])
|
||||||
|
;;; (auto-hash-ref/explicit (ht a b) (+ a (* 2 b))))
|
||||||
|
;;; 5
|
||||||
|
;;;
|
||||||
(define-syntax (auto-hash-ref/explicit stx)
|
(define-syntax (auto-hash-ref/explicit stx)
|
||||||
(syntax-parse stx
|
(syntax-parse stx
|
||||||
[(_ (ht:id xs:id ...) body:expr)
|
[(_ (ht:id xs:id ...) body:expr)
|
||||||
|
|
Loading…
Reference in a new issue