commit 986b2ccf3da263fd9a15044392fa1ae74b0cd618
parent 83730aaf22837f78d1b43c0a74f34fddc2d56fa0
Author: Ed van Bruggen <edvb@uw.edu>
Date: Thu, 19 Mar 2020 00:43:19 -0700
Add var syntastic sugar macro
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/tibs/lib.tsp b/tibs/lib.tsp
@@ -71,6 +71,12 @@
((or (void? x) (nil? x) (pair? x)) x)
(else (list x))))
+(defmacro (var name eq . val)
+ "define new variable with given value"
+ `(if (= ',eq '=)
+ ,(list* 'define name val)
+ (error 'var "incorrect form")))
+
(defmacro (assert expr)
`(unless ,expr
(error 'assert "assertion " ',expr " failed")))