(append (reverse (cdr l)) (list (car l)))))
;; LIBRARY FORMS
-(define-macro (let value . body )
- (list (list 'lambda (list (car value)) body)) (cdr value))
+
+(define-macro (while condition . body)
+ `(begin
+ (define (loop)
+ (if ,condition
+ (begin ,@body (loop))))
+ (loop)))
;; TESTING
+(define-macro (backwards . body)
+ (cons 'begin (reverse body)))
+
+; Test for the while macro.
+(define (count)
+ (define counter 10)
+ (while (> counter 0)
+ (display counter) (newline)
+ (set! counter (- counter 1))))
+
; Basic iterative summation. Run this on large numbers to
; test garbage collection and tail-call optimization.
(define (sum n)