summaryrefslogtreecommitdiff
path: root/testsuite/t-macros2.scm
blob: 4cc25827827df3c101723204763a879d62568d80 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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