Change string->list not to be brain dead.
authorGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Wed, 2 Mar 1994 16:51:02 +0000 (16:51 +0000)
committerGuillermo J. Rozas <edu/mit/csail/zurich/gjr>
Wed, 2 Mar 1994 16:51:02 +0000 (16:51 +0000)
v7/src/runtime/string.scm

index 14252412d9bac5ba156a2ca0eb2a1636e404ed3b..186c595ca8de04807713bb9d71860ca372c6d667 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: string.scm,v 14.10 1994/03/02 16:48:59 gjr Exp $
+$Id: string.scm,v 14.11 1994/03/02 16:51:02 gjr Exp $
 
 Copyright (c) 1988-1994 Massachusetts Institute of Technology
 
@@ -203,13 +203,13 @@ MIT in each case. |#
   (substring->list string 0 (string-length string)))
 
 (define (substring->list string start end)
-  (let loop ((index start)
-            (accum '()))
-    (if (fix:< index end)
-       (loop (fix:+ index 1)
+  (let loop ((index (fix:- end 1))
+            (result '()))
+    (if (fix:< index start)
+       result
+       (loop (fix:- index 1)
              (cons (string-ref string index)
-                   accum))
-       (reverse! accum))))
+                   result)))))
 
 (define (string-copy string)
   (let ((size (string-length string)))