anaphoric/awhen.rkt
2018-01-27 12:05:21 +01:00

12 lines
289 B
Racket

#lang racket/base
(provide awhen it)
(require anaphoric/it
racket/stxparam
(for-syntax racket/base))
(define-syntax-rule (awhen condition . body)
(let ([tmp condition])
(when tmp
(syntax-parameterize ([it (make-rename-transformer #'tmp)])
. body))))