(define-macro (backwards . body)
(cons 'begin (reverse body)))
-(define method '(while (> counter 0)
- (display counter) (newline)
- (set! counter (- counter 1))))
-
+; Test for the while macro.
(define (count)
(define counter 10)
(while (> counter 0)
;
defer eval-quasiquote-item
-: eval-quasiquote-list ( env obj -- res )
- nil? if
- 2swap 2drop exit
- then
-
+: eval-quasiquote-pair ( env obj -- res )
2over 2over ( env obj env obj )
- cdr recurse
- -2rot car ( cdritems env objcar )
+ cdr eval-quasiquote-item
+
+ -2rot car ( cdritem env objcar )
unquote-splicing? if
eval-unquote ( cdritems caritem )
;
:noname ( env obj )
+ nil? if
+ 2swap 2drop exit
+ then
+
unquote? if
eval-unquote exit
then
pair-type istype? if
- eval-quasiquote-list exit
+ eval-quasiquote-pair exit
then
2swap 2drop
endcase
;
+( Simply evaluates the given procedure with expbody as its argument. )
: macro-expand ( proc expbody -- result )
2swap
2dup procedure-body ( expbody proc procbody )