22 lines
548 B
Racket
22 lines
548 B
Racket
#lang racket/base
|
|
|
|
(provide while)
|
|
|
|
(define-syntax while
|
|
(syntax-rules ()
|
|
((_ cond
|
|
body ...)
|
|
(letrec ((while (λ ()
|
|
(if cond
|
|
(begin
|
|
(displayln "cond = true")
|
|
(begin body ...)
|
|
(while))
|
|
(begin
|
|
(displayln "cond = false")
|
|
'done)))
|
|
))
|
|
(while)))
|
|
)
|
|
)
|
|
|