1 ;; Some simple procedures useful for implementation testing.
3 ; Basic iterative summation. Run this on large numbers to
4 ; test garbage collection and tail-call optimization.
7 (define (sum-iter total count maxcount)
10 (sum-iter (+ total count) (+ count 1) maxcount)))
14 ; Recursive summation. Use this to compare with tail call
15 ; optimized iterative algorithm.
16 (define (sum-recurse n)
19 (+ n (sum-recurse (- n 1)))))
24 ; Join two lists together
28 (cons (car l1) (join (cdr l1) l2))))
30 ; Append an arbitrary number of lists together
31 (define (append . lists)
34 (if (null? (cdr lists))
36 (join (car lists) (apply append (cdr lists))))))
39 (define-macro (let value . body )
40 (list (list 'lambda (list (car value)) body)) (cdr value))