* moved string-set! to ikarus.strings
This commit is contained in:
parent
196cb04ebc
commit
e1b397eea5
BIN
src/ikarus.boot
BIN
src/ikarus.boot
Binary file not shown.
|
@ -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
|
#|procedure:string-append
|
||||||
synopsis:
|
synopsis:
|
||||||
(string-append str ...)
|
(string-append str ...)
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
|
|
||||||
(library (ikarus strings)
|
(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
|
(import
|
||||||
(except (ikarus) string-length string-ref make-string
|
(except (ikarus) string-length string-ref string-set! make-string
|
||||||
string->list string=?)
|
string->list string=?)
|
||||||
(only (scheme)
|
(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
|
$string-length $string-ref
|
||||||
$make-string $string-set!))
|
$make-string $string-set!))
|
||||||
|
|
||||||
|
@ -27,6 +28,19 @@
|
||||||
(error 'string-ref "index ~s is out of range for ~s" i s))
|
(error 'string-ref "index ~s is out of range for ~s" i s))
|
||||||
($string-ref s i))
|
($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
|
(define make-string
|
||||||
(let ()
|
(let ()
|
||||||
|
|
Loading…
Reference in New Issue