[plt-scheme] defmacro problem in Swindle?

From: michael rice (nowgate at yahoo.com)
Date: Wed Jun 2 14:38:10 EDT 2004

Don't know what's going on here. Scheme code (206p1
w/Swindle) just below doesn't work. Similar Common
Lisp code further down works fine. Any ideas?

(define sum 
  (lambda (nums)
    (if (null? nums)
        0
        `(+ ,(car nums) ,(sum (cdr nums))))))

(defmacro (mac1 nums)
  `(+ 4 ,(sum nums)))



> (sum '(1 2 3))
(+ 1 (+ 2 (+ 3 0)))
> (mac1 (1 2 3))
. reference to undefined identifier: sum
> 

========Common Lisp==========================

(defun sum (nums)
    (if (null nums)
        0
        `(+ ,(car nums) ,(sum (cdr nums)))))

(defmacro mac1 (nums)
  `(+ 4 ,(sum nums)))

> (sum '(1 2 3))
(+ 1 (+ 2 (+ 3 0)))
> (mac1 (1 2 3))
10
> 




	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 


Posted on the users mailing list.