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

12 lines
261 B
Racket

#lang racket/base
(provide if-let)
(require (for-syntax racket/base))
(define-syntax-rule (if-let [variable condition] true-branch false-branch)
(let ([tmp condition])
(if tmp
(let ([variable tmp])
true-branch)
false-branch)))