LINUX.ORG.RU

История изменений

Исправление monk, (текущая версия) :

(require racket/stxparam) 
(define-syntax-parameter it 
  (lambda (stx) 
    (raise-syntax-error (syntax-e stx) "can only be used inside aif"))) 
 
(define-syntax-rule (aif condition true-expr false-expr) 
  (let ([tmp condition]) 
    (if tmp 
        (syntax-parameterize ([it (make-rename-transformer #'tmp)]) 
          true-expr)
        false-expr)))

(define-syntax-rule (fwrite str x)
  (aif str (fprintf it "~a" x) #f))

(aif 3 (fwrite (current-output-port) it) #f) ; => 3

Исходная версия monk, :

(require racket/stxparam) 
(define-syntax-parameter it 
  (lambda (stx) 
    (raise-syntax-error (syntax-e stx) "can only be used inside aif"))) 
 
(define-syntax-rule (aif condition true-expr false-expr) 
  (let ([tmp condition]) 
    (if tmp 
        (syntax-parameterize ([it (make-rename-transformer #'tmp)]) 
          true-expr)
        false-expr)))

(define-syntax-rule (fwrite str x)
  (aif str (fprintf it "~a" x) #f))

(aif 3 (fwrite (current-output-port) it)) ; => 3