add `while` and `until`
parent
948f40e002
commit
2712ffa472
@ -0,0 +1,15 @@
|
|||||||
|
#lang racket/base
|
||||||
|
(require (for-syntax racket/base))
|
||||||
|
(provide (all-defined-out))
|
||||||
|
|
||||||
|
(define-syntax-rule (until cond expr ...)
|
||||||
|
(let loop ()
|
||||||
|
(unless cond
|
||||||
|
expr ...
|
||||||
|
(loop))))
|
||||||
|
|
||||||
|
(define-syntax-rule (while cond expr ...)
|
||||||
|
(let loop ()
|
||||||
|
(when cond
|
||||||
|
expr ...
|
||||||
|
(loop))))
|
Loading…
Reference in New Issue