1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00
guile/test-suite/vm/t-macros2.scm
Ludovic Courtès aa592f96b0 Rename the testsuite' directory to test-suite/vm'.
* testsuite: Move to...
* test-suite/vm: ... here.

* Makefile.am (SUBDIRS): Remove `testsuite'.

* configure.ac: Output `test-suite/vm/Makefile' instead of
  `testsuite/Makefile'.

* test-suite/Makefile.am (SUBDIRS): Add `vm'.
2010-05-26 23:41:24 +02:00

17 lines
359 B
Scheme
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;; 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