From f1b9fc95da10578ef640df384bc0468c06939f61 Mon Sep 17 00:00:00 2001 From: Andy Keep Date: Tue, 12 Dec 2017 08:43:01 -0500 Subject: [PATCH] Fixing output of substring-fill! and vector-fill! - fixed substring-fill! and vector-fill! to return void, reflecting the documented return value of unspecified value. Also changes substring-fill! to use define-who instead of repeating 'substring-fill! in all the error messages. 5_4.ss, 5_6.ss original commit: 3f65788b5422693f3648a9e2fe575f464eb31ccd --- LOG | 6 ++++++ s/5_4.ss | 10 +++++----- s/5_6.ss | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/LOG b/LOG index b1abeb3710..fc9f64c523 100644 --- a/LOG +++ b/LOG @@ -758,3 +758,9 @@ primdata.ss - added support for Visual Studio 2017.15.5 wininstall/locate-vcredist.bat +- fixed substring-fill! and vector-fill! to return void, reflecting the + documented return value of unspecified value. Also changes substring-fill! + to use define-who instead of repeating 'substring-fill! in all the error + messages. + 5_4.ss, 5_6.ss + diff --git a/s/5_4.ss b/s/5_4.ss index 0e46fab705..b92e339a02 100644 --- a/s/5_4.ss +++ b/s/5_4.ss @@ -120,19 +120,19 @@ ($string-set-immutable! v2) v2)]))) -(define substring-fill! +(define-who substring-fill! (lambda (s m n c) (unless (mutable-string? s) - ($oops 'substring-fill! "~s is not a mutable string" s)) + ($oops who "~s is not a mutable string" s)) (unless (char? c) - ($oops 'substring-fill! "~s is not a character" c)) + ($oops who "~s is not a character" c)) (let ([k (string-length s)]) (unless (and (fixnum? m) (fixnum? n) (fx<= 0 m n k)) - ($oops 'substring-fill! + ($oops who "~s and ~s are not valid start/end indices for ~s" m n s)) (do ([i m (fx+ i 1)]) - ((fx= i n) s) + ((fx= i n)) (string-set! s i c))))) (set! string-for-each diff --git a/s/5_6.ss b/s/5_6.ss index 4f5fde18d4..53cff82e79 100644 --- a/s/5_6.ss +++ b/s/5_6.ss @@ -85,7 +85,7 @@ (unless (mutable-vector? v) ($oops who "~s is not a mutable vector" v)) (let ([n (vector-length v)]) (do ([i 0 (fx+ i 1)]) - ((fx= i n) v) + ((fx= i n)) (vector-set! v i obj))))) (set! fxvector->list