auto-hash-ref/explicit: Add an example to the comment.

This commit is contained in:
Sergiu Ivanov 2020-02-17 00:16:01 +01:00
parent c33641fd66
commit 51e7ba3072

View file

@ -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)