* moved string->list to ikarus.strings

This commit is contained in:
Abdulaziz Ghuloum 2007-05-05 03:53:19 -04:00
parent 03318e61d9
commit 76738b4dd4
3 changed files with 20 additions and 15 deletions

Binary file not shown.

View File

@ -73,18 +73,6 @@
(primitive-set! 'string->list
(lambda (x)
(unless (string? x)
(error 'string->list "~s is not a string" x))
(let f ([x x] [i ($string-length x)] [ac '()])
(cond
[($fxzero? i) ac]
[else
(let ([i ($fxsub1 i)])
(f x i (cons ($string-ref x i) ac)))]))))
#|procedure:string=? #|procedure:string=?
synopsis: synopsis:
(string=? s s* ...) (string=? s s* ...)

View File

@ -1,10 +1,12 @@
(library (ikarus strings) (library (ikarus strings)
(export string-length string-ref make-string) (export string-length string-ref make-string string->list)
(import (import
(except (ikarus) string-length string-ref make-string) (except (ikarus) string-length string-ref make-string
string->list)
(only (scheme) (only (scheme)
$fx+ $fx= $fx<= $fx< $string-length $string-ref $fx+ $fxsub1 $fxzero? $fx= $fx<= $fx<
$string-length $string-ref
$make-string $string-set!)) $make-string $string-set!))
@ -48,4 +50,19 @@
(error 'make-string "~s is not a character" c)) (error 'make-string "~s is not a character" c))
(fill! ($make-string n) 0 n c)])) (fill! ($make-string n) 0 n c)]))
make-string)) make-string))
(define string->list
(lambda (x)
(unless (string? x)
(error 'string->list "~s is not a string" x))
(let f ([x x] [i ($string-length x)] [ac '()])
(cond
[($fxzero? i) ac]
[else
(let ([i ($fxsub1 i)])
(f x i (cons ($string-ref x i) ac)))]))))
) )