cond-let.rkt (739B)
1 #lang racket/base 2 3 (provide cond-let) 4 5 (require (for-syntax racket/base)) 6 7 (define-syntax (cond-let stx) 8 (syntax-case stx (else) 9 [(cond-let [[identifierᵢ conditionᵢ] . bodyᵢ] ... [else . else-body]) 10 #'(cond [conditionᵢ => (λ (identifierᵢ) . bodyᵢ)] ... 11 [else . else-body])] 12 [(cond-let [[identifierᵢ conditionᵢ] . bodyᵢ] ...) 13 #'(cond [conditionᵢ => (λ (identifierᵢ) . bodyᵢ)] ...)] 14 15 [(cond-let identifier [conditionᵢ . bodyᵢ] ... [else . else-body]) 16 #'(cond [conditionᵢ => (λ (identifier) . bodyᵢ)] ... 17 [else . else-body])] 18 [(cond-let identifier [conditionᵢ . bodyᵢ] ...) 19 #'(cond [conditionᵢ => (λ (identifier) . bodyᵢ)] ...)]))