The Lambda Lab
/
projects
/
scheme.forth.jl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Quasiquote fix.
[scheme.forth.jl.git]
/
scheme-library.scm
diff --git
a/scheme-library.scm
b/scheme-library.scm
index
dc345cf
..
1a68a10
100644
(file)
--- a/
scheme-library.scm
+++ b/
scheme-library.scm
@@
-28,11
+28,26
@@
(append (reverse (cdr l)) (list (car l)))))
;; LIBRARY FORMS
(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
;; 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)
; Basic iterative summation. Run this on large numbers to
; test garbage collection and tail-call optimization.
(define (sum n)