Implement MAKE-INITIALIZED-LIST.
authorChris Hanson <org/chris-hanson/cph>
Fri, 3 Mar 1995 23:40:44 +0000 (23:40 +0000)
committerChris Hanson <org/chris-hanson/cph>
Fri, 3 Mar 1995 23:40:44 +0000 (23:40 +0000)
v7/src/runtime/list.scm
v7/src/runtime/runtime.pkg
v8/src/runtime/runtime.pkg

index 23e6f21880b6aa21cc3c45bece3a2b7824dd67cc..36cf54f375b93e61e43bc4774665d2a6c02b30c4 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: list.scm,v 14.19 1994/02/16 07:57:01 gjr Exp $
+$Id: list.scm,v 14.20 1995/03/03 23:40:17 cph Exp $
 
 Copyright (c) 1988-93 Massachusetts Institute of Technology
 
@@ -79,6 +79,14 @@ MIT in each case. |#
                  result)
                (loop (- n 1) (cons value result))))))
       '()))
+
+(define (make-initialized-list length initialization)
+  (guarantee-index length 'MAKE-INITIALIZED-LIST)
+  (let loop ((index (- length 1)) (result '()))
+    (if (negative? index)
+       result
+       (loop (- index 1)
+             (cons (initialization index) result)))))
 \f
 (define (list-ref list index)
   (let ((tail (list-tail list index)))
index e98e31ab5bc9399cefb3c35cfb72db540fcd831b..f7417f7ff7c7ada72ba7bdaf3a6abfb664a250ab 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: runtime.pkg,v 14.248 1995/03/01 21:58:07 adams Exp $
+$Id: runtime.pkg,v 14.249 1995/03/03 23:40:44 cph Exp $
 
 Copyright (c) 1988-95 Massachusetts Institute of Technology
 
@@ -1212,6 +1212,7 @@ MIT in each case. |#
          list?
          make-list
          make-circular-list
+         make-initialized-list
          map
          map*
          mapcan
index e98e31ab5bc9399cefb3c35cfb72db540fcd831b..f7417f7ff7c7ada72ba7bdaf3a6abfb664a250ab 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: runtime.pkg,v 14.248 1995/03/01 21:58:07 adams Exp $
+$Id: runtime.pkg,v 14.249 1995/03/03 23:40:44 cph Exp $
 
 Copyright (c) 1988-95 Massachusetts Institute of Technology
 
@@ -1212,6 +1212,7 @@ MIT in each case. |#
          list?
          make-list
          make-circular-list
+         make-initialized-list
          map
          map*
          mapcan