summaryrefslogtreecommitdiff
path: root/test-suite/vm/t-macros2.scm
diff options
context:
space:
mode:
Diffstat (limited to 'test-suite/vm/t-macros2.scm')
-rw-r--r--test-suite/vm/t-macros2.scm17
1 files changed, 17 insertions, 0 deletions
diff --git a/test-suite/vm/t-macros2.scm b/test-suite/vm/t-macros2.scm
new file mode 100644
index 000000000..4cc258278
--- /dev/null
+++ b/test-suite/vm/t-macros2.scm
@@ -0,0 +1,17 @@
+;; Are macros well-expanded at compilation-time?
+
+(defmacro minus-binary (a b)
+ `(- ,a ,b))
+
+(define-macro (plus . args)
+ `(let ((res (+ ,@args)))
+ ;;(format #t "plus -> ~a~%" res)
+ res))
+
+
+(plus (let* ((x (minus-binary 12 7)) ;; 5
+ (y (minus-binary x 1))) ;; 4
+ (plus x y 5)) ;; 14
+ 12 ;; 26
+ (expt 2 3)) ;; => 34
+