Added display primitives.
[scheme.forth.jl.git] / scheme-library.scm
similarity index 83%
rename from testing.scm
rename to scheme-library.scm
index 0b7d95b..207bb30 100644 (file)
@@ -1,22 +1,8 @@
-;; Some simple procedures useful for implementation testing.
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Standard Library Procedures and Macros ;; 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-; Basic iterative summation.  Run this on large numbers to
-; test garbage collection and tail-call optimization.
-(define (sum n)
-
-  (define (sum-iter total count maxcount)
-    (if (> count maxcount)
-      total
-      (sum-iter (+ total count) (+ count 1) maxcount)))
-  
-  (sum-iter 0 1 n))
-
-; Recursive summation. Use this to compare with tail call
-; optimized iterative algorithm.
-(define (sum-recurse n)
-  (if (= n 0)
-    0
-    (+ n (sum-recurse (- n 1)))))
+;; LISTS
 
 (define (null? args)
   (eq? args ()))
       (car lists)
       (join (car lists) (apply append (cdr lists))))))
 
-; Macro definitions
+
+;; LIBRARY FORMS
 (define-macro (let value . body )
               (list (list 'lambda (list (car value)) body)) (cdr value))
+
+;; TESTING
+
+; Basic iterative summation.  Run this on large numbers to
+; test garbage collection and tail-call optimization.
+(define (sum n)
+
+  (define (sum-iter total count maxcount)
+    (if (> count maxcount)
+      total
+      (sum-iter (+ total count) (+ count 1) maxcount)))
+  
+  (sum-iter 0 1 n))
+
+; Recursive summation. Use this to compare with tail call
+; optimized iterative algorithm.
+(define (sum-recurse n)
+  (if (= n 0)
+    0
+    (+ n (sum-recurse (- n 1)))))