Added (assert expr) macro

This commit is contained in:
Abdulaziz Ghuloum 2007-09-02 20:48:59 -04:00
parent 592b62cfe7
commit d785d40935
4 changed files with 10 additions and 1 deletions

Binary file not shown.

View File

@ -802,6 +802,12 @@
(syntax-match stx ()
[(_ expr)
(bless `(make-promise (lambda () ,expr)))])))
(define assert-macro
(lambda (stx)
(syntax-match stx ()
[(_ expr)
(bless `(unless ,expr
(error 'assert "~s failed" ',expr)))])))
(define identifier-syntax-macro
(lambda (stx)
(syntax-match stx ()
@ -1704,6 +1710,7 @@
[(identifier-syntax) identifier-syntax-macro]
[(time) time-macro]
[(delay) delay-macro]
[(assert) assert-macro]
[(... => _ else unquote unquote-splicing
unsyntax unsyntax-splicing)
incorrect-usage-macro]

View File

@ -113,6 +113,7 @@
[or (macro . or)]
[time (macro . time)]
[delay (macro . delay)]
[assert (macro . assert)]
[... (macro . ...)]
[=> (macro . =>)]
[else (macro . else)]
@ -249,6 +250,7 @@
[or i r ne]
[time i]
[delay i ne]
[assert i r]
[... i r ne]
[=> i r ne]
[else i r ne]

View File

@ -84,7 +84,7 @@
[append C ba se]
[apply C ba se]
[asin S ba se]
[assert S ba]
[assert C ba]
[assertion-violation S ba]
[atan S ba se]
[boolean=? C ba]