awhen.rkt (289B)
1 #lang racket/base 2 3 (provide awhen it) 4 (require anaphoric/it 5 racket/stxparam 6 (for-syntax racket/base)) 7 8 (define-syntax-rule (awhen condition . body) 9 (let ([tmp condition]) 10 (when tmp 11 (syntax-parameterize ([it (make-rename-transformer #'tmp)]) 12 . body))))