From: Guillermo J. Rozas Date: Wed, 2 Mar 1994 16:48:59 +0000 (+0000) Subject: Change string->list to be iterative. X-Git-Tag: 20090517-FFI~7273 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=97d64940c9ee9f031258506e95d68f456dfe0466;p=mit-scheme.git Change string->list to be iterative. --- diff --git a/v7/src/runtime/string.scm b/v7/src/runtime/string.scm index 97b168006..14252412d 100644 --- a/v7/src/runtime/string.scm +++ b/v7/src/runtime/string.scm @@ -1,8 +1,8 @@ #| -*-Scheme-*- -$Id: string.scm,v 14.9 1993/10/13 07:40:50 cph Exp $ +$Id: string.scm,v 14.10 1994/03/02 16:48:59 gjr Exp $ -Copyright (c) 1988-93 Massachusetts Institute of Technology +Copyright (c) 1988-1994 Massachusetts Institute of Technology This material was developed by the Scheme project at the Massachusetts Institute of Technology, Department of Electrical Engineering and @@ -203,11 +203,13 @@ MIT in each case. |# (substring->list string 0 (string-length string))) (define (substring->list string start end) - (let loop ((index start)) + (let loop ((index start) + (accum '())) (if (fix:< index end) - (cons (string-ref string index) - (loop (fix:+ index 1))) - '()))) + (loop (fix:+ index 1) + (cons (string-ref string index) + accum)) + (reverse! accum)))) (define (string-copy string) (let ((size (string-length string)))