commit 1bc5bf04add1266e9d87e5b5eb2ab7810645e010
parent a0d8998dc51db0ccb3dc251639b1c799eaf3c398
Author: Ed van Bruggen <edvb@uw.edu>
Date: Wed, 30 Oct 2019 22:39:02 -0700
Add assert macro
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/tibs/lib.tsp b/tibs/lib.tsp
@@ -51,6 +51,11 @@
(define (rational? x) (or (integer? x) (ratio? x)))
(define (number? x) (or (rational? x) (decimal? x)))
+(define assert
+ (macro (condition)
+ (list 'unless condition
+ (list error ''assert "assertion " 'condition " failed"))))
+
;;; Control Flow
(define if
(macro (con c d)