diff --git a/src/ikarus.boot b/src/ikarus.boot index b842f42..72d3b44 100644 Binary files a/src/ikarus.boot and b/src/ikarus.boot differ diff --git a/src/ikarus.core.ss b/src/ikarus.core.ss index 8297b08..1627622 100644 --- a/src/ikarus.core.ss +++ b/src/ikarus.core.ss @@ -73,26 +73,6 @@ - - - - - - -(primitive-set! 'string-set! - (lambda (s i c) - (unless (string? s) - (error 'string-set! "~s is not a string" s)) - (unless (fixnum? i) - (error 'string-set! "~s is not a valid index" i)) - (unless (and ($fx< i ($string-length s)) - ($fx>= i 0)) - (error 'string-set! "index ~s is out of range for ~s" i s)) - (unless (char? c) - (error 'string-set! "~s is not a character" c)) - ($string-set! s i c))) - - #|procedure:string-append synopsis: (string-append str ...) diff --git a/src/ikarus.strings.ss b/src/ikarus.strings.ss index eb6f27b..ee32400 100644 --- a/src/ikarus.strings.ss +++ b/src/ikarus.strings.ss @@ -1,11 +1,12 @@ (library (ikarus strings) - (export string-length string-ref make-string string->list string=?) + (export string-length string-ref string-set! make-string string->list string=?) (import - (except (ikarus) string-length string-ref make-string + (except (ikarus) string-length string-ref string-set! make-string string->list string=?) (only (scheme) - $fx+ $fxsub1 $fxadd1 $char= $car $cdr $fxzero? $fx= $fx<= $fx< + $fx+ $fxsub1 $fxadd1 $char= $car $cdr + $fxzero? $fx= $fx<= $fx< $fx>= $string-length $string-ref $make-string $string-set!)) @@ -27,6 +28,19 @@ (error 'string-ref "index ~s is out of range for ~s" i s)) ($string-ref s i)) + + (define string-set! + (lambda (s i c) + (unless (string? s) + (error 'string-set! "~s is not a string" s)) + (unless (fixnum? i) + (error 'string-set! "~s is not a valid index" i)) + (unless (and ($fx< i ($string-length s)) + ($fx>= i 0)) + (error 'string-set! "index ~s is out of range for ~s" i s)) + (unless (char? c) + (error 'string-set! "~s is not a character" c)) + ($string-set! s i c))) (define make-string (let ()