From 97d64940c9ee9f031258506e95d68f456dfe0466 Mon Sep 17 00:00:00 2001 From: "Guillermo J. Rozas" Date: Wed, 2 Mar 1994 16:48:59 +0000 Subject: [PATCH] Change string->list to be iterative. --- v7/src/runtime/string.scm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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))) -- 2.25.1