Added (assert expr) macro
This commit is contained in:
parent
592b62cfe7
commit
d785d40935
BIN
src/ikarus.boot
BIN
src/ikarus.boot
Binary file not shown.
|
@ -802,6 +802,12 @@
|
||||||
(syntax-match stx ()
|
(syntax-match stx ()
|
||||||
[(_ expr)
|
[(_ expr)
|
||||||
(bless `(make-promise (lambda () ,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
|
(define identifier-syntax-macro
|
||||||
(lambda (stx)
|
(lambda (stx)
|
||||||
(syntax-match stx ()
|
(syntax-match stx ()
|
||||||
|
@ -1704,6 +1710,7 @@
|
||||||
[(identifier-syntax) identifier-syntax-macro]
|
[(identifier-syntax) identifier-syntax-macro]
|
||||||
[(time) time-macro]
|
[(time) time-macro]
|
||||||
[(delay) delay-macro]
|
[(delay) delay-macro]
|
||||||
|
[(assert) assert-macro]
|
||||||
[(... => _ else unquote unquote-splicing
|
[(... => _ else unquote unquote-splicing
|
||||||
unsyntax unsyntax-splicing)
|
unsyntax unsyntax-splicing)
|
||||||
incorrect-usage-macro]
|
incorrect-usage-macro]
|
||||||
|
|
|
@ -113,6 +113,7 @@
|
||||||
[or (macro . or)]
|
[or (macro . or)]
|
||||||
[time (macro . time)]
|
[time (macro . time)]
|
||||||
[delay (macro . delay)]
|
[delay (macro . delay)]
|
||||||
|
[assert (macro . assert)]
|
||||||
[... (macro . ...)]
|
[... (macro . ...)]
|
||||||
[=> (macro . =>)]
|
[=> (macro . =>)]
|
||||||
[else (macro . else)]
|
[else (macro . else)]
|
||||||
|
@ -249,6 +250,7 @@
|
||||||
[or i r ne]
|
[or i r ne]
|
||||||
[time i]
|
[time i]
|
||||||
[delay i ne]
|
[delay i ne]
|
||||||
|
[assert i r]
|
||||||
[... i r ne]
|
[... i r ne]
|
||||||
[=> i r ne]
|
[=> i r ne]
|
||||||
[else i r ne]
|
[else i r ne]
|
||||||
|
|
|
@ -84,7 +84,7 @@
|
||||||
[append C ba se]
|
[append C ba se]
|
||||||
[apply C ba se]
|
[apply C ba se]
|
||||||
[asin S ba se]
|
[asin S ba se]
|
||||||
[assert S ba]
|
[assert C ba]
|
||||||
[assertion-violation S ba]
|
[assertion-violation S ba]
|
||||||
[atan S ba se]
|
[atan S ba se]
|
||||||
[boolean=? C ba]
|
[boolean=? C ba]
|
||||||
|
|
Loading…
Reference in New Issue